PIC Microcontroller Selection


PIC microcontroller selection is something we do on a weekly basis around here.  We probably start a new embedded control design every week or two, and are always going through the process of part selection.  We don’t always use Microchip parts, but if a specific microcontroller is not requested by our customer then we tend to head off in their direction.  I thought I’d write a blog entry about one of the designs I’m currently working on, and how I go about selecting a PIC microcontroller.

First, a little bit about the design.  Some weeks ago I wrote a blog entry for the Arduino compatible robot controller I was designing.   I was able to build that design and get it working.  It was an Arduino with a couple of H-bridges on it that could be used to control a robot drive system (2 DC motors) without additional circuitry.  Later I tried to employ the design as the heart of a new robot that had individually controller wheels (picture below).   For that robot design I needed to control 2 DC motors (actually 2 groups of 2 DC motors), read 4 servo signals (0.5-2.5ms pulses), and output 4 servo signals.  When I tried to do all that with my Arduino compatible robot controller I quickly ran short of pins.  Too many were needed to control the two H-bridges.

I also ran into multitasking problems.  Some of the Arduino library routines I was using did not work well together.  I could read servo signals, or I could output servo signals, or I could generate PWM signals to control the motors.  I couldn’t do all three at the same time.  I think I could get it all done if I got into the Atmel Atmega328 code on the Arduino and started messing with interrupts, but I didn’t want to do that.  And if I didn’t want to do that nobody else would either, so what’s the point?   It was then during the robot design that I switched from using the Arduino clone to a combination of our Motor Mind C dual motor controller, a Parallax BASIC Stamp 2, and an Arduino Uno R3. This worked as a mechanical test, but was not what I wanted. So I’m back at the drawing board.


When working on an R&D project that requires a microcontroller I usually use a Microchip PIC part.  I have a lot of experience with these, they work well, have tons of features, and cost very little.  For my new design I’d like to have all of the motor and servo controls accessible by a serial interface.  I need the microcontroller to run on 3.3V and 5V systems (for flexibility).  I would also like to fit it onto a PCB module that has 20 solder points.  Our company is using the 20 solder point footprint for open source hardware designs.  I came up with the block diagram at the top of this blog to show you graphically what I’m thinking of.  What I normally do for myself is just create a quick spreadsheet and jot down notes.  I know for this design I need 4 PWM outputs, 4 servo pulse outputs, 4 servo pulse inputs, power, ground, some h-bridge interface lines, a serial interface, and the ability to program and debug the design “in-circuit”.


From my spreadsheet it looks like I can fit the concept into the PCB module I want to.  I need 18 solder points for the functions I’ve defined.  Since 20 solder points are on the PCB the extra 2 can be used to allow for higher motor currents.  I won’t know until later if I can actually fit all of the parts (H-bridges, microcontroller, resistors, caps, etc)on our 1.5”x1.1” PCB module.  That problem gets handled later.  However, I do know that the smaller the number of pins on the microcontroller the greater my chances are to fit it all (and I get a lower cost).

In the lower half of the spreadsheet above I’ve identified the number of i/o pins I need for the microcontroller.  I’ve also identified the different functions I have to implement.  Since that’s defined I  can take a look at Microchip’s product selector tool to figure out which parts might work for me.   Microchip has so many parts, with so many features, that you really need a tool like their selector guide to help define which parts you should look at first.

I set some parameters in the selector tool, including…

  • at least 20 pins
  • 4 8-bit timers
  • 4-PWM outputs,
  • operated from 3-5VDC.

Other things I looked at was whether or not the microcontroller had some EEPROM and a UART.  I also made sure that some part in the family had decent amounts of program memory and RAM.  That way if you run program or variable space in a design you can just bump up to the next part in the family.  Once you’ve defined some of your parameters you can click on the Microchip part number in the table and it will link to the product page and more details.  For example, I made sure that both the parts I wanted to use had internal oscillators, which shaves about $1 or more off of the design’s cost.

I was able to narrow my search down to 2 parts. The PIC16F1829 has the resources I need in a 20-pin package.  This part runs a little over $1 in large-ish quantities.  If I go with this part then I’ll need to get creative to connect in the debug/in-circuit-serial programming pins.  In all likelihood I wouldn’t be able to debug the design and use all of its functions as the debug inputs would cause a conflict.  If I step up to the PIC16F1933 I get the same resources and more pins.  This part is roughly $1.30.



The next step in completing my part selection is to create a schematic to see if I can get away with using a 20-pin part.  Following that is the PCB layout to make sure that the design fits in the space I’m constrained to.  I might cover those steps in future posts.


  1. […] An RC servo motor controller is what I’m currently working on.  Here’s a copy of the schematic in PDF format.  In a previous blog post I recounted my effort to build a robot controller and incorporate it into an Arduino clone design (see that post here). […]

Speak Your Mind


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