Thursday, April 26, 2012

28 Pin PIC18F Development Board

The next project I'm working on incorporates several things I've never worked with before, and instead of buying breakout boards for some parts and breadboarding the rest, I decided to design my own development board that was tailored specifically to my project.  While this board is designed with a particular project in mind, I still tried to add generic features and as much flexibility as I could.  I'm trying to learn how to use a variety of different microcontrollers (I've mostly used AVRs and MSP430s up til now), and this project seemed like a good fit to try out PICs.  The MSP430F/G chips I have are 14 pin with 2KB flash, and I needed more than that for my project.  The AVRs I have are in the ATmegaXX8 line, which certainly could have worked, but looking through the Microchip 28pin options, I saw a lot more flexibility with peripherals.  Having multiple SPI and USART ports would be useful for this project, and USB could work well for other projects to avoid using an FTDI or MCP2200.  In the end, it was mostly the chance to learn something new that made me decide to go with a PIC18 for this project.

Several sites offer a 10 copies of 10x10 cm pcb for ~$25 deal, so I initially planned on that size, but I'm using the freeware version of Cadsoft Eagle for the PCB layout, so board size was limited to 10x8 cm.  I upgraded to Eagle 6 for this layout, but I didn't notice too many changes from version 5 on the user interface side.  My goal was to essentially make a simple breakout board for the VS1003 MP3 chip, SD card, and PIC18 on a single board, add a power supply, and then leave the rest as a prototyping area.  The prototyping area is just big enough for an RFID module from ITeadStudio with two extra rows, but also makes the space more useful in projects that don't use RFID.

Most of the eagle parts I used came from the default libraries, but I also made use of the Sparkfun library and Adafruit library.  In theory, the Sparkfun library is nice because it contains part numbers so you can order straight from them and know that your parts will match the footprint, but it's not foolproof. While Sparkfun only gives you Sparkfun part numbers, Adafruit goes further and gives part numbers for multiple major distributors (Digikey, Mouser, etc.), so I used Adafruit's library whenever a part was in both.

For the power supply, I used separate MCP1702 low dropout regulators.  This regulator is available in a variety of voltages (1.20V, 1.5V, 1.8V, 2.5V, 2.8V, 3.0V, 3.3V, 4.0V, 5.0V)  and has a typical active current of 2uA, making it a good fit for battery operated projects.  They have a typical voltage drop of 625 mA, compared to 2V for an LM7805, so the power supply input doesn't need to be as high.  I used separate regulators for each of the 3 supplies for the VS1003 chip (IOVDD, CVDD, AVDD), a regulator for the PIC CVDD, and then 3.3V and 5V generic supplies for the PIC and other parts.  There is a PTC fuse for protection, and the power input is pretty flexible and can come from USB, a barrel plug wall adapter, or two wires from a battery pack.  I used solder jumpers throughout the board so that I can configure the board as needed for each project.  In addition to the jumpers selecting the power input, there's one that allows selection of 3.3V or 5V power to the PIC.

I looked at the pinouts for the two PIC18F series chips I had on hand as samples from Microchip (PIC18LF26J11 and PIC18LF26J50) and added the basic support circuit.  This included the ICSP connector for programming/debugging, reset circuitry, a crystal, and decoupling capacitors.  One of the chips has USB built in, so I routed those pins to a mini-B connector, but solder jumpers are used so that is a select-able feature.  I will not be using USB for the project I'm working towards right now, but I'd like the option to use it in the future.

The circuit for the VS1003 mp3 chip is straight out of page 15 of the datasheet, and is definitely the part of this board in which I am the least confident.  I left out the microphone input portion of the circuit because I didn't need it, but everything else is included.  I didn't route any of the pins to the PIC, but I broke out the pins required for interfacing, so it's basically a breakout board for the VS1003 on the same PCB.   I used a Sparkfun part for a headphone jack that had a part number, but it was a mistake in their library and it wasn't until I got the board and was starting to order parts that I realized the problem.  I'll probably end up getting a separate breakout board for just the headphone jack of the part of my project.

The SD card portion of the PCB is also essentially just a breakout board.  There's a jumper that allows it to use the PIC's Vcc (which should only be selected if it's 3.3V).  I used the Adafruit SD card socket footprint, which was only available at 4UCON or Newark, but I found one that looked similar on Digikey and decided to get it, and it ended up being a match.

I put footprints for 5 LEDs on the board, mostly for status and testing as I'm developing.

I used the Open PCB service from iTeadStudio when I had my boards made, which for just $0.10 you get two random PCBs that someone else designed, and two copies of your boards are sent to random people.  The chances I'd get something useful were slim, but for ten cents it was worth it.  One of the boards I got looks like one of iTead Studio's Arduino Mega Sensor Shield.  I don't have an Arduino mega, and don't plan on getting one, so this one isn't really useful to me.  The other board was a breakout board for a TQFP-32 ATmega8.  Someone used the 5cm x 5cm service and put three copies of a simple breakout board onto a single PCB.  It looks like there's enough room that I could use my dremel to cut out 3 separate breakout boards.  This one looks more useful, and I actually have some TQFP ATmega88's on hand that I can use with it.  If anyone out there ended up with a copy of my board and happens to read this, I'd love to hear from you and see if it can be of any use to you.  Here's a picture of the two boards I received.

This is first PCB I've made where I've used silkscreen, and it was a lot easier than I thought...but it didn't turn out too well.  The first PCB I designed I used a company that didn't offer free silkscreen, so I left it off, and didn't bother with the next couple either.  Because I'm intending this to be more of a development board and will be doing quite a bit of wiring after all the components are soldered on, I realized that having labels on the rows of broken out pins would be very helpful.  The eagle "smash" command, in particular, was very helpful in laying out the board so that the text was not overlapping from different parts.  I resized a lot of the text, but didn't really have a good idea of what it would look like on the actual PCB.  A lot of it ended up being really tiny...way too small to read, and some of it didn't show up at all.  I always have the eagle files up on my computer while I'm working anyway, but it would've been nice to have better labeling on the board than I ended up with.  I'll have to pay more attention to text size in the future.  Here's a picture of the how the boards turned out.

I got all of the parts I needed from Digikey except for the VS1003 chip and the headphone jack, which I'll from Sparkfun, and the RFID module from ITeadStudio.  My end goal is to make a book reader for my daughter.  The basic idea is that I'll have extended family record themselves reading books to my daughter.  I'll put the files on an SD card, and have each one tied to an RFID tag taped inside the books so that she can swipe the book over the device and it will start reading the book to her.  My Sourceforge page for this project ( has the board design files and an Excel workbook with a (mostly complete) bill of materials with part numbers.  I'll add additional files to it as I get some of the firmware tested out and working.  My next few posts will go through getting started with PICs and implementing the different pieces needed to complete my project, assuming all goes as planned.  


  1. Hey i am my very first comment on your site. ,I have been reading your blog for a while and thought I would completely pop in and drop a friendly note. . It is great stuff indeed. I also wanted to there a way to subscribe to your site via email?

    Embedded Projects in Chennai

    1. Thanks for the feedback. I've added a box on the right where you can subscribe via email. My posts are pretty infrequent due to the amount of time I get to spend doing this stuff, but I do have a couple of projects going right now that I hope to document eventually.