Introduction: Valentine's Day Electronic Card
This year for Valentine's Day, I made a PCB card in the shape of a heart (in case you couldn't tell). It flashes 12 SMD red LEDs using charlieplexing with a ATtiny13a, running off a single CR2032 coin cell battery.
I made this card entirely in 4 hours. That includes coming up with the schematic, drawing, cutting, and etching the board, soldering all the components on, developing the program, programming the microcontroller, and debugging. Fun quick day project!
The original plan was to use the slightly larger attiny85 (it has more memory so you can write a larger function). But for some reason my programmer really didn't like that attiny85, so I reluctantly switched to the 13. With that, I had to truncate some code. ALthough the code wasn't fully developed at that point, so it just meant that I didn't finish writing it. The only thing that I am sad that I left out was the cosine wave function thingy that i started writing. So instead, there are just a few patterns it shows. Also, for some reason that I just can't figure out today, I couldn't get the button to work correctly. So ignore the button.
Here's a video of the card in action
Step 1: Materials
- 6"x6" PCB (FR4 board, 1-sided)
- dremmel or bandsaw to cut the pcb
- soldering iron + solder
- 4 SMD 100 ohm resistors (make it easy by using 1206!)
- 1 SMD 10 kohm resistor
- 12 red SMD LEDs (order extra in case they burn out or something)
- ATtiny13a or similar microcontroller
- 8 socket IC holder
- Coin cell
- Coin cell holder
- Black Sharpie to draw PCB (unless you have access to fancier equipment, mine is broken for now)
- switch (SMD) (any size, aim for maybe 4~6 mm)
- 1 cm wire (I hope thats not too much!) for a single jumper
- etching chemicals
- hydrogen peroxide (drug-store quality is perfect)
- muriatic acid (HCl) (you can buy this at most hardware stores)
- a pyrex or glass mixing bowl that you are ok never using again
Step 2: Schematic
The schematic follows a 4 pin charlieplexing scheme. The simple form of the charlieplexing circuit is shown in the upper right of the second picture.
The last picture is an uglier version (the first draft) of the circuit I used on the board. It is sorta in the shape it is supposed to be in. It is assumed the LEDs all have their cathode going to the left (counterclockwise).
The first picture is the overall full schematic of the circuit exactly as I made the card. It can be a bit confusing at first to understand where the wires are going since they are tucked into the edge of the board. It may be easier to first understand the last picture before looking at this cleaned version.
If you need help understanding the circuit, feel free to contact me.
D1-12 are the LEDs with cathode (-) pointing left (counterclockwise).
R1 are the 100 ohm resistors
R2 is the 10,000 ohm resistor
the coin cell holder is that chunk on the right
s1 is the switch which hops over the ground line.
the ATtiny is in the upper left
the 1's, 2's, 3's, and 4's in red around the picture correspond to the portb pin number of the microcontroller (note B0 is for the switch)
Step 3: Cut the PCB
For this step, first draw out the form of the heart to cut along. You will need a Dremel or vertical bandsaw.
I think you can figure out how to go from a cutting pattern to a cut out object....
If you want help with the pattern, I have attached the drawing I used as the template.
Step 4: PCB Etching
There are plenty of other fantastic instructables about the actual process for etching a PCB. I will give a quick recap:
First you will need to apply the masking layer, in this case that is sharpie. Simply draw with a sharpie wherever you don't want the FR4 PCB blank to lose its copper plating. After etching you can simply wipe off the sharpie with acetone.
In your pyrex bowl mix 1 part HCl to 2 parts H2O2.
Put the PCB in the solution. You can stir to help the reaction proceed. I suggest either using a stir plate or just slowly rocking the dish. The etching process takes about 15-20 minutes.
Pull your PCB out, wash off with water, dry with a paper towel. Then wipe off the sharpie with an acetone-soaked paper towel.
Congrats! you have a shiny new circuit board.
Step 5: Solder
The soldering is pretty straightforward If you are unfamiliar with SMD electronics, this is a pretty good place to start since the parts are well spaced out and fairly large.
Compare the schematic with the picture if you need help figuring out where things go.
I will make one last note about the pcb: I like to make a solder trace along all the copper wires so that there is no chance of them chipping away with wear or anything. It isn't necessary, but I like it. It also looks nicer in my opinion.
Step 6: Programming
The code is included in the file attached to this step.
A lot of parts are commented out, feel free to put them back in. They may need some tweaking to get working.
I also included the entire Atmel Studios project folder. If you scroll through into the Debug folder, you can find the hex file to program the card.
I used avrdude to program the cube with a usbtinyisp avr programmer that I got from adafruit. The command prompt to execute this is shown in the picture.
Step 7: Finished Card
Again, here is a quick video of the card.
Participated in the
Valentine's Day Contest