1

In my current project, I need to trigger multiple Raspberry PIs using one single wire. Triggering is very simple: 3.3v or 5v line going up or down every 2 or 3 minutes is enough. Devices are separated by a 20 to 80cm. The important thing is that all devices see the change at the same time.

First thought is to chain all devices using same GPIO pin and "listen" for a change on that pin. I know I could use internal pull-ups but would that be enough, for say, 50 devices ? I have the feeling that this won't work. What did I forget ?

EDIT: Thank you for your comments. You are right my question is unclear.

  • All RPi are identical and all would wait for an interrupt on the same GPIO pin.
  • All devices should see the change at the same time means as close as it can be. Time between the signal change and the last RPi to react should be less than 5 ms.
  • Distance between first and last RPi is approx 6m.

As of today, my 50 RPi are connected using the spread toolkit and I am happy with it; although the RPi are now synchronized, the problem I have is the latency between the (software) trigger and the reaction from the RPi. Again, they all react at the 'same' time, but it takes too long to react (approx. 350 ms)

My goal using a wired trigger is to get an "instant" reaction as opposed to the software trigger. So my question is: how can I link/connect 50 RPi together with a minimum of wiring so that they all get interrupted within 5 ms ?

Thanks for any help, Julien

8
  • 1
    When you say same time, how close? Is it okay with in a few ns? What would happen if there is delay of 100ns between the raspberry ok which triggers first and pi which triggers at the end? How are you spreading out 50 devices with in 80cm distance?
    – Nick
    Commented Feb 19, 2017 at 13:44
  • 1
    I'd go as far as saying: without you defining how simultaneous "at the same time" is with physical units of time, your question remains unclear and hence, inanswerable.
    – Marcus Müller
    Commented Feb 19, 2017 at 14:52
  • 1
    As others have said, can you detail your application and define (a) what the acceptable skew is between the slowest-responding and fastest-responding target and (b) what the maximum latency you can accept between the source trying to signal and the targets responding. Not knowing any of this, maybe you can drive UART inputs with strong pull-ups from FETs in parallel with each FET driving several UARTs. All sorts of possibilities once we know (a) and (b), please supply these values, thanks.
    – TonyM
    Commented Feb 19, 2017 at 18:27
  • Direct connection to all devices will provide "acceptable" operation in most cases if the driver is able to drive the combined load with rise and fall times that are acceptable. You need to sum input capacitances plus circuit capacitance (small at 80cm TOTAL but maybe not at 50 x 80cm = 40 metres) plus any resistive loading. If you poll a GPIO pin with a code loop then the skew between devices can be as great as the loop time. If you use an edge triggered detection method (perhaps an interupt) then all devices will respond "very similarly". You need first to characterise your overall input ... Commented Feb 19, 2017 at 21:40
  • 1
    All, I have edited my question. In addition, note that I don't need any sort of protocol between RPi, they already talk together through ethernet. I have studied SPI, I2C, UART but are over-complicated in terms of code and wiring; I only need a one-way signaling system.
    – jhfelectric
    Commented Feb 20, 2017 at 2:32

1 Answer 1

1

Edge-triggered interrupts on a single line should work for your 5ms requirement. I wouldn't use the internal pullups, just let everything except the driver float.

For absolutely best results, add a logic buffer from the driving source at one end, and put a termination/burden resistor on the other. Normally this would be something like 50 ohms, but since it's not a proper transmission line and we don't want to draw too much DC current from the source, try 330R.

(Note that a "single line" should include a common ground as well, so technically two wires!)

Edit:

Yes, two wires. "Bell wire" is fine for this and cheap. Linking the grounds does have ground loop risks but I would expect it to be fine with normal phone-charger power supplies if they're up to UL/CE spec.

To test your setup, link all the PSU grounds together with 100k resistors in a chain. Put a voltmeter across each resistor; try AC and DC readings. If it doesn't read zero, you have a problem. If it reads many volts, one of your PSUs is dangerous!

You could put opto-isolators in if you're really worried, at additional cost.

How would I drive the trigger line ?

A buffer. 74HC4050 is an example. (Not really required if you don't use optoisolators, but cleans up the signal and will die first if you short the wire)

what about current and/or voltage loss on the (long distance) wire ?

Again, without the optoisolators the current flow is tiny, so there's no voltage drop to worry about.

The isolators complicate things a lot, because they do consume current and therefore you need to think about adequate power buffering for the wire.

2
  • Thx pjc50 for your answer. If I were to go for the easiest solution, what would the wiring look like ? 2 wires running from one RPi to the other ? Don't you think there would be some risks in linking all grounds (not all the same PSU). How would I drive the trigger line ? what about current and/or voltage loss on the (long distance) wire ? Commented Feb 22, 2017 at 1:20
  • Thx again pjc50 for the time spent explaining. I will try the setup you describe and will come back to you if it works as expected. Commented Feb 23, 2017 at 5:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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