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.

38 thoughts on “Asynchronous Fireflies Use Few Parts

  1. 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!

        1. 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.

      1. 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)

  2. 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.

  3. 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.

    1. “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.

          1. 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

      1. 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. ;-)

  4. 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…

    1. 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.

      1. 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.

      2. 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!

        1. 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!

          1. 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.

          2. 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.

    2. 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.

    1. 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.

      1. 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.

  5. 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.

  6. 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

  7. 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

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.