Quote:
Originally Posted by Adam Y.
You typically don't want to drive LEDs directly off the IO port of a microcontroller. LED drivers are usually utilized which the microcontroller controls.
|
That is true, but the
PIC 16F627a (as well as a few other PICs) has the LED drivers built in to the uC. Each pin can drive up to 25mA with a total of 200mA off the entire chip.
Since this application would only require 12 lines, the 16f627a would be an ideal choice. Not only will Microchip send you a couple of freebies to experiment with, but they can be purchased for just $2.95 from digikey (dropping to $1.48 if you order 25 or more). They require NO external circuitry in order to run... just feed them something between about 2.5 and 5.5 volts and hook them up to ground and you're good to go. Plug in your LEDs and resistors direct to the I/O pins and there is no simpler or cheaper way to build the circuit described here. (Well, at least that I know of...)
I'd even be willing to hazard a guess that the PIC could handle the 240mA required to drive each LED at 20mA... at least for a short period of time... if it were kept reasonably cool. I haven't tried it... but if you fry a PIC, it's not like it is a big problem. They are cheap enough to sacrifice a few.
The software can be created in machine code using MPLAB (free) or using PICC Lite (also free, and also using the MPLAB IDE). I can't promise that it will run on a MAC, but I can bet you can find an old PC for free that will run it. If you have an old PC kicking around then you can also build the NOPPP, the
"No Parts PIC Programmer" or the
Classic PIC Programmer or any number of other DIY designs that can be done on a breadboard and plugged in to a parallel port. My favourite is the
TPIC, as it also serves as a prototype board as well as a programming board, but I'm not sure if they are still for sale. In any case, there is no shortage of commercial PIC programmers and kits for sale.
There are many other microcontrollers that could do the job, but there aren't many that can do it as simply and inexpensively as the PIC... particularly if you plan on making more than one of this device. You will be spending more on the LED's than the uC, I'll bet!
Jason