Can anyone tell me if it is possible to have the same code running on 2 arduinos and have them somehow communicate with each other so the patterns stay in sync?
I’m putting nano’s on the end of some light strings and it could be easier to wire up physically this way if it’s possible.
I’d like patterns to remain synced between controllers and switch animations at the same time.
You could add a 3rd Arduino program the 3rd one as a heartbeat generator. connect its output to the 1st and 2nd and tell them to trigger only on heartbeat…There are better ways, hopefully someone will chime in
I think I get what you are saying but it sounds more complicated and maybe less effective than what I was hoping for.
It’s not just sync I want really, I’d love to be able to unplug one of the arduino’s and have the rest keep running then be able to replace it with another and have it match back up the pattern and timing.
I guess I’m after a master slave style operation with code being output from one arduino to others and then that code repeated and sent to the lights from the slaves.
If you are using WS2812 stripes, it is “more or less” not possible to use interrupts to do other stuff. So, maybe below suggestion could be a second solution for you:
Decide one of your Arduinos as MASTER and the second as SLAVE.
on MASTER use on digital port as OUTPUT and on SLAVE one port as INPUT
in main loop of the MASTER, toggle this port every round (1st round HIGH, 2nd round LOW, 3rd HIGH,…)
in main loop of SLAVE, check value on your defined INPUT-PORT
@Danny_Evans If you look at my lightning cloud project in “show off your work” you’ll see a link to the project I cribbed off. If i understand it correctly the “wire” function allows you to transmit some info from one board to the other. I used it in connection with IR remote control to pass the remote info to the board containing the LED code but I’m sure its the same principle. Hope that helps anyway.
absolutely… see this video. de Dar a Luz uses 13 arduinos and communicates via I2C. My other project The Tunnel of Questionable Enlightenment was 60 arches all synchronized and controlled bye the user. https://www.youtube.com/watch?v=dxim1yQWqsk
I ultimately switched to a two arduino solution for each strip of LEDs. One does communication and one does the lights. They speak to each other over I2C. Then I used RS485 chip for communication bus. I2C is really a nightmare over distance and also has a deadly embrace type failure that you cannot recover from.
here is a video of 30 arches 62 processors on here…
I have a similar project with multiple Arduinos each driving longer LED strips. The key for me was to key off time. Also, I don’t care so much that the strips coming online join the others precisely at the same point in the animation, instead, when a new remote comes online the entire system resets and begins again. Joining up midstream, wirelessly, and staying in perfect sync was going to be tough with my requirements.
I use 1 Adriino acting as a “Controller” to fetch the time 1x per day via NTP and transmit it wirelessly via XBee to each of the remotes with the long runs of LED strips. Each remote has a DS3231 RTC and syncs it’s time with the controller. The controller broadcasts the animation and future start time over XBee as well and the remotes wait for the time and then kick off in perfect sync.
I actually found the tricky bit to be in keeping things in sync when a new remote came online in the middle of an animation on the existing remotes. The LED animation loop on the remote will happily play to completion even though there is a wireless message waiting in the buffer telling it to do something else, like reset. If you run into this too be sure you are able to exit any animation loop should a message arrive over the radio.
I hope this isn’t too much information, but your question is so very similar to this one project I thought I would chime in. Good luck and keep us posted!