Introduction: LED Fireflies Prototype

Picture of LED Fireflies Prototype

hello all, heres an attempt i made at something like an LED throwie..

the problem (for me) with led throwies is that they just consume their battery, and produce light.. but they could be better at doing both..

first you have to accept the premise that your willing to spend a bit more for the tradeoff..

the inspiration for this came from some of my other projects, and of course the "LED as a sensor" concept as well as the "LED throwie"

so the parts list:
1 common cathode, tri-color (RGB) LED
1 12f683 pic micro
1 coin cell battery holder

(cheap plug)

Step 1: So Whats It Do?

the idea here is to use the led throwie/graffiti concept, to add a little life to my neighborhood that ive been missing for a long time now... fireflies..

the software is designed to use the LED as a light sensor (so as not to waste power during the day)

the led as an entropy source (to make each firefly unique moments after switching it on) to vary blink color, and rate.

and of course to play a flash pattern every so often in a way that seems "organic" and isnt just an "on/off" blink

and of course use as little power as possible!

(apologies for the darkness of the video, but the light had to be dim enough not to trip the fireflies daylight sensor)

Step 2: Pic Code and Assembly Instructions,

Picture of Pic Code and Assembly Instructions,

c code

assembly is straight forward, the common cathod of your RGB led gets soldered to pin 2 of the pic, R-G-B pins get soldered to 7-6-5 and the pic power and ground go straight to the battery power and ground.

to put the whole thing together i just put the pic upside down on top of the battery casing, with a small dot of hot glue, bent the power and grond pins to reach over to the battery leads and attached the LED and hot glue a magnet and i was ready to go, total construction time was about 1.5 minutes.

Step 3: Suggestions

so for my second or third test, really my first worth posting.. the results are pretty good..

battery life is hard to estimate on this one, but... during the day the pic will consume ~25-30 microamps of current.. thats... microscopic.. at night, depending on the blink patterns generated.

sparkfun claims their coin cell has 250mAh of battery life, which, if the pic were the only thing on there would last well over a year, with the LEDs and of cours other factors like phantom drain from the battery..

i would estimate a couple weeks of random firefly like goodness..

some other ideas being thrown around are to maybe use infared to communicate between fireflies to some interesting effect.. but let me know what you think!


tzq33tdq (author)2010-09-27

cool, awesome, wow

yazug (author)2008-08-26

I like the idea, I'm working my own version of this with what I have, and was wondering was there anything in your firefly.h file? Thanks YaZug

Matt D655 (author)2008-07-17

what in the name of santa's ballsack was that?

phar (author)Matt D6552008-07-17

so, assuming you mean the video, it was the firefly in operation, you'll see a quick red flash just before the color pattern appears.. this is the begining of the light sensing cycle.. too bad the video is so dark, but then, what firefly lights up during the day?

Ushanka (author)2007-11-18

This is so cool! I'd been thinking about how to prolong the battery life of standard throwies but I have no skill with ICs and my attempts all ended in failure. It's nice to see that someone succeeded!

phar (author)Ushanka2007-11-18

yeah the pics are sort of nice here, ive used them on other projects as super lower power switches. theyre all big on their "nano-watt technology" and, if your willing to bear with a 37250hz system clock, you can do some cool things for almost no power.. in the project code you'll see i set oscon to 0x00 to bring the clock down to its internal rc oscillator but when i want to use pwm for the color fades i speed the clock up to 8mhz on a side note, "led as a sensor" worked pretty well at 37khz.

maker12 (author)phar2008-01-07

an lm 3090 osc ic or a smd 555 is better than a pic

phar (author)maker122008-01-07

you.. don't have a clue do you?

maker12 (author)phar2008-01-08

i do but

phar (author)maker122008-01-07

er.. what i mean is.. according to national semi.. for the luxury of a single blinking led the way you suggest.. i would consume power at typical 10mA compared to the pic running actual code at 25uA which would significantly cut my battery life.. as well as remove all the cool features like RGB led's and environmental sampling an a lot of aestetic value.. ideas and questions are always welcome but dont comment without at least reading..

