![]() |
![]() |
| The face is controlled by a SMD (surface mount) PIC16f684 microcontroller. I wanted to try my hand at surface mount chips and I thought this would be a good introduction. The LEDs follow various patterns (ie. chasing each other, flashing in unison, checkeboard flashing, etc.) It is also very easy to add your own patterns. Overall, this is a very easy project, and a good one if you want to try your hand at SMD microcontrollers. |
| Here is the PCB. As you can see, it is very straightforward, and a schematic is not really necessary. Keep in mind the PIC is on the underside of the PCB so it appears backwards in this picture. | ![]() |
| The plus side of each LED is connected to an I/O pin of the microcontroller. The PIC16F684 has 12 I/O pins and they're are 10 LEDs total, leaving 2 I/O pins left over. The negative side of each pin is connected together and then connected to ground. |
| The LED Face uses a 3v "button cell" battery. It is a "CR2032," which is a very common battery. The +3V and Gnd on the PCB connect to the power and ground on a button cell holder. Here is a picture of the battery and holder (I got mine from Digi-key) and the underside of the LED face: | |
![]() |
![]() |
![]() |
|
|
In the picture
of the back of the face, you can see the SMD microcontroller (I covered
it with glue when I was done so there would be no problems with static
electricity) and you can also see that I added an on/off switch. I
simply put a switch between the +3v of the button cell holder and the
+3v on the circuit board. Now, on to the code. I used MPLAB v8 and PICC Lite (The "c" plugin for MPLAB.) Both of these programs are free. Here is the beginning: |
#include
<pic.h>
|
|
This section of
code #includes the pic header file, sets up the config bits and then
sets up 2 arrays for PORTA and PORTC to make cycling easy. I could have
made the code shorter, but for the sake of simplicity, I coded it this
way. We then move on to the main function: |
main()
|
|
This sets PORTA
and PORTC to all outputs, turns them off (sets them to 0), and turns
off the ADC and comparators. We then move into the guts of the program. These four routines cycle through the patterns in different ways: |
while(1)
|
| And lastly, we setup a delay routine: |
void
Delay(void)
|
|
Basically,the
operation of the program is simple: we simply turn on a specific set of
lights, wait for a delay, turn on a different set, wait for a delay,
and continue. Some may wonder how I got around using any resistors. I tested the LEDs for quite a while on a breadboard and discovered that they worked perfectly fine with the 3 volt button cell. I guess t he current in the button cell is OK as well. I also did not put on a capacitor between power and ground as it is a very stable battery and in the testing one was not needed. Lastly, I added the eyes and mouth from a batch of stickers I bought at Thinkgeek.com. They were $5.95 for 2 sheets. Very fun! You can order them here. If anyone is interested in making this project themselves, you can download the source file, ExpressPCB file and PCB artwork here. |