I am looking for a way to send and receive data from one RPi to another through binary means. The end goal of this is to communicate through optical means (LED -> photodiode), which only accepts binary data (1 means light on, 0 light off). I want to be able to transfer as much as video from one RPi to another at the end of this.

How hard will this be to get done? Where should I start?

EDIT: The video files aren't very large, and could be sent easily with 1(or even 0.5) Mbps.

  • 2
    This is not really specific to the Raspberry Pi. Any solution for any computer could be applied to the Raspberry Pi.
    – joan
    Commented Oct 12, 2017 at 10:26
  • "optical means (LED -> photodiode), which only accepts binary data" -> making it exactly the same as normal computer networking, which is done in binary.
    – goldilocks
    Commented Oct 12, 2017 at 14:01
  • so maybe looking into serial communication through uart from one pi to another would be a good idea? what do you think Commented Oct 12, 2017 at 14:20

1 Answer 1


Let's do some basic calculations:

Assuming you want to transfer Video from RaspiCam and are capturing at full HD at 30 FPS. That will give us 1920x1080 (Pixels) * 3 (RGB) * 30 (FPS) = 186.6 MB/s or 1.5 Gbit/s. This is insane.

To be more conservative assume 320x240 (pixels) * 3 (RGB) * 15 (FPS) = 3.5 MB/s or 27.7 Mbit/s. Even this cannot be achieved by GPIO as it can reach at most 22 MHz with bare metal programming (benchmark). The OS has almost no time to do anything other than toggling the GPIO port. In order to be able to capture the video you have to go reasonably lower than 22 MHz. I'm not even sure 1 MHz will be reasonable. But let's say 1 MHz is practical. That would limit your bandwidth to theoretically 128 kByte/s. But to correctly decode your signal by let's say using "Manchester code" just to not need to have another GPIO port for synchronization (clock). This will cut your bandwidth in half so you have a theoretically effective bandwidth of 64 kByte/s. Even compressed video will hardly fit.

TL;DR I don't think it is practical for video. While it might work for some low data-rate scenarios.

  • All right, maybe i was a little dramatic when i said I would send video files. Assuming that the video is not so big in size, what could I do to transfer data like I said? Thank you for the calculations though, it helped me see the problem in a new light. Commented Oct 12, 2017 at 11:03
  • While there are libraries for the Arduino that allow for such an implementation like "RadioHead" formally known as VirtualWire. There seems to be a port for the Raspberry Pi here, but I haven't tried it yet.
    – kwasmich
    Commented Oct 12, 2017 at 12:04
  • The insane part isn't the stream size, since you could use any normal streaming method, they are all a) binary, and b) packet based, like all computer networking is (so what migt be insane is converting an arduino library for this purpose). You just have to send the bits (bits being what bytes are made of, a single binary digit) via a custom method (and it's toggling an led that fast that will be the hard part, not the data format).
    – goldilocks
    Commented Oct 12, 2017 at 13:58

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.