I finally settled on a layout that uses 14 LEDs, two 8-bit shift registers and an ATtiny85V(though even a lowly ATtiny25 would probably work if I simplified the code, I wasn't sure how much program space I'd need and the cost difference is negligible). I've used a socket for the microcontroller so I could test different patterns and animation speeds. After running for 50 straight hours(with a somewhat above average "load" animation), my generic AA alkalines(fresh when the test started) were measured at 1.71 volts. It was still working, albeit with very low light coming from the LEDs.
So here is my first Instructable, for your enjoyment and/or education. See a video of it in action here(it doesn't actually "fade"; that's just my camera being slow) and showing off newer patterns here(sorry for the color balance). Hopefully my girlfriend likes it, and I hope you do, too! Please let me know if anything is too confusing or if you have any questions. If you decide to make one yourself, or if you're inspired to build something similar, I'd enjoy seeing your results!
Remove these ads by
Signing UpStep 1Parts
* Grid PC Board; I got mine at a local independent electronics shop, but it's very similar to RadioShack's #276-158. You can probably find one on Digi-Key, but they are needlessly expensive($10+ for a board this size), as they only carry boards designed for repeated resoldering. I'd avoid a stripboard unless you know what you're doing and are familiar with them. RadioShack's is $3.19.
Note that you could prototype this project on a solderless breadboard(and I did all of my microcontroller programming/testing on one), but the "heart" or other shape aspect will be mostly lost, obviously.
* AAx2 battery holder; I also got this from my local retailer, but you could also use RadioShack #270-408 for $1.99.
You could instead choose a low voltage(<5.5 volt for most AVR microcontrollers) power adapter instead, or a higher voltage(maybe a 9V battery, but you wouldn't have much run time) supply with a regulator.
* 3mm red LEDs - 14 pcs.; Mine are low current(2mA, but they handle up to ~30mA) from Digi-Key(754-1245-ND), and cost just under six cents each in a bag of 100. I should warn you that this exact part is actually red-orange when lit up. RadioShack part 276-026 is very comparable, and they're truly red, but cost $1.69 per pack of 2. Ouch. Converted cost for this project is $0.83($1.26 if you don't go for the 100 pack)for the Digi-Key LEDs and $11.83 for the Shack's LEDs.
Color is up to preference, but other colors have different voltage drops. More information below.
* 330 ohm resistors - 14 pcs.; Power rating and resistive element type don't make a difference, but carbon film are cheapest. RadioShack sells these in packs of five(#271-012) for $1.19 each. Digi-Key CF14JT330RCT-ND are eight cents each, individually, but if you're working with a lot of LEDs, you might wanna buy a 100 pack for $2.19 total. Amazing deal, if you ask me. RadioShack, $3.57(with one lonely resistor left over); Digi-Key, $2.19(with 86 resistors partying in your spare parts container afterward).
I calculated this resistance to provide between 2-5mA to the LEDs over the life of two alkaline AA batteries(3.2 volts fully charged, ~2 volts nearly dead). If you'll be using a different power supply and/or different LEDs, you should use an online calculator to find the value you need. Assuming you're still using batteries, find the charged and depleted voltages to ensure your LEDs look good over the life of the batteries. Here is a good calculator, but be sure to change the "how many connected" field from 2 to 1, unless you want to run multiples(do so at your own risk and with experience). Keep in mind that shift register pins don't like to supply more than about 25mA each.
* 47k ohm pull-up resistor; This lets us use the button reliably. It doesn't have to be as high as 47k, but I chose it to draw as little current as possible, as I'm running from batteries. You only need one, but RadioShack #271-1342 will get you five for $1.19 and Digi-Key S47KQCT-ND will run you $0.08 apiece.
If you already have a resistor greater than 10k, you could use it, but try not to go too far above 47k, or your microcontroller may not get enough current to be held high. Experiment on a breadboard if you have any doubt!
* 74HC595 shift register - 2 pcs.; These are each capable of driving 8 outputs, although one output on each is awkwardly on the other side of the chip. Since I'm using 14 LEDs, I just left those "odd" outputs unconnected and wrote my code to match. I used 2 296-1600-5-ND from Digi-Key at $0.63 each. RadioShack doesn't seem to sell shift registers, so my recommended Digi-Key alternative is SparkFun(COM-00733) who will charge a modest $1.50 each. Totals are $1.26 for Digi-Key's or $3 at SparkFun.
* DIP-8 IC socket; I highly recommend one for making adjustments to the code after assembly. Even if you don't intend to write or modify your own code, if there's some problem, you'll want to be able to diagnose it. I used a Swiss-milled gold-plated socket I had lying around, but it really doesn't make a difference for this. Digi-Key A100204-ND is $0.14 and RadioShack #276-1995 is $0.59.
You don't necessarily need one, if you're confident with your assembly and soldering skills. An alternative, if you'd still like programming access afterward, is to use pin headers to connect an ICSP(in circuit serial programmer). Heck, maybe you wanna use both.
* ATtiny85V; This little 8 pin microcontroller has 8K of program space, which is lovely for prototyping. I've found I don't need that much, and could get away with an ATtiny45 or possibly even a 25. I chose the "V" version because it reliably runs on voltages as low as 1.8 volts, so it's ideal for battery use. RadioShack doesn't sell microcontrollers alone, but SparkFun has the standard(not low-voltage) version COM-09378 for $2.84 and Digi-Key sells the ATtiny85V(ATTINY85V-10PU-ND) for $2.26.
Just about any microcontroller can be used here, as we only need 3 pins for shift register control and one pin for button input. If you want to forgo the shift register wiring(and coding, if you don't use my code), you should go with a controller that has enough pins to drive all of your LEDs. You can greatly increase the number of LEDs a chip can drive with charlieplexing, but that's a topic for another Instructable. Also be sure to get a different socket size if your microcontroller uses more pins!
* Power switch; I won't recommend a specific switch here, because there are thousands of valid options, and what you pick depends on what case you put this in, if you use a case at all. SPST or SPDT will work, but SPDT may be easier to find. Spec the voltage rating for your power supply, and calculate your worst-case scenario for current. Most switches will provide more than enough, but for the record, my design here will consume no more than 60mA. I paid about $4 for mine, a panel-mount paddle switch.
* Push button; This will be used to switch to the next pattern animation. Like above, there are far too many options to recommend one. I prototyped with a standard, breadboard-compatible button, but my final design uses a panel-mount button. A four pack cost $3.69.
* Enclosure; If the button/switch had a lot of options, this is just crazy. You could put this in a cardboard box, or mounted to a piece of wood or plexiglass, or even leave it exposed. Put it in a custom wooden case or hang it on the wall. Just be sure that nothing shorts out on the bottom of the circuit board. If you mount on metal, use standoffs or a lot of electrical tape. I used a tin that has a clear, plastic window in its lid. My mom had this lying around, so it cost me nothing.
| « Previous Step | Download PDFView All Steps | Next Step » |




















































I did everything the same except I swapped out red LED's for blue and machined a special aluminum enclosure for everything.
What you see on the right hand side of the one picture is a custom battery holder that I machined to hold 3 coin batteries which will attach to the back of the case to make it lightweight and easy to carry compared to AA's
Also, if people have trouble programming their ATiny (this was my first time) should pm me because it took me a long time (and very frustrating) to get working correctly.
What did you end up doing to get the programming to work?
Binary sketch size: 2318 bytes (of a 8192 byte maximum)
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85
avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85
Thanks for all the help
I assume you're using the Arduino ISP. I followed this guide(specifically the .zip file linked to on that site) to set that up, and it's been working well for me.
Connect power supply, nothing happens.
press button and all led's light up,
let go of button, all led's go out,
It won't cycle through any of the programmed functions with the button and the led's only light up while the button is pressed. I also noticed that the ATiny heats up quite a bit while the power is connected. I'm not sure if this is normal for it but I checked the circuit about 5 times for shorts and incorrect wiring but couldn't find anything.
What values of resistors are you using on the button and on the LEDs?
I'm not sure what's causing the behavior, but I did encounter something similar while I was designing mine. I'll try to remember what I did.
The configuration of the button as it sits now is, one lead goes to ground, the other to pin3 of the ATiny, also connected to pin3 is the 47k ohm resistor from which the other lead goes to V+.
I hope you get yours working soon, thank you for giving it a try! (:
Test for power on the VCC/GND pins when your power source is connected, and be sure that they aren't rotated 180 degrees(very annoying to fix). Look at the laser engraving on the registers. If they aren't something along the lines of "74*595", they may have a slightly different pinout.
because I tested the pins directly and when I kept one probe on ground/Vcc and touched any of the other pins, it would test positive for only one of the shift registers, the other only tested positive with th Vcc but there was no connection between ground and the other pins on it.
On another note, I have led's lighting up or should I say only most of the led's from 1 shift register but they don't really do anything.... they remain off unless I press the button, then they light up but only while the button is pressed. As soon as I let go they go out again. Also should the ATtiny get really warm/hot when current is run through it?
Now I'm really confused because I followed your wiring diagram for the shift registers and grounded pin 13 but when I looked up the schematic for mine (I bought the ones from the link you provided). It says that pin 8 is ground and 13 is OE. So if I grounded it improperly, I don't know why any of them are lighting up