Dual raspberry pi system communicate via USB Ethernet.
Master Raspberry Pi: any type of Raspberry Pi
Slave Raspberry Pi: mode A only.
- Flash latest Raspbian lite (desktop could be fine, but it is not necessary.). Once Raspbian if flashed, open up the boot partition and add new file ssh to enable the ssh on boot.
2: Set up the wireless. Still in the boot partition, add the file wpa_supplicant.conf and add the following lines and replace SSID and PASSWORD with the ones for your network:
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="SSID"
psk="PASSWORD"
}
3: Boot the system and setup the USBNet.
Follow the this instruction http://blog.gbaman.info/?p=791. In short, here is the steps copied from that instruction.
For this method, alongside your Pi Zero, MicroUSB cable and MicroSD card, only an additional computer is required, which can be running Windows (with Bonjour, iTunes or Quicktime installed), Mac OS or Linux (with Avahi Daemon installed, for example Ubuntu has it built in).
-
Flash Raspbian Jessie full or Raspbian Jessie Lite onto the SD card
-
Once Raspbian is flashed, open up the boot partition (in Windows Explorer, Finder etc) and add to the bottom of the config.txt file dtoverlay=dwc2 on a new line, then save the file.
-
If using a recent release of Jessie (Dec 2016 onwards), then create a new file simply called ssh in the SD card as well. By default SSH is now disabled so this is required to enable it. Remember - Make sure your file doesn't have an extension (like .txt etc)!
-
Finally, open up the cmdline.txt. Be careful with this file, it is very picky with its formatting! Each parameter is seperated by a single space (it does not use newlines). Insert modules-load=dwc2,g_ether after rootwait. To compare, an edited version of the cmdline.txt file at the time of writing, can be found here.
-
That's it, eject the SD card from your computer, put it in your Raspberry Pi Zero and connect it via USB to your computer. It will take up to 90s to boot up (shorter on subsequent boots). It should then appear as a USB Ethernet device. You can SSH into it using raspberrypi.local as the address.
In this step, we are going to set the master pi as USB master and test the connection with the slave pi. Add the following line at the end of the file /etc/network/interfaces
auto lo
iface lo inet loopback
iface eth0 inet manual
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
Reboot the mater pi, connect slave pi to the master pi's USB 0. Login to the master pi, try to ping raspberrypi.local, if it shown the ip address begin with 169, then it means master pi was set up successfully. I haven't figure it out how to share the internet with the slave pi. So, if needed update, upgrade or install any software, you need to connect the slave pi to the PC or Mac with internet share on.