Noblevagrant (author)2007-11-16

i would like to see an irfra red led that hit tv on off codes as full spectrum as possible. imagine tossing it up high in a bar you dont like. they would think there tvs were haunted.

JackandJohn (author)Noblevagrant2007-12-04

Uhm.. like this thing?

Basically just have to mod it a little and put a magnet on it

phar (author)Noblevagrant2007-11-17

i'd do it as a request, but i dont own a tv, and i'm not sure where id get a list of universal "off" code..

im also not sure if *every* tv remote operates at 40khz

another question would be if the "led as a sensor" with an ifared LED (the black ones) would also work as an infared sensor..

i'm still trying to figure out if i can use the RGB led as a color sensor

teknician89 (author)phar2007-11-19

Hello Phar, How would you use an LED(even a standard LED) as a light sensor? Is there some current flow through the semi-conductor when light is applied into the lens? I have never heard of using an LED as a light sensor before (only photo-cells or solar cells). I also have done some work with PICs, specifically the bigger 16c628, but I have a 12f675 that is looking for a nice use :). I was thinking that you could use an IR LED and photo-transistor in a PIC program to syncronize the firefly's behaviors. One example might be: have a master firefly send an omni-directional message to other nearby fireflies (via IR communication), who flash their pattern, wait a bit (oh, say 1/10th of a second), and then re-transmit the message to other neighboring fireflies who do the same - resulting in a cool wave effect. You might have to include some logic in the program to keep one firefly from signaling itself or its neighbor more than once in a given time period. Also, I was curious, did you write your own PWM algorithm or are you using the on PIC PWM facilities. I am interested because I wrote my own (havent figured out the on-board PWM yet) and I noticed from the video that your PWM is very fast. My home-made algorithm is fairly slow, even on an 8 MHz clock... Do you have the source code for your PIC? I would be interested in looking at it and maybe making my own :). Thank you much, Tek

Drew-Oz (author)teknician892007-12-01

Hey have you seen this instructable?

might help with the synchronizing effect you're looking for...

phar (author)Drew-Oz2007-12-01

yeah i ended up seeing this after i posted mine (ended up as a "related" instructable)... the only thing is that i think with a bit more code i can do something like this without adding any extra parts, and if there are any more parts, those parts are focused on power usage. unfortunatly work has be a bit busy, my weekend is going to be spent with two servers, and a lanforge satellite simulator, i'll try to get a new version out next week.

Drew-Oz (author)teknician892007-12-01

Oh, I just found this instructable too...

same-same, but different

always good to read around a topic

phar (author)teknician892007-11-19

last things first, all of the code is linked from the instructable c and asm. next up, led as a sensor, i'm not sure who thought of this, but its a clever trick using some of the other principles of electronics.. with the whole "lumped matter dicipline" sometimes you forget that components have other properties.. for example LED's are just tiny solar panels.. or LED's can be tiny capacitors.. with "led as a sensor" your using both of those non-light-making" properties, your timing how long it takes the depletion region of the diode (functionally a tiny capacitor) to disipate when ambiant light is affecting the discharge rate (since the voltage generated by the light creates slight bias on the diode).. once you start thinking about things that way, why cant i do serial communications between two fireflies without adding parts? i can modulate a signal at 40khz just like a remote control..

Noblevagrant (author)phar2007-11-17

well would it be possible to take apart a universal remote to get the codes? especially the "learning" type remotes

darus67 (author)Noblevagrant2007-11-20

The TV-B-Gone can also be had in kit form

The source code is available free for download.
The codes for a bunch of TV brands are included in the source.

Doctor What (author)phar2007-11-17

you don't own a tv?!!!

btop (author)Noblevagrant2007-11-18

you could get a universal remote and record the signals coming out as it scans for the off signal.

hondagofast (author)Noblevagrant2007-11-17

I'd love to do that! XD

mikes80501 (author)2007-11-25

