I'd like to build a project that has 5 independent Arduinos, which each control a single LED, and have those LEDs go off in sequence. Each device would be placed 20 ft apart and would flash its LED in order - like runway landing lights.
The easiest solution would be to have each device programmed to flash its LED every 5 seconds, then power on each device at one-second intervals.
This would sync the timing but would be only as accurate as when they were powered on, and the timing may drift after a while based on each device's timer. Also, if I wanted to make it 6 devices instead of 5, I would have to update the sketches running each device.
I trying to figure out if there is a smarter way to approach this, using some short-range communication, where one device is a master and sends out commands to any other device connected to it for when to flash.
Anyone have any suggestions on where to investigate making this work? I've been looking into bluetooth what I've read so far hasn't made me think the one-to-many connection is possible. I could be missing it though.
You could put a clock signal of a couple of Hertz on one of the output pins of the first device, and let all the other devices use this signal to turn the LEDs on and off. E.g., the second device toggles the LED after the first pulse, the third device after the second pulse, etc.
Alternatively, you could simply use one device, you could use a port expander if you run out of pins.
No matter how fast you can send the timing data, each of the independent Arduinos will have to be coded to WAIT for the timing signal.Take that into your system design.
ESP8266 or ESP32 boards, running ESP-NOW, comes to mind. There is a video on youtube that does exactly what you want, where you can add/remove ESP boards that automagically sync with the master. Can't find that video at the moment, but This video comes close.
Leo..
Wow, this may just be what I'm looking for, as I have the Nano ESP32 boards. The ESP-Now examples included in the Arduino IDE are easy to follow and should work for my application.
If one board blinks a light that the others detect, you can get them closer to synch than eyes can see.
Don't think that they all run at exactly 16MHz. They don't. But over a minute the drift is minuscule. Update to stay within tolerable limits, that process takes time from what it's for.
If you can run wire, CAN would work nicely. If you want it inexpensive, you can set up 5 (or more) CAN drivers only on one uno and use a CAN receiver for each light, no processors needed on the receiving end. This will give you almost a mile of wire if wanted. This would require separate pairs of wires to each unit.
If you want to use processors at each point you can again use CAN and simply send it a single byte command which which would cause it to flash. This would only require one pair of wires for all units.
There is also a single wire CAN you could work with but it was not destined for great distances.
Since it is battery powered I don't think espNow will be able to wake-up the esp32 from deep sleep.
The radio is turned off for all modes except active.
Yes I guess it is a short range thing, I am sure you checked it. FYI check this link out: Maximum Cable Length For a CAN Bus It shows 50 kbits/Sec - 1000 meters - (3280 feet). Part of this protocol is an inframe response. Going a little bit slower will get you even more distance. It is a bit more than IR.
Really?What range does near-IR that IR leds produce have? Will that be limited to weak signal from a single led? Near-IR is light, red leds make loads of it.
For simplicity I used delay(), just to exemplify the idea.
Considering some code that puts them into sleep mode, use pins 2 and 3 as signal inputs.
The return pulse "travels" through all the boards to avoid the voltage drop between the last board and the "master".