5

I need to establish a connection of four Raspberry Zero with one Raspberry Pi 2 or 3 to send videos filmed by the Raspberry Zero. The Raspberry Pi 2/3 should be the main and the others (Zero) would be slaves.

How should I process the connexion here? Should I use USB or I2C or what? If there is any suggestion I'm open to it.

7

By far the easiest options for moving large amounts of data between Pi Zeros and other Pis are USB OTG, which has already been covered by Dmitry Grigoryev's answer, and ethernet or WiFi.

While USB OTG will work great if your Pis are fairly close together, the run length specification for USB tops out at around about 5 metres. Further apart than that and the time taken for signals to move between devices starts to interfere with your data transfer, resulting in degraded performance.

Using ethernet or WiFi will involve a little extra expense, as you'll need to buy suitable adapters for the Pi Zero, but has a couple of distinct advantages:

  • It will work equally well on all Pi models. If you decide at some point in the future to switch to using Pi 3s instead of Zeros you won't need to change anything about your setup. Going with USB OTG restricts you to Zeros (and possibly As).
  • Using ethernet/WiFi, you can decide at a moment's notice to send the Zeros' video feeds/files directly to one or more machines somewhere else for processing and storage. As USB OTG is a short range 1:1 connection, you can't decide to send data to some other machine that's not nearby and connected via the USB cable. Whether that's an issue or not depends on your specific requirements, but it may be extremely useful to have the option to send video files/streams to a group of devices which are not in the same room, rather than a single device which is.

Speed-wise there's not much to choose between USB OTG and ethernet/WiFi. The way the Pi's put together puts a maximum limit of around about 20MB/s on any data transfers. Both approaches should provide you with similar rates.

| improve this answer | |
7

A USB OTG connection seems like the best option here. It will be much faster than about any alternative (certainly faster than I2C or UART), and with the g_ether driver you will be able to use it as a regular network, so your videos can be either streamed or saved as files and transmitted using HTTP, FTP, netcat etc.

You will need a micro USB cable and a bit of configuration as described in this guide on page 9. To sum it up, add modules-load=dwc2,g_ether to /boot/config.txt on the Pi zero, and configure its IP address in /etc/network/interfaces.

| improve this answer | |
  • 2
    USB OTG might be a good bet - it depends on the distance required between Pis. Any more than a few metres and you're likely to encounter problems. It may be more practical to use an ethernet or WiFi adapter, which should run at around about the same speed as USB OTG but won't suffer from range issues. – goobering Oct 19 '16 at 10:55
0

Do you need to have the data transferred in real time? If not, then you can write the video files locally and use a cron job to rsync the files periodically across the network. This is particularly useful if the Pis are remote from each other, for example sending remote data back home over a dodgy or intermittent wifi.

| improve this answer | |

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.