Raspberry Pi As A PIC Programmer

[Giorgio Vazzana] turned his Raspberry Pi into a PIC programmer using a rather small collection of common parts. It supports about a dozen different chips from the 16F family. But we’d guess that software is the limiting factor when it comes to supporting more chips.

Generally the problem with PIC programming is the need for a 12V supply. He chose to use an external 12V supply and a 78L05 linear regulator to derive the 5V rails from it. With the power worked out there are some level conversion issues to account for. The RPi provides 3.3V on the GPIO header pins, but 5V logic levels are needed for programming. He built transistor and voltage divider circuits to act as level converters. The programming software bit bangs the pins with a write time of less than eight seconds per 1k words of program data. So far this does not work with ICSP, but he plans to add that feature in a future version.

19 thoughts on “Raspberry Pi As A PIC Programmer

    1. Yeah, at about $30 I think a PICkit would do just fine. This might be worth it if it works for some of the crazy complex chips that require special programmers, like the 32-Bit series. The programmers and debuggers on those things are terribly expensive.

    2. I have a security system setup where the RPi is the central brains of the system with an attached PIC to control all of the real-time hardware sensors. Since it is located in the basement, it would be really good if I could use other GPIO ports on the RPi to take the PIC offline and re-program it remotely instead of needing physical access with a PicKit2 programmer. This project proves the concept of being able to program the PIC using the RPi (though ICSP would be better) – which is useful and interesting to me :-)

  1. Maybe overkill, but actually quite useful. You need this PIC programmer and you don’t want to buy it. You just happen to have a Raspberry Pi lying around. Bingo.

    I might actually use this…

    1. Exactly.

      All of the naysayers know this is NOT targeted at professionals or even serious hobbyists. (Yet the negative comments still bring out the dramatic obvious objections).

      I’ve seen a few PIC projects that I like. I don’t want to learn PIC like I want to learn the Atmel side. But I could follow verbatim the PIC projects/tutorials I have seen, like those on the web or the awesome Make: Electronics book.

      I’m in awe, not because this is super clever — it’s probably easy for a moderately experienced circuit builder. What I am in awe of is gratitude that someone would build and _document_ this. Thank you, Giorgio!

    1. lee, thanks for your comment, but I think that octal transceiver wouldn’t work. When programming the PIC, CLK and DATA have Schmitt Trigger inputs, and they need a minimum input high level of 0.8*VDD, that is 4V. If you operate the 74LVC245 at 3.3V, the VOH of this transceiver (3.3V at best) isn’t enough to be recognized as a valid high level from the PIC. Moreover, I added the 78L05 because I didn’t want to draw any current from the RPi, apart from that needed to drive the bases of the switching transistors. I agree that you could probably build an interface with a lower number of parts, but as it is now its cost is probably under 2€, you can use any type of equivalent npn/pnp pair (like bc547/bc557) and it’s something a beginner could solder easily as a first project.

    2. lee, thanks for your comment, but I think that octal transceiver wouldn’t work. When programming the PIC, CLK and DATA have Schmitt Trigger inputs, and they need a minimum input high level of 0.8*VDD, that is 4V. If you operate the 74LVC245 at 3.3V, the VOH of this transceiver (3.3V at best) isn’t enough to be recognized as a valid high level from the PIC. Moreover, I added the 78L05 because I didn’t want to draw any current from the RPi, apart from that needed to drive the bases of the switching transistors. I agree that you could probably build an interface with a lower number of parts, but as it is now its cost is probably under 2€, you can use any type of equivalent npn/pnp pair (like bc547/bc557) and it’s something a beginner could solder easily as a first project.

      (Sorry if this shows up twice, the first one says it’s ‘awaiting for moderation’ since yesterday)

  2. Now this is really useful if you don’t have a pickit2 and want to make a clone. It avoids the chicken and egg situation of how to put the firmware into a 18F2550. Most PCs these days don’t have parallel or serial ports, and the USB to Serial converters are hit and miss.

    The BOM including the RPi (ideally) are all junk box parts.

      1. It’s not about being harsh, I just think it’s messy, and could cause problems if those long component legs short in the wrong place. When you’re working with LEDs that cost pennies, that sort of mess isn’t a big deal, but you wouldn’t want to ruin a port on your raspberry pi because the breadboard is sensitive to being touched or jostled.

      2. It is harsh/rude, ABC. This is a DEMO… and probably it’s temporary.

        Yes, you should clip your legs if you are making a solderless breadboard installation “permanent”.

        But one can equally argue that breadboard builds will end up being disassembled.. and if you recycle your parts, you don’t want to clip or harshly bend any leads.

  3. Dear Holden,
    I’ve recently built your pic programmamer on PCB and I’m using a raspberry pi 2 model B to program my PICs, but it doesn’t work and I can’t reach you at this email address:
    ‘echo bXl3aW5nODFAZ21haWwuY29tCg== | base64 -d’
    Could you give another email address in order to mail you also the schematics I’ve realised with my PCB program?

    your sincerely

    Lorenzo

Leave a Reply to steveCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.