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.