Asynchronous fireflies use few parts

led-firefly

[Karl Lunt] wrote in to share his LED firefly project. His goals for the project were to develop a low-power, low parts count module that can sense when it’s dark and then mimic the blinking patterns you’d associate with its biological namesake.

We like his design which uses a coin cell battery holder as the chassis for the project. The ATtiny13 driving the hardware is held in place by the two power wires. This lets him flash new firmware by rotating the chip and plugging in a little adapter he build. The LED connection might look a bit peculiar to you. It has a resistor in parallel, which doesn’t satisfy the normal role of a current limiting resistor. That’s by design. [Karl] is driving the LED without any current limiting, which should be just fine with the 3V battery and short illumination time of the diode. The resistor comes into play when he uses the LED as a light sensor. Past firefly projects included light dependent resistors to detect light and synchronize multiple units. [Karl] is foregoing the LDR, using the LED with a resistor in parallel to combat the capacitive qualities of the diode. As we mentioned, this senses ambient light, but we’d love to see an update that also uses the LED to synchronize a set of the devices.

Comments

  1. cute

  2. Tron9000 says:

    LED’s as light sensors! what fresh hell is this!! How have I gone through life not knowing this!

    Also: so your the one eating all the CR2032 battery holders I tried to order the other day but couldn’t!

    • Ryan Voots says:

      What’s even more fun is doing it with an LED matrix to enable multi-touch surfaces!

      • Truth says:

        Wow, I just found out about using LED’s as photodiode as well – so cool. Thanks.

        • Bob Spafford says:

          Yep! Folks using glass packaged diodes found that out the hard way about 4 decades ago. I banged head on wall until I found that my 120 Hz noise in a sensitive circuit was not AC field pickup, but the fluorescent lights overhead modulating the voltage across a signal diode! All was quiet after sequestering the diode in a bit of black shrink tube.

        • Matt says:

          Yep, and you can use motors as generators and speakers as microphones too!

      • rj says:

        As awesome as that is, it turns out you can’t effectively use it except in a dark environment—you can’t decouple the separate rows and columns of the matrix. You can only light one LED at a time, but when you’re trying to measure the photocurrent, all the other paths through the matrix work in parallel. Which is why Jeff Han does that demo in a dark room.

        I build a simple final project for a class where I discovered this, to my chagrin. I had to switch plans after discovering the above setback and ended up doing something with two analog muxes, an opamp, and PIC to measure the amount of reflectance and incident light on a 2×4 matrix. (Interesting side effect: works in all conditions, and now it’s a optical sensor as well)

  3. arachnidster says:

    Very nice. You can cut out another part by doing the LED light sensing relying on the LED’s junction capacitance: reverse bias it, drive the cathode high, then switch it to input and time how long it takes to go low.

  4. jacques says:

    if the led has no resistor, it will sink between 10 to 20 ma.
    if it is on for 2 seconds every 12 seconds, lets divide by 6 for the average current,
    1,7 ma, best case. The battery is said to be 250mah.
    It will last 150h , about one week.
    Not 2 years.

    • fartface says:

      “It will last 150h, about one week” you must live in a cave or the south pole. Because around here we have 9 hours of dark in the winter and about 6 hours in the summer. so that is closer to 25 days during the summer.

      • jacques says:

        Sure, i live in a cave. But even 25 days is quite far from 730 days

        • fartface says:

          Doesnt excuse your lack of math skills.

          • Karl Lunt says:

            Cave or no, Jacques is right on the math. My tests give only about two weeks. :-(

            I *really* wanted to avoid using a current-limiting resistor, but the battery won’t take second-long bursts of 20 mA and get anywhere near the run-time I want. My “two years” works if the LED comes on very seldom, but practically, that duration isn’t doable with this design.

            Options include PWM on the output, which wouldn’t add any parts, or adding a current-limiting resistor, or some combination of both. Again, the goal is as few parts as possible, so probably PWM…

            Design ideas welcomed. (Haven’t looked any farther in the HaD comments, might be some good suggestions already…)

            karllunt

    • OddJim says:

      An LED with no resistor will pull as much as current as it can.

      • sbrk says:

        Not quite right. It will act like a resistor with a variable value, and will attempt to sink enough current to make the voltage across its terminals equal to its bandgap (which depends on the color or frequency of the emitted photons). If Vsupply > Vbandgap and the compliance of the source is too high, the LED won’t be able to lower its internal resistance below zero and will draw (theoretically) infinite current trying to do so. Now, if the voltage is close, the LED will heat up and the bandgap will change, thus limiting the current. This will change the color of the LED and lead to early failure. The resistor in series with the LED just acts like a poor constant-current supply by reducing your supply compliance (increasing impedance). MCU pins don’t have a lot of drive capability, normally, which translates effectively into series resistance and that’s why your LED is likely to survive this application.

        A resistor in series with the LED would be best, of course. ;-)

  5. fartface says:

    I have seen this with a second IR led as a blaster and a IR phototransistor to detect the others. IT was pretty cool.

  6. cHRIS says:

    I like this – I’m just wondering, Mike (post author) and a few of the comments have mentioned synchronization of a swarm of these devices – why? I’ve witnessed a few hundred different of firefly swarms, and they aren’t synchronized – they’re random. the only reason for syncing would be your preference. if i were to build these, I’d keep them random and not try to complicate or add more components just for the sake of aesthetics. Just my opinion for what it is worth…

    • Greenaum says:

      I think the whole point of these is something to do with investigating Chaos Theory. You set them up to light randomly, or with a threshold, and also to light in response to a certain light input. There’s a lot of variations you can do. The point is, to have lots of them, and see patterns emerge spontaneously, then work out why.

      • Darren says:

        A good article with a video showing the effect in actual fireflies : http://phys.org/news197815725.html

        In most species, flightless females stay down in the grass. The females recognize the males by the pattern of their flash. If they see males flying over of the right species, they will flash to draw them down. If there’s a very high density of males flashing out of synch, the females won’t be able to register that the males are of the right species. It turns out the males use a pretty simple algorithm (which can be built into a circuit) to synchronize.

        The degree of synchronization depends on the species, the density of the swarm, and environmental factors (flashing rate depends on temperature). Even in a typical firefly situation (http://www.youtube.com/watch?v=PQNdEHSNS8M), the males will flash more often at close time intervals than would be expected from random chance.

      • Bob Spafford says:

        Old B/W TV sets, when not seeing a station,would give a screen full of white noise. It was amazing how the mind would imagine images in this noise, even when not altered by drugs!

        • Greenaum says:

          That still worked on the colour ones too! Up until transmission went completely digital (in Britain anyway). Tho the set I bought new this year still has an option for analogue reception. Even tho I bought it after analogue was turned off.

          So there might still be noise if I wanted to see some. There might be a noise-gate that stops me seeing anything if there’s no picture. Some more intelligently-designed analogue TVs mute the sound when there’s no signal, but keep the picture, to help you hone in on a channel without the vicious sound of white noise.

          But that, and campfires, faces in rock formations, all goes to show how the human brain sees things. And there’s the statistic that 1% of the spots on TV white noise is caused by cosmic rays. Which will be useless to modern kinds who’ve never had to actually tune a TV in, even if it was through a menu rather than a tiny screwdriver in a variable capacitor. Or gods-help-us, a big silver knob. Another slightly-mystical scientific fact, gone!

          • Sven says:

            Analog reception isn’t a bad thing, it’s a compatibility feature. Lots of old video games, video recorders, cameras and such only have RF out and need the RF input to be usable.

          • Whatnot says:

            Those are very very old systems that only have RF output sven, very old indeed.

            But yeah nothing wrong with having RF input anyway, allows for pirate TV :)

            Talking of which, are there any schematics for DVB-T home-made transmitters in the wild? Might be interesting for areas where there is no reception for people to play with, like africa and the isle of man maybe and other such regions where a low power DVB-T transmitter won’t mess up the neighbors but allows for community TV. via cheap DVB-T receivers/dongles.

    • Whatnot says:

      The HaD writeup suggests he uses the LED as sensor to synchronize, but he actually uses it as a darkness sensor and the synchronizing thing is mentioned as an idea for a possible future upgrade but not implemented in the project.

    • arachnidster says:

      Actually, some firefly species, such as Photinus, do synchronize.

  7. Hirudinea says:

    Perfect for LED Throwies.

    • Bill Stewart says:

      Basic LED throwies just need the battery and LED and something to keep them together. The reason you don’t need a current limiting resistor is that the coin cells don’t put out enough current to fry the LED.

      At Maker Faire last year, somebody did a cute LED flashlight with two plastic cards separated by spongy plastic, so when you squeezed the cards together, it pushed the LED wires onto the battery, and when you let go, they didn’t contact.

      • Hirudinea says:

        I know, I was just thinking that this would better than the average LED throwie, it only activates at night, it has a nice firefly effect and it should last two years, much better than an LED, a battery and tape.

  8. Wow. I see this as two way communication channel over single LED. Maybe ‘power on’ LED that serves dual function as firmware upgrade path. No case opening, no additional connectors on device.

  9. Tom the Brat says:

    Not sure you could do communication that way. An LED isn’t a GOOD photodiode, but it can tell light from dark.

  10. relwin says:

    A simple bi-directional LED experiment using a PICAXE (also in HAD a few years ago.)

    http://relwin.hackhut.com/2011/03/10/19/

  11. Tom the Brat says:

    Don’t have any Tiny 13s laying around, so I used a tiny 10. How cute. I used the timer for PWM to dim the light out ‘stead of just switching it off, and I taped it to 2 AA cells instead of a button cell. Thanks for the idea.

  12. Mage2 says:

    what about instead of a battery a really small solar cell and a supercap? then you could just use a transistor to detect when the V from the panel drops below threshold and discharge the cap through the LED. it would make for a almost never ending throwie

  13. I did the same project and came up with nearly the same solution. My design even has no resistor and wires. You can find the code at https://github.com/unhold/avr/tree/master/src/firefly/tiny13a

  14. Ijon Tichy says:

    Hmmm…. what about a tiny tv-b-gone that sleeps for hours and only acts in random intervals… doing this for months or longer with one cr2032… this could make someone rip off his last hair… mwhuahahahahahahahahahhaaaaaa >:-)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 93,647 other followers