A few months ago I decided to have a play with the PIC microcontrollers, but on the cheap. Since I've been using Raspberry Pi and Arduino for a while I thought I'd see if I could use those as programmers. I'd already used an Arduino to program an ATTiny so I thought it should be possible. I found several different ways of doing it. The arduino-based PIC programmer seemed to be the easiest since, in addition to the arduino and a 13v supply, it only needed a few resistors and one transistor.

The upper breadboard has the atmega328 running the arduino bootloader and the PIC programming code. To the left of that is the USB to Serial board (sitting vertically in the breadboard). The lower breadboard has the PIC 16F628 microcontroller, along with the 5 to 13v boost circuit and a switch to select between program and run. This is a 4-way switch which has power and the programming signals switchable so the programmer can be isolated from the rest of the circuit when not in use. 

The Raspberry Pi breadboard adaptor is there because I was experimenting with using the serial port, and the small blue breadboard is a pulse generator which I was using to test very slow clock speeds (more of which in a future article)

The components next to the voltage board include a set of dip switches, an 8MHz crystal and two capacitors. They aren't connected to anything and were just there because I had been using them in earlier experiments.

I was using the MPLAB-X IDE from Microchip to compile the code. Since I wasn't using a supported programmer, this meant that I had to go to the command line to upload the code to the microcontroller. To further slow things down, it usually took several goes to get the upload to work, probably due to loose connections or problems with the breadboard. I know that I could improve reliability by soldering everything to a PCB, and I could use something like the when-changed python script to upload every time the code was compiled. Instead I decided to get a proper Microchip supported board so I now have one of the Curiosity Development Boards.

This article is just a brief introduction. More information will eventually be found in the following articles:

  • Very Slow Clock Speeds
  • Changing clock speeds (using the Curiosity board)
  • PIC serial connection to the Raspberry Pi