Intro: ATTiny85 5 LED POV
I've been toying with the idea of making a POV toy for a while and I finally got around to doing it. This is a derivative work based on vishalpar's excellent ATTiny85 Display instructable. The main differences with my POV is that it is mounted on a PCB and is intended to be used by hand. I still have some refinements to make with the Arduino sketch, but at the moment, it works pretty well.
This can also be viewed as a cautionary tale, don't do electronics when you're sick ... I made a couple of rookie errors when making this circuit that I wouldn't have if my head was not floating around in flu-space. Don't worry, you won't catch anything from reading this article :)
Step 1: Design Your Circuit
I started this project in Fritzing, because it is a pretty good free circuit designer. Because I planned to have the circuit powered by a 9V battery, which would serve both as power and where you grip the device while swinging it like an idiot, I started by opening the example 9V to 5V regulator circuit and I would build from there.
The Bill of Materials for this project are pretty light-weight:
- 32 x 100 mm copper clad board;
- 1 x 9V battery enclosure;
- 1 x LM7805 5V regulator;
- 2 x 10nF electrolytic capacitors;
- 1 x 8 pin DIP;
- 1 x ATTiny85;
- 5 x 5mm LED (blue);
- 5 x 220 ohm resistors.
These were placed in the breadboard view and traces stretched between them.
On the PCB view, I rearranged the components so that I could have the 5 LED running in a straight line and in the right order.
One mistake that I made early on was I had the connection between the negative pole of the battery going to the output on the LM7805 ... I didn't realise this until much later. Fortunately, I DID notice it before I had a catastrophic failure, but it was both annoying and resulted in having to to some on board correction.
The etch ready PDF's that are attached are for the silk screen layer and the copper bottom layer. If you print these out, make sure you turn of automatic scaling otherwise the transfer will be wrong.
The transfer, etch and cleanup went pretty well. After etching and when my board is almost ready to be populated, I always run my multi-meter over the board to see if there are any gaps or bridges. This is the best time to fix them because you don't have to work around soldered components.
I populated to board in the following order (note, the order of soldering is easiest, IMHO, when you go from the shortest part to the tallest part, you don't get parts trying to drop out of the board as much).
- Capacitors (on their side);
- Battery enclosure.
The next thing that I did was to put the ATTiny85 into the DIP, plug the battery in an ... nothing.
Step 2: What Went Wrong?
Well ... it's simple ... I was having trouble with orientation. I had the negative lead of the battery going to the output of the Reg. The consequence was that when the battery was plugged in, power was going in to the Reg via the positive lead and then out of the Reg into the negative lead.
To figure this out the steps that I took were:
- measure the voltage on the battery side (I was getting 3.4 Volts);
- measure the voltage on the circuit side, past the Reg (I was getting 1.3 Volts);
- observed that the Reg was getting very hot (burned to touch);
- observed that the battery was getting hot (not as hot as the Reg)
This is when I pulled the battery out and went back to the circuit design. The ATTiny85 was also pulled out of the DIP at this stage. I compared the voltage regulator part of the circuit to a design that I have used many times and found my problem.
I then cut the circuit between the negative lead and the Reg output (I cut this in two places to make sure) then I tested with the multi-meter to make sure that the trace was broken.
I drilled two holes so that I could route a jumper (the yellow wire in the photo) from the negative lead of the battery to the correct location in the circuit and soldered the jumper in place.
With the ATTiny85 still out of the circuit, I then placed the battery back into the battery enclosure and reran the voltage tests. I got 9 V on the battery side and 4.95 V on the circuit side. Also, the temperature of the LM9805 remained low (slightly warm, but sustainably so).
The ATTiny85 was then returned to it's socket and ... hey presto, the circuit worked.
Step 3: The Arduino Sketch
I have made very few changes to the sketch from vishalpar's excellent ATTiny85 Display instructable other than change the order of the LED and change the text being displayed.
The code is pretty straight forward, but doesn't appear to scale very well. I'm planning on creating another POV with 8 LED using a Shift Register, so for the new project, I'm going to need to get in and make some changes.
If you are interested, I have also included a Character Worksheet Excel spread-sheet that you can use to view the array contents as a 5 x 5 matrix.
Tab 1 - Character Solver - allows you to enter the column values from the array and it displays the 5 x 5 matrix with an X in the cells that would be turned on. There is another 5 x 5 matrix that allows you to enter an X into the desired cell and it calculates the array values for you.
Tab 2 - alphabet - shows the array values and resulting matrix display for you for all of the defined values. This sheet also allows you to enter the array values into the column cells and then will display the matrix and concatenates the values so that you can copy/paste straight into the Arduino IDE.
I've created another Excel spread-sheet that does some similar jiggery-pokery for an 8 X 8 matrix and supports the printable keyboard character from a 101 keyboard ... I'll post that later when I do the 8 X 8 POV with Shift Register.
Any-hoo ... have fun!