0

I would like to send an image(JPEG) captured by a pi-zero (in a in-closed container) to an pi3 for storage and analysis. Currently I have UART via gpio set up, but so far I have only been able to send strings, is there an example somewhere of transferring large file (3 MB) to get me started?

I have a pizero in a rotating container, connected to the outside via a slip ring, another pi handles the user interface and image storage. Internet connection is not available and I can only spare two cables on the slip ring for data transmission. Data integrity and transmission speed matters in my application. Right now I'm thinking I should connect the two Pis with two wires via PPP and use TCP sockets for the actual data transfer.

I also wonder if UART is a proper protocol for my application, or is it way too slow for my application? Would socket communication via WLAN be better?

Thank you in advance!

7
  • Possible duplicate of How should I properly communicate 2 Raspberry Pi via UART?
    – GramThanos
    Commented Mar 5, 2019 at 20:36
  • 2
    UART is not a protocol .... it is a hardware device used for serial communication ..... RS-232 is a protocol used for serial communication
    – jsotola
    Commented Mar 5, 2019 at 21:01
  • 3
    @jsotola RS232 is not a protocol it is an interface specification.
    – Milliways
    Commented Mar 5, 2019 at 22:46
  • 1
    Why have you rejected using ethernet? Serial is slow. Ethernet has a theoretical limit of 480Mbps.
    – Dougie
    Commented Mar 5, 2019 at 23:25
  • Because the pi zero is connected to the outside through a slip ring, I would like to minimize the number of cables required.
    – Jerry Miao
    Commented Mar 6, 2019 at 1:13

2 Answers 2

2

In the simplest form, the sender simply reads the file and writes its contents to the UART, while the receiver opens the UART and keeps reading bytes until there's nothing left (with a reasonable timeout), then stores these bytes to a file.

For more complex cases, check out serial data transmission protocols such as XMODEM / YMODEM / ZMODEM. The advantage will be that you will be able to debug the sender and the receiver separately, using a PC with know-to-work software (e.g. Putty) on the other end.

0

There are dozens of ways of sending data between 2 machines. Your question is too vague to recommend a method.

Serial is a time-honoured technique, and would be suitable for small (3MB) files, but anything over a few hundred bytes needs flow control. The Pi does not have support for hardware flow control, so software flow control would be needed.

There are also numerous protocols which are used on serial links to facilitate reliable data exchange.

3
  • Hi, thank you for your answer! As for more details for my application, I have a pizero in a rotating container, connected to the outside via a slip ring, another pi handles the user interface and image storage. Internet connection is not available and I can only spare two cables on the slip ring for data transmission. Data integrity and transmission speed matters in my application. Right now I'm thinking I should connect the two Pis with two wires via PPP and use TCP sockets for the actual data transfer. Any feedback would be much appreciated! Thanks
    – Jerry Miao
    Commented Mar 6, 2019 at 1:31
  • @JerryMiao DO not post detail into Comments, edit into your question. If I was using slip rings, I would not try to send data - the noise would be horrendous, and you will need serious error correction.
    – Milliways
    Commented Mar 6, 2019 at 2:25
  • Thank you! I'll do a bit of testing around! and question edited!
    – Jerry Miao
    Commented Mar 7, 2019 at 14:56

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.