Is there a version of the C code with comments? I'm having a heck of a time trying to figure it out. Thanks.

phar (author)mikes805012007-11-28

sure, i commented up the posted C file a bit more; if you have any questions feel free to ask. the lack of comments is mostly because this is still a work in progress.

mikes80501 (author)phar2007-11-28

Thanks. I could understand how to turn LEDs on and off etc. but could not figure out how you made them all a bit different. Clever use of the capsense since each will be built a little differently, humidity will change, analog noise, etc.

AzurusNova (author)2007-11-18

This seems really cool.
You know you could build onto this with a solar cell and the simple circuitry of a resistor, a 3904 and a 3906 transistor and a capacitor and wire it onto the power part of the chip and you have a self contained unit.

I reeeallyy want to build one of these, but I know my local radio shack doesn't have these sort of parts. Its going to be hard to order things online for something with this build, but I'm sure I can find a friend to help.

With the idea I have, encasing the while thing in acrylic would seal it permanently and then you would have something cool forever.
You have my fave on this one for sure.

phar (author)AzurusNova2007-11-18

while im not big on pushing products, all of the parts for this can be order from if you want to just do it all in one order, you can do the same from mouser/digikey if your willing to shop for it. so yeah, ive gone down the solar tangent, and the sad fact is that solar panels are fragile.. and the flexible panels dont really produce much power, i have had some success with using the LEDS themselves as a small solar panels but i think i lose out on the working/charging duty cycle.. we'll see ive also had some success with using an RFID coil excised from a standard HID card + germanium diode and a matching coil with a 350khz signal.. my quest for self low power/sufficient/rechargable graffiti continues

AzurusNova (author)phar2007-11-19

I can understand with the fragile solar panles, but encasing them in an epoxy can easly be done with some supplys from a local hardware store. I plan on making a few of these myself to sit on my window sill and test them. One thing though, Im planning to get myself the pic microcontroller kit from radioshack. Is it possible to use that to program these as well as any others I gain in my hands?

phar (author)AzurusNova2007-11-19

ive gone the solar panel + epoxy tangent (technically smooth-on colormatch 325), but it seemed like overkill for the fireflies since i wanted a minimal part count, but other larger projects i have might be the way to go, i just havnt been happy with the outcome so far. if your going to use a solar panel with the fireflies id recommend ditching the battery and going with a large value capacitor, the pic itself will refuse to run below 2v and will prevent turn-on untill theres enough power.. and even if the clock stops due to a total loss of power it should wake right up.. though this would probably mean that the firefly would forget its "pattern" and start over from scratch. i dont know anything about that specific pic programmer, but as long as it has an icsp header you should be able to program any pic. and so long as your programming software will take a HEX file, all of the configuration fuses are specified. *just make sure that the "brown-out-reset" is not enabled anywhere or the pic will refuse to run at 3v*

AzurusNova (author)phar2007-11-23

Hmm, thanks for the info. The controler programmer Im looking at is the learning kit they sell at radio shack. Im hoping it has all that I will need to work with it. Another application I thought of was to use these little modules in various projects. Theres so many in my head right now Im not sure what to put it to. :P

darkmuskrat (author)2007-11-18

Umm, couldnt u just put (-) battery -> photoresistor -> LED -> (+) battery I know this would only make it work in the day but could u mod this concept. (Sorry im not great around electronics...Go Woodworks!)

phar (author)darkmuskrat2007-11-18

yes, you could if all you wanted was an led to turn on at night, though you would need a photo reisitor an FET (to provide a full cutoff) and an LED. but what you lose is the cool fade-in-fade-out firefly like effect, and you lose the self modifying behaviour.. and mostly youd lose all the cool color. i know a self contained computer might seem like overkill but it really was the right tool for the job. you really cant beat ~22uA of current draw while "sleeping" (meaning runnning code at 37khz), i had to buy a new meter just to measure it!

About This Instructable




More by phar:Caffeinated Pepper-Bacon Soap30 minute USB microscopeLED fireflies prototype
Add instructable to: