approach suggestions- photoresistor activation with series of blinks?

I have built a set of "fireflies" using the 6 PWM pins (UNO) and trying to model real behavior of fireflies so looking for a few suggestions:

Basically the program works like this:

  1. routinely check to see if it's dark yet (via photoresistor) if so, activate routine, otherwise go back to sleep.

  2. When dark it begins randomly pulse flashing 6 nano led's with a random choice of number of blinks so it appears less predictable

  3. After 15 minutes of flashing it shuts down again.

What I would like to now do is see if I can have the arduino detect a series of flashes and be a bit more interactive...

  1. activate routine only when it is dark AND it detects, for example, 3 consecutive flashes from a flashlight (how could you "see" the sequence to indicate to the arduino it matches the series required to activate?)

  2. next step, if we wanted the fireflies to "communicate", any suggestions on getting two arduinos each with 6 nano leds (or fireflies) to recognize a pattern of flashes and repeat it back? I had thought of maybe flashing an IR transmitter and IR receiver in parallel with the LEDs on the bases of each arduino but wondered if there were better/simpler suggestions on an approach?

thanks!

-Chuck

How far apart are the two arduinos? You could use a cheap RF serial between the two. That way you wouldn't need line of sight.

cwe6279:

  1. activate routine only when it is dark AND it detects, for example, 3 consecutive flashes from a flashlight (how could you "see" the sequence to indicate to the arduino it matches the series required to activate?)

You have to decide on what is considered a flash in terms of intensity and time. Probably the best approach would be to keep a running average of the current light level and when a reading goes above a certain threshold over the average, count that as a flash.

thanks,

let's say they are 5-8 feet apart...

line of sight would be important since that's how it should work so IR would be preferable to RF for this instance.

as far as detecting flashes, sounds a bit like audio wave analysis... get the ambient avg, then within a certain amount of time (say 10 seconds) measure for a peak over a certain threshhold /tolerance, right?

Couple things:

  • look for Arduino "candle" and "Fire" to find some good flickering code. Modify for shorter blinks (But the firefly in my room two nights ago flashed for about 1/2 second with about a 5 to 10 seconds wait time)

  • I want to do something like this with an RF link, so tapping on the glass will cause the fireflies to blink, and other jars will follow that blink. Tapping other jars would also send out blinking data. Two people / classrooms in different rooms could "communicate" ?? Maybe

Maybe these low-cost transceivers? http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo

thanks, I'll have to post what I have once it's working- pretty happy with the effect so far...the color of green nano leds is also a dead ringer for fireflies. I cut white plastic drinking straws into segments and inserted each wired nano led into the straw segment and sealed the ends with hot glue. I migrated from BEAM to arduino so spend a lot of time on aesthetics :slight_smile:

and you hit nail on the head- researched and seems like they normally flash only a few times but can flash as many as 8 times then stop for 5-10 seconds. . Seemed like making it interactive would make it a pretty cool project and I like the RF idea you suggested as well!

I'll try to remember to post the final somewhere

thanks!

Have you seen these things http://lowpowerlab.com/blog/2012/12/20/moteino-the-wireless-low-power-low-cost-arduino-clone/ an 3.3V arduino clone with built in RF.
As to detecting other fireflies you could use IR to maintain the line of site principle but you don't need to try and decode the visible light flashes. Just flash the normal LED's as you see fit but also send a standard/custom IR code with the IR LED just after/during the flash sequence that can be picked up with IRemote on other fireflies.

thanks for the link- that looks like it could offer some pretty cool possibilities for this project if you could do one for each "base" of 6 leds.