Looking for advice about networking and bi-directional messaging

Hi, I’m currently building a setup where I want to have multiple cameras on raspberry pis, and trying to evaluate what’s the most adequate software stack to have synchronized photo triggering, followed by retrieving of all the images. I’m thinking of one main PI without any camera attached and many other PIs with one camera each (say 4-10)

I have plenty ideas/questions and maybe some of these are stupid and some are worth exploring.

For synchronization, I’d like to be able to trigger photos with a precision between 1ms and 5ms. I have two ideas for that, (1) direct order sent either through network or gpio, or (2) synchronize the time on the LAN and send a message indicating an exact moment to take the pictures.

For retrieving the pictures, I was thinking using some kind of message passing communication via network.

In all cases I don’t think I can avoid setting bidirectional communication channels between the PIs, because, in addition to retrieving the images, I might need to ask them status info about few things. I’m not very familiar with network stacks so I figured some people could push me in the right direction. My main criteria are low latency (for synchronized triggers if I go this route instead of scheduled time sync triggers) and easy to send and receive messages in both directions.

Regarding hardware, ideally the PIs connected to the cameras are PI zero 2w, and the other one can be a PI4 or a traditional cheap computer.

What are you thoughts?

If you need 1ms latency, then realistically, no LAN connection will cut it. If you can connect the RPis together using GPIO, or better yet, via some hardware-supported protocol (USART, SPI, I2C), then definitely do gown that route instead of eg. TCP/IP over Ethernet.

For the retrieval of the images, however, just set up an HTTP client/server connection, that's going to be far the easiest for transferring files correctly and robustly, and without reinventing about 40 years of wheels.

2 Likes

UDP broadcast with the listeners at a slightly elevated priority.

1 Like

I'll probably test a few different things. Thanks for pointing out those hardware protocols. It seems to me I2C is the easiest to use for my situation since I could put all PIs on the same bus, with minimal cable work.

I've read that time synchronization on local network via ntp can also achieve 1ms precision. So I'll probably also try to see if I can make time sync work, and use scheduled triggers.