1) They are on all the time, so on average they waste half of their energy shining during the day.
2) A continuous light is not as visible as a flashing light. An interesting flash-pattern adds to the intrigue and can even convey information.
3) Their Duty cycle is too high - a duty cycle of 10-20% is more than sufficient to be both visible and much more efficient.
This is the first of what I hope to be 2-3 versions of microcontroller projects designed to be so cheap that they can be used as throwies. The plan is to make them more efficient and use that gain to provide a more exciting effect.
This is the "basic" version - it requires only one additional part, three blobs of solder and a few snips. And by magic* it can address all of the issues above. It's programmable using the Arduino IDE, hence "Throwduino".
On a per-hour basis it should even work out cheaper than a normal throwie. The cost analysis is in step 5.
Edit - Morse Code sketch now available - see last step.
- Now you can throw your own message of choice!
* not actually magic - see step 6.
Remove these ads by
Signing UpStep 1: Parts
An ultrabright blue, blue-green or white LED*
A CR2032 battery
An ATtiny25/45/85 AVR microcontroller.
Optionally, a rare earth magnet.
You will also need these tools:
Soldering iron & solder
Wire cutters
Tape
If you want to do this and don't want to bother programing the chip yourself, leave a message and I'll see if I can arrange a source of pre-programed chips.
Assuming that you need to program the ATtiny you will need:
Parts (unless you have a programing shield for ATTinys):
A DIP8 socket
6-pin 0.1" male header (or 4-pin if you use jumper leads below)
About 2x6 inches of essentially any insulated wire or 1-2 jumper leads (ideally two colours)
Or (alternative parts):
Solderless breadboard
Jumper wres
Tools:
An Arduino (an ISP programmer would also work)
PC with Arduino IDE & Arduino Tiny cores (more on this later)
Hot glue or epoxy advisable
* You could use an Red, Orange, Yellow or Yellow-Green LED but you would need to use a resistor or you would risk a brown-out on the controller and will get a very short lifetime. This adds 30% to the parts count but almost nothing to the price. 300-500 Ohms is not a bad place to start if you go this route. Maybe a little less for Yellow-Green.












































Visit Our Store »
Go Pro Today »




reg
k
-------------------------------------------------------
"May the good belong to all the people in the world.
May the rulers go by the path of justice.
May the best of men and their source always prove to be a blessing.
May all the world rejoice in happiness.
May rain come in time and plentifulness be on Earth.
May this world be free from suffering and the noble ones be free from fears"
---- Vedic blessing
I made one Throwduino to see how it works, with the Morse code. I initialized it (connected the battery) in absolute darkness, so it would light only in darkness. But it works continuously, no matter if it is darkness or light. Am I doing anything wrong ?
Also, in the first program:
const byte flashSeq[3]={1,4,3}; // Flash pattern. Edit this.
// If you just want a longer pause, use 0 for each 500ms.
what do you mean by that ? Make an example please. I tried first this code, with 4,4,4, as flashSeq parameters but I got 12 flashes because I didn't knew how to make longer pauses.
Thanks in advance.
I assume by "works continuously" you mean that it flashes the whole time, rather than the light is on continuously. If the latter then it's probably a hardware issue (did you clip the wire between the pins for example?).
The LED light sensing has worked with all the white, blue and blue/green LEDs that I have tested. That does not mean there are no LEDs that won't work but I would be surprised. What LED are you using? Colour? Vf? clear or diffused? It shouldn't matter but I'm just interested.
Are you using the same chip (ATTiny 85) and battery (CR2032)? Do you have all the connections made correctly? I'm happy to look at a picture of your device if you post it (or PM me) to see whether I can spot any issues.
You should not need total darkness but you do need to remember that it senses over 40 seconds, so you have to wait that long before bringing it out into bright light. The first 10 seconds are not used, so you can connect the battery in the light then put it in your cupped hands within the first few seconds and that should be easily enough.
My guess would be that the battery connection broke briefly after you brought it out into the light so it re-sensed in the daylight. Maybe try connecting & tape it up well in the light so you can see what you are doing and then putting it under an upturned coffee cup for a minute after. It takes an average so even if your first few seconds are in day light, some time in darkness will push the average down enough.
With the original sketch, the LED will flash a few times after the sensing phase to tell you what value it has sensed. Might be worth looking at that. If you connect the battery in bright light it should flash out a higher reading than in low light (obviously) so try under both conditions and check that it's measuring the difference.
With regard to the flash sequence, {4,4,4} should give you three groups of four flashes, with a short pause between each group. If you do {4,0,4,0,4} then you should get longer pauses between groups. If you do {1,0,0,0,2,3,0,0,4} then you get: flash, long wait, flash, flash, short wait, flash, flash, flash, fairly long wait, flash, flash, flash, flash.
Hope that's of some help. If you can supply more details I will try to help further.
Cheers
Ugi
Thanks for the answer. I am using a clear red Led, I also tried with a clear blue, and a green piranha. I don't know Vf for any of them. I will try again, based on your above answer for the initial seconds, and also I will try the pauses with the first code.
Thanks for the answer, my friend.
It has worked fine for me, but I think this line:
threshold=(total>>5); // set threshold to average point (divide total by 128).
Should be:
threshold=(total>>7); // set threshold to average point (divide total by 128).
I can't check it just now - I'm at work - but try that and see if it helps.
Ugi
Then I saw the PS for the threshold, I made the changes and it now works like a charm!!!
Light / Dark detection - OK.
Pauses - OK.
Thank you very much for the answers and for the nice instructable! Be well!
I'll make a correction to the 'ible.
Cheers
Ugi
PS watch out for the RGB version, which will hopefully hit instructables pretty soon!
One thought I made, with a little more code and a mobile vibration motor, you could have something buzzing into a drawer when it's closed (dark) but idle when someone opens it to look into. I read this in High tech practical jokes for the Evil Genius. Thanks again.
This great demonstration on how simple and cheap an ATtiny circuit can be, was an inspiration for my newest Ible: A(T)tiny StarBird.
Thanks!
Thanks for your kind comments.
you got my vote
A pwm circuit needs a bit more parts than your solution, I expect... Did you consider using a 555?
"Hey! You can get an ATtiny for 50p! They could be disposable at that price - let's do something fun and not worry about losing the chip"
You could use a 555 for a flashing circuit or a PWM "heatbeat" but I have a feeling they are pretty power-hungry and they don't "sleep" like the AVR does. For this project, whenever the light is off the ATTiny is asleep drawing 4.5 microamps! I don't think you would get the same kind of lifetime out of a 555. Would be fun to see thou'.
Soldering things directly to the chip like that is called a "dead bug" configuration.
Maybe that's totally common knowledge, and I'm a dork for not know it, but I laughed hysterically when I heard it A guy at our lab recently was talking to me about an attiny project I was working on and was like "oh, you could deadbug it!"
Me: "Deadbug...uhhwhat?"
Him: "Deadbug!"
And he pulls out a chip with a bunch of components soldered to the bottom.
Him: "See, it looks like a dead bug!"
:)
http://fab.cba.mit.edu/content/projects/fabisp/
(It's a programmer built on an attiny44 and some passive components. Totally awesome!)
Also check out THIS project:
http://hlt.media.mit.edu/?p=1229
Which lets you program your attiny directly from your arduino! You don't even need to solder anything. TOTALLY AWESOME!
(Because if you do, you should share it with your new best friend, blhack)
Current cheapest DIP ATTiny45 from Mouser is 43p + VAT (8p) = 51p if you buy 10 or more.
Source: I have done literally that (emulating my mac's light, ha)