Summary of Programmable LED using Atmel ATtiny13v Microcontroller
This project creates a reprogrammable LED blinker controlled by light patterns using an Atmel ATtiny13v microcontroller. It utilizes an LDR to detect brightness changes, switching between recording and playback modes based on specific light transitions. The device stores up to 400 bits of data, allowing for ten seconds of blinking sequences, and runs efficiently on a small CR2032 battery.
Parts used in Programmable LED:
- 2 x 1K resistor
- 1 x LDR (Light Dependent Resistor)
- 1 x Low-current LED (1.7V, 2ma)
- 1 x Atmel ATtiny13v Microcontroller
- 1 x CR2032 Battery
- Soldering iron
- Solder wire
- Breadboard
- AVR programmer
- 5V power supply
- Multimeter
- Eclipse IDE
- CDT plugin
- WinAVR software
Inspired by various LED Throwies, blinking LEDs and similar instructables I wanted to do my version of an LED controlled by a microcontroller.
The idea is to make the LED blinking sequence reprogrammable. This reprogramming can be done with light and shadow, e.g. you could use your flashlight.
This is my first instructable, any comments or corrections are welcome.
Update 12/08/2008: There is now a kit available at the Tinker Store.
Here is a video of reprogramming it. Sorry for the quality.
Step 1 How it works
The controller has two modes of operation, one for recording a sequence, the other for playing back the recorded sequence.
Once the controller notices two changes of brightness within half of a second, (dark, bright, dark or the other way round), it switches to recording mode. In recodring mode the input of the LDR is measured multiple times a second and stored on the chip. If the memory is exhausted, the controller switches back to playback mode and starts to play the recorded sequence.
As the memory of this tiny controller is very limited, 64 bytes (yes, bytes!), the controller is able to record 400 bits. That is space enough for 10 seconds with 40 samples per second.
Step 2 Materials and Tools
– 2 x 1K resistor
– 1 x LDR (Light Dependent Resistor), e.g. M9960
– 1 x Low-current LED, 1.7V, 2ma
– 1 x Atmel ATtiny13v, 1KB flash RAM, 64 Bytes RAM, 64 Bytes EEPROM, [email protected]
– 1 x CR2032, 3V, 220mAh
Tools
– soldering iron
– solder wire
– breadboard
– AVR programmer
– 5V power supply
– multimeter
Software
– Eclipse
– CDT plugin
– WinAVR
Costs overall should be below 5$ without the tools.
I used the ATtiny13v because this version of this controller family is able to run at 1.8V. That makes it possible to run the circuit with a very small battery. To have it run for a very long time, I decided to use a low current LED which reaches full brightness already at 2ma.
Step 3 Schematics
Some comments on the schematic.
The reset input is not connected. This is not best practice. Better would be to use a 10K resistor as pull up. But it works fine for me without and it saves a resistor.
To keep the circuit as simple as possible, I used the internal oscillator. That means we save a crystal and two small capacitors. The internal oscillator lets the controller run at 1.2MHz which is more than enough speed for our purpose.
If you decide to use another power supply than 5V or to use another LEDs you have to calculate the resistor R1. The formula is: R = (Power supply V – LED V) / 0.002A = 1650 Ohm (Power supply = 5V, LED V = 1.7V). Using two low current LEDs instead of one, the formula looks like this: R = (Power supply V – 2 * LED V) / 0.002A = 800 Ohm. Please note, that you have to adjust the calculation if you choose another type of LED.
The value of the resistor R2 depends on the used LDR. 1KOhm works for me. You may want to use a potentiometer to find the best value. The cicuit should be able to detect light changes in normal daylight. To save power, PB3 is only set to high, if a measurement is done.
Update: the schematic was misleading. Below is a correct version. Thanks, dave_chatting.
For more Detail: Programmable LED using Atmel ATtiny13v Microcontroller
- How does the device switch to recording mode?
The controller switches to recording mode when it detects two changes of brightness within half a second. - What is the maximum recording duration?
The controller can record up to 10 seconds of sequence data. - Can this circuit run without a crystal oscillator?
Yes, the internal oscillator allows the controller to run at 1.2MHz without needing a crystal or capacitors. - How much memory does the microcontroller have?
The Atmel ATtiny13v has 64 bytes of RAM and EEPROM available for storing the sequence. - What formula calculates the resistor value for the LED?
The formula is R = (Power supply V - LED V) divided by 0.002A. - Does the project require a reset resistor connected?
No, the original design works without a pull-up resistor on the reset input, though it is not best practice. - What voltage range does the ATtiny13v support?
The microcontroller operates within a voltage range of 1.8V to 5.5V. - How many samples per second are taken during recording?
The system measures the input 40 times per second while in recording mode.

