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!

Jerry Miao
  • 41
  • 3

2 Answers2

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.

Dmitry Grigoryev
  • 27,928
  • 6
  • 53
  • 144
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.

Milliways
  • 59,890
  • 31
  • 101
  • 209
  • 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 Mar 06 '19 at 01: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 Mar 06 '19 at 02:25
  • Thank you! I'll do a bit of testing around! and question edited! – Jerry Miao Mar 07 '19 at 14:56