0

I'm trying to send image(3MB) captured by one pi to another pi, external WIFI or setting up one pi as AP is not possible due to strict regulations, all I can use are the two wires.

Currently I'm doing this by connecting RX and TX, forming a ppp connection, and transferring the file via python sockets, however, this is really slow, even at the maximum stable baud rate it still takes more than 30 seconds.

Is there an alternative way for me to achieve the same goal? Would bluetooth work?

Thank you in advance!!

  • If I understand you are using the serial port to create a ppp connection - this seems rather convoluted; why not just send over serial? Even so if you are transferring 3MB in 30 sec this is ~1Mb/s - about the maximum you could expect. SPI may be a bit faster. – Milliways Apr 22 at 6:45
0

send image 3MB captured by one pi to another pi,

external WIFI or setting up one pi as AP not possible due strict regulations,

all I can use are the two wires.

Currently I'm doing this by connecting RX and TX, ppp python sockets

really slow, maximum stable baud rate takes more than 30 seconds.

Would bluetooth work?

Well, if you can consider Bluetooth at 2.4G, would you also consider cheapy Rpi SPI 5MHz, 300m, 434/915MHz modules? I once played with SPI RS232 RFM12B ISM FSK 200m modules and found them OK.

AlliExpress A7102C 300m wireless transceiver module CC1100/NRF905/SPI 315/434/868/915MHz US $11

A7102C modules

References

SparkFun RFM12B Universal SPI RS232 ISM Band FSK Transceiver

0

Ignoring WiFi and Bluetooth wireless, there are four data interfaces on the Pi, SPI, I2C, and UART Serial, which it sounds like you're currently using with the TX and RX pins (and presumably ground), and USB. SPI, I2C, and USB all require one device to be a master, organizing communication, and one device to be the slave. Serial is bi-directional and generally less complex to setup. (Note USB is technically two wire if you ignore the 5V wire.) All of these interfaces will also require a shared ground.

According to Can Raspberry PI function as SPI slave? and https://www.raspberrypi.org/forums/viewtopic.php?t=33517 the Pi currently can't operate in SPI slave mode due to a lack of software, which is unfortunate as this is the fastest of the three interfaces (barring USB), with speeds in excess of 10 mbps. (You often find SPI used to drive screens because of its high-bandwidth.)

I2C is in a slightly better state according to https://www.raspberrypi.org/forums/viewtopic.php?t=235740 with some people having some success at using a Pi in slave mode, but it looks a bit unreliable for now. I2C can potentially run at up to 4 mbps or so.

Serial is very simple and is the best equipped to handle file transfers between two computers using standard tools with minimal setup. The theoretical maximum speed is about 1 mbps, which it sounds like you're close to getting, so this may not be worth it. Serial for communications is enabled by disabling the serial console using sudo raspi-config and selecting the serial option in the advance function menu and enabling it with enable_uart=1 in /boot/config.txt. After that and a reboot then the serial port should be available on the TX/RX pins as a standard Linux system device, likely /dev/ttyAMA0. From there, after hooking up the TX pin on one Pi to the RX pin on the other and vice versa (and connecting ground) the serial port speed can be set using stty -F /dev/ttyAMA0 1000000 for 1 mbps. This may also need init_uart_clock=14745600 set in /boot/config.txt. You should now be able to use the kermit utility to transfer files (apt-get install ckermit). Run kermit -s file.jpg on the sender and kermit -r to recieve a file, or setup kermit in server mode. This is just the basics, kermit has a lot of options that may make life nicer, see http://www.columbia.edu/kermit/ckututor.html for more detail. Some more useful information on the Raspberry Pi's serial is available at https://www.raspberrypi.org/documentation/configuration/uart.md.

The final way of transferring files would be over USB, by setting one of the Pis up in USB gadget mode, then directly connecting the USB ports with a standard cable. (On a Pi Zero this can also be done by soldering to the USB test pads on the bottom, PP22 should be D+ and PP23 should be D- (https://zerostem.io/). D+ should be connected to D+ and D- to D-.) Note this is only available with Pi As and Pi Zeros! Do not do this with a Model B. With that out of the way, the USB gadget mode I'd recommend for file transfers would be g_ether, which makes the gadget Pi look like an Ethernet connection to the other Pi. First, add dtoverlay=dwc2 to /boot/config.txt. Second, open cmdline.txt and add modules-load=dwc2,g_ether after rootwait. The host Pi should be able to access the gadget Pi using the raspberrypi.local address. Comprehensive directions for this are at https://gist.github.com/gbaman/975e2db164b3ca2b51ae11e45e8fd40a. After a network link is setup like this, you should be able to use the standard Linux network tools, like scp to copy files, e.g. scp raspberrypi.local:file.jpg . to transfer from the gadget to the host. More details on other USB gadget mode options are available at https://gist.github.com/gbaman/50b6cca61dd1c3f88f41.

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.