When you're starting something new, especially in electronics, it is always a good idea for your mark 1 version to be as simple as possible. This is especially true when working with a new tool chain, new programmer, and you don't have any debugger at all [1]. Consequently, this version does not have any input controls and it only drives one 5mm LED, rather than the full strip shown previously.
So, here's are mark 1 circuit:
Circuit Diagram for The Circuit Mk1 |
First up, you can see the LM7805. This is a linear voltage regulator that gives us a steady and stable 5 volts to power our microprocessor from. The 0.1uF cap is requested by the data sheet, presumably as decoupling/oscillation dampening.
Then we have the ATtiny44. This is a microprocessor from the Atmel 8-bit AVR range. The reasons I chose this particular IC was a) it has a 16-bit timer, b) it has a free C tool chain, c) it's cheap and d) I had one in my toolkit. The "v" variant indicates that it can be run at a lower voltage than the stock item, and the only reason I purchased this variant was because it was actually cheaper than the stock item.
There are three things to mention about how we have used the Attiny44.
Firstly, we have a 10uF electrolytic capacitor bridging Vcc and Gnd. This is to help smooth out the input voltage to the microprocessor as transients due to the rapid switching of the LED may cause unwanted fluctuations.
Secondly, there is a 6k8 pull up resistor from the reset pin to Vcc. This is to ensure that we don't have any unwanted resets due to a floating pin (The reset pin in an inverting input, it is taken low to reset the tiny). This value is specified by the manufacturer.
Thirdly, we have and ICSP (In-circuit System Programming) header. It is to this 6 pin header that we connect our programming device - in my case an AVRISPMk2.
For both this and the final version we're going to be using the output of the 16-bit timer to control the LED. Here the LED is connected to PB2 - Port B, pin 2. This pin also doubles as OC1A (which is what is should read in the diagram), which is the output of the timer we want. Whenever you use an LED you absolutely must have a current limiting element [2], in this case the 1k resistor. With a forward voltage of 3.3v across the LED (it's a blue one), this gives a current of 1.7mA draw through the AVR pin and the LED (well within the 40mA limit for the pin and the 20mA limit for the LED).
[1] "Burn and Crash" from "The Art of Electronics" by Horowitz and Hill
[2] http://www.thebox.myzen.co.uk/Tutorial/LEDs.html
No comments:
Post a Comment