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

An LED is used as output. As input I used an LDR, a light dependent resistor. This LDR changes its resistor as it receives more or less light. The resistor is then used as analog input to the microprocessors ADC (analog digital converter).

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.
<p>This instructable is immortal, thank you so much for sharing this.</p>
I can't find the avr programmer
can this be done on an arduino? if so, what's the code?
Yes it can, use the main C source code. Load that into yr arduino and compile. Often that will give you some error messages coz c specific code might be used but in thi scase it compiles without problems so I guess it would work.
Is there anyway you could program an L.E.D. to stay on for one hour, turn off and turn back on after 11 hours?
use an arduino
Haha! Cool idea! I like it. <br>Simple but nice. <br> <br>Keep up the good 'ibles. :) <br> <br>Also i think i may copy your method of &quot;Ubersimple-3V-supply&quot;. Simply mindblowing ;)
Love how this is put together, sort of looks like a primitive robot. Can robots be primitive? 5 stars.
that is soo cool. and a nice twist on a Throwie and aslo something good to improve skills.<br>5/5
can i do this project with a pic by any chance and if yes schematic please
Greate project. Thanks for sharing. <a href="http://www.lk-tech.blogspot.com/">lk-tech</a>
I don't really understand the C file and hex file....<br /> <br /> Which am i supposed to program?<br /> What is the other one for?
&nbsp;if you want to use this for its intended purposes, upload the HEX file to the chip using an avr programmer. &nbsp; (AVR Studio works to upload the hex). &nbsp;If you want to change the code, then you would go to the &quot;main.c&quot; file...<br /> Good luck! &nbsp;and please reply back with any more questions.
&nbsp;I am trying to read a pot using ADC on my attiny25v chip (same family as yours). &nbsp;Is there anything I should know in regard to using your code as an example for my program in AVR Studio? &nbsp;(this is for a Servo Tester - 10k pot to servo position, and also a button to center it). &nbsp;<br /> Thanks
Those commenting on the project might be interested by this alternative approach...<br /> http://enigmaker.org/post_project4_reveal.html<br />
instead of the low current led, perhaps a transistor would be handy, if you wanted to do it the other way round, use a mosfet.<br />
I love this !<br /> Great ideas !<br /> The freestyle assembly and minimal parts make it a less is more thing.<br /> Thinking it might be interesting to maybe use a few more parts to make it look like a man or robot or something.<br />
Hi Alex, im a c c++ c# programmer but am very interested in programing circuits as a&nbsp;hobby.&nbsp;<br /> Your tutorial is very simple im sure, but is there a chance you could point me to a&nbsp;ultra nubby&nbsp;circuit programing tutorial?<br /> <br /> Any help would be good as ive never&nbsp;tackled&nbsp;this before.<br />
Ehm, are you the same guy as zezba9000? Or have you just copy'n'pasted the question?<br /> I answered exactly this question (scroll down a bit to see it). <br /> <br />
Thank you so much my dear / alex_weber .<br /> and i AM &nbsp;HOPE TO BE FUN &nbsp;WITH GOOD HEALTH.&nbsp;
how can you connect the IC&nbsp;to the computer? what is the connector, adapter or something to connect it and program to a computer?<br />
with a programmer of course :D<br /> for this type (attiny13 is an AVR chip) u can use the ghetto programmer described by the real elliot (just search it here) that works with&nbsp;the serial (printer) port of ur PC<br /> or make/buy a USBtiny from <a href="http://www.ladyada.net" rel="nofollow">www.ladyada.net</a>&nbsp;that's a bit more expensive, but it works with ur USB port and doesnt need a power source.<br /> <br /> hope it helped, if u have questions about the ghetto programmer, just PM me.
How to make money simply and easily! <br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Do not miss the opportunity<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Register new: <br /> <a href="http://www.upbux.com/r?r=nibo" rel="nofollow">www.upbux.com/r</a> or<br /> <a href="http://www.palmbux.com/register.php/nibo.html" rel="nofollow">www.palmbux.com/register.php/nibo.html </a> <br /> <a href="http://www.hybux.com/?r=nibo" rel="nofollow">www.hybux.com/</a> <br /> <a href="http://www.clicksia.com/index.php?ref=nibo" rel="nofollow">www.clicksia.com/index.php</a> <br /> <a href="http://www.neobux.com/?r=niboo" rel="nofollow">www.neobux.com/</a>
&nbsp;would the chip used here, to program the led, work with sound instead of an LED? i do alot of DIY synth projects and circuit bends. this would be a great addition if compatable....... &nbsp; &nbsp;:)
In theory, yes. If you succeed, please let me know.<br />
&nbsp;Hi Alex, im a c c++ c# programmer but am very interested in programing circuits as a&nbsp;hobby.&nbsp;<br /> Your tutorial is very simple im sure, but is there a chance you could point me to a&nbsp;ultra nubby&nbsp;circuit programing tutorial?<br /> <br /> Any help would be good as ive never&nbsp;tackled&nbsp;this before.<br />
Hi,<br /> take a look at http://www.avrfreaks.net<br /> They have nice tutorials.<br /> Or, another good starting point, especially for software developers, is the Arduino project. Really easy to get started.<br /> http://arduino.cc<br /> <br />
greeeaat!!!<br />
Can this only blink on and off, or can it fade also?&nbsp; Such as if you program it using a light with a dimmer switch.&nbsp; And does anywhere sell just the chip (not a full kit) with the program already on it?&nbsp; When you remove the LDR, does the chip remember the last sequence entered from then on, even if the battery goes dead and has to be replaced?<br />
Yes, you could make it fading. For that you should google for PWM (pulse width modulation).<br /> <br /> The recorded sequence is stored in RAM, so it would be lost if the battery goes dead. But you could store the sequence in EEPROM.<br />
What is the difference between an ATtiny13V and an ATtiny13A ? Bruno
The ATtiny13A is a replacement for the now &quot;old&quot; ATtiny13V and should be pin-compatible.<br />
Looks like really cool!<br />
is their such thing as a cell that powers when there is no light then when there is light?
from electric become art so called electricart
Very nice one! Funky gadget!
Hi, can you recommend a store where I can get the Atmel ATtiny13v, the other components and the tools required? (breadboard and AVR programmer) Cheers, Jonathan
sparkfun.com wide variety and stock. reasonable prices.
Hi tintenfish,<br/>looking at your nick, I assume you are living in a german speaking country?<br/>For cheap ATtiny, have a look at: <a rel="nofollow" href="http://www.csd-electronics.de/de/index.htm">http://www.csd-electronics.de/de/index.htm</a><br/>They have breadboards and other components as well. For a programmer, check out the USBtinyISP from adafruits.<br/>Cheers,<br/>Alex<br/>
Hi, thanks for your reply :) You are almost right.. it is a German word and I'm from Sweden, but I live in New York City right now.. Do you know any stores in the states? Also, should I get SOIC or PDIP? Is there any difference between them? Cheers, J
<a rel="nofollow" href="http://www.sparkfun.com/commerce/product_info.php?products_id=211">sparkfun</a> carries most of the atmel chips, and <a rel="nofollow" href="http://www.instructables.com/id/Ghetto-Programming:-Getting-started-with-AVR-micro/">this</a> instructable is a great intro to avr, with instructions on how to build a cheap programming cradle.<br/>
Hi Jonathan, I'm sorry, I don't know any stores in the US. But you should look for the PDIP package, that's the one I used. The other one is an SMT package and very tiny. Cheers, Alex
You Can get a few different types of breadboards on this site how ever I don't know where to get the AVR programmer<br/><br/><a rel="nofollow" href="http://www.abra-electronics.com/products/catalog/Boards-orderby0-p-1-c-7.html">http://www.abra-electronics.com/products/catalog/Boards-orderby0-p-1-c-7.html</a><br/>
looks cool at the end and functional! very nice O-o im sure you could sell the programed ATtiny chips or sold everything in a pack to build yourself O_o just a thought ;)
If you look closely above, there is a link to the Tinker Store, where I sell kits of the Programmable LED ;)
Hi Alex, Great project. I want to build a circuit for my son who is learning mores code. I think I will have no problem building the device but not sure how to program the ATtiny. How do you download the program to the ATtiny? Where do I get the Mymultipro device? I have a computer and I assume I build the program in sw named above and hit download to the Mymultipro and the rest is history. I also saw the video and it shows using light to train the circuit. Which method do you use. If you have to train the ATtiny with light as in the video then how do you protect it from outside influences? Thanks much, JPR55
Hi jpr55,<br/><br/>I am using now the USBtinyISP programmer from adafruit. Very handy.<br/><a rel="nofollow" href="http://www.ladyada.net/make/usbtinyisp/">http://www.ladyada.net/make/usbtinyisp/</a><br/>You will need a breadboard to setup an programming environment, as you can not program the Programmable LED in circuit. You first have to program the controller and then solder everything together.<br/>Here is another good starting point to learn how to program microcontrollers:<br/><a href="http://www.instructables.com/id/Ghetto-Programming%3a-Getting-started-with-AVR-micro/">http://www.instructables.com/id/Ghetto-Programming%3a-Getting-started-with-AVR-micro/</a><br/><br/>The circuit enters the recording mode by a light pulse, &quot;dark - bright - dark&quot;, or the other way round, &quot;bright - dark -bright&quot;. That way it should not take up outside influences. Although, I saw it on time happen as it got slowly darker, the ambient light triggered the switching.<br/><br/>Cheers,<br/>Alex<br/>
it's a very good project! Congratulations! i can't build it, because i have anything. i'll build it later :(
"i can't build it, because i have anything" ?

About This Instructable


518 favorites


More by alex_weber: 64pixels Arduino XMAS hitcounter Synchronizing Fireflies
Add instructable to: