1

Is it possible to use GPIO to sync multiple RasPi video players?

As shown in the picture below, I need to sync 16 RasPi video players. The master RasPi will trigger the video players (start, stop, next) on the other 15 RasPi's that are connected to the monitors, and it will also be the master clock for syncing the other 15 video players. I will trigger the master RasPi with OSC messages from my guitar rig (I have this working).

enter image description here

I currently have four RasPi Zero W. Each one is running a video player. By broadcasting an OSC message over WIFI to the four Raspi's, I am able to start and stop the videos and select the next video. But all the videos are out of sync by milliseconds.

I know I can resolve the sync issue using an Ethernet network instead of WIFI, but I already have four RasPi Zero W's and I can order 12 more at $10. I don't want to spend $35 on 16 RasPi 3's when I can spend $10 on 12 RasPi Zero W's.

So, is it possible to use GPIO to sync multiple RasPi video players over distances between 20ft to 40ft?

Since I only need start, stop, next and sync functionality, I'm thinking 4 wires to each Pi's GPIO for transmitting start, stop, next and sync messages.

What do you think?

  • Wired communication using RS232 may be the easiest... however, at about 40ft the signal may not be reliable. Perahps RS485 or RS422... – RubberStamp Aug 19 '18 at 0:02
2

That should work.

GPIO input at the slaves should be able to pick up your syncing signal with sub-ms accuracy and a simple script could then trigger the video player. These two answers How to precisely capture the arrival time of an input edge? and Does the Raspberry Pi manage hardware interrupts? point out that we can expect a latency of about 100 µs with outliers in the 300 µs range. I dare say that the human audience will not pick up on that.

Following your approach I would recommend to enable the pull-up resistors at the slaves' GPIO inputs and use the master to pull down the line to transmit the signal - aka active low logic. With an approximate value of the integrated pull-ups of 50 kOhm wiring all of them in parallel this will be an effective resistance of about 3 kOhm for the master's output. At 3V3 that's about 1 mA and well within limits of the Pi's GPIO pins to sink that current.

An issue one might encounter is unwanted disturbances (noise) given that the stage is likely an electrically noisy environment with all the stage lighting firing up, the power electronics and what-not-else. In this particular case noise, i.e. an undesired random disturbance, will lead to an error in transmission or a false triggering of an event.

Noise immunity could be increased with this simple setup by using external pull-ups instead of the internal ones and lower their resistance, e.g. to 10 kOhm or even lower. Unfortunately, at a certain point the total current would be too high (e.g. 55 mA @ 1 kOhm) for the master's output pin and a output buffer driver would be required.

Other ways that are more robust to a noisy environment are increased voltage levels - that is what RS232 did - or balanced line transmissions such as RS 485... but I would give the simple approach a shot and see how that works out. Test it thoroughly before the gig though.

  • thank for the detailed response! I am an experienced programmer, but I am a electronics beginner. So I am doing some research to better understand logic levels, pull-up and pull-down resistors and how this all works together for my project. When you say "wiring all of them in parallel," are you saying all the GPIO's need to be wired in parallel? My initial idea was to daisy chain all the RasPi's. But I suppose if I want to send the signal and make sure they all respond in sync, I guess all the GPIOs need to be wired in parallel. – Chris Simeone Aug 19 '18 at 18:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.