I would like to hook up my new Raspberry Pi A+ to an older B model without having to connect the A+ to WiFi. Can I connect them somehow via USB? Can I do it with a hub in between?

  • And anyway, you can't connect any two systems with a direct USB cable. USB just doesn't work that way. It's host-to-device, not host-to-host. – Massimo Nov 25 '14 at 14:50
  • @Massimo Unless you are using USB3, specifications allow it, though no-one bothered yet to implement it. – Gizmo Nov 25 '14 at 14:51
  • Yes, but you need to use a special cable. As implied there, they're probably all propriety; the usbnet driver on linux apparently supports a limited set of them, so before you buy a cable, check around to see if it will work. Presumably you could do it through a hub on one side. You can't simply do it with a normal cable, or two normal cables through a hub; as per the wikipedia bit that can potentially cause damage and will never work. There must be additional hardware in the middle. – goldilocks Nov 25 '14 at 15:28
  • Why do you want to connect them ? What data do you want to transfer ? A simple serial connection using two GPIO pins on each (and two cables + 1 for GND maybe) could be sufficient if you want to transfer data at low speed. – tchap Nov 25 '14 at 15:36
  • We've got five answers now that adress mostly the same issues. But to get the most of it, it would be more than helpful to give additional details of what you are trying to achieve here. So please be more specific about the purpose of that connection. – Ghanima Nov 25 '14 at 23:10

You can't use USB to connect to computers to each other. Use a crossover ethernet cable! Make sure to configure the IPs.

edit: a+ doesn't have ethernet cable. Consider using USB ethernet adapter.

| improve this answer | |
  • The A+ as the A does not have Ethernet,.. – Lars Pötter Nov 25 '14 at 21:05
  • @LarsPötter you can always use an USB ethernet adapter. – thekiwi5000 Nov 25 '14 at 21:07

Connect them via UART! You will have them talking in no time.

Here is a link to get you started:http://www.raspberry-projects.com/pi/programming-in-c/uart-serial-port/using-the-uart

just connect tx to the other rx and rx to the other tx.

| improve this answer | |
  • I'll definitely try this option, even if i'm not a question asker.... – vodolaz095 Jul 28 '15 at 16:47

Yes! The Pi A, A+ and Zero are special, they each support USB OTG and can connect directly to other computers via USB.

These models alone are special and this feature does not exist on any Pi that has more than one USB data connector like the B, B+ 2B, 3B and likely not any bigger Pi in the future.

The basic steps are in this gist https://gist.github.com/gbaman/50b6cca61dd1c3f88f41

Note that the command including BRANCH=next should not be used, it no longer works and isn't even available anymore, you just update your Pi the usual way and you'll get the updates needed.

| improve this answer | |

I wanted to expand upon Chisight's helpful answer.

I lack a keyboard/monitor that can connect to a Pi, so I followed gbaman's "quick route" instructions linked from the first Gist.

I connected a Pi Zero to a Pi 3 B+ in this way. I could use ping and ssh to access the link-local name raspberrypi.local with no problem, I think this is thanks to avahi-daemon. I also verified this using the command getent hosts -s mdns4_minimal raspberrypi.local which I had learned about from this serverfault question. However, when the Pi Zero was connected to my Arch Linux machine I did not have a working raspberrypi.local and so had to discover the IP of the connected device using arp-scan as described here.

Being able to ssh into the Zero was great, but not the end of the road. At this point the Zero did not have network access, and in fact its presence as a USB network device caused the Pi 3 to lose outgoing wireless access. (This was due to a usb0 link-local entry which appeared in the Pi 3 routing table with higher priority than the wireless gateway) To give access to the Pi Zero, I configured a static IP for both ends of the USB device, and set up NAT on the Pi 3 to forward connections from the Zero. This was according to instructions from BurtyB on Freenode's #raspberrypi:

## Pi Zero add to /etc/dhcpcd.conf

profile fb_usb0
static ip_address=
static routers=
static domain_name_servers=

interface usb0
fallback fb_usb0

## Pi 3 add to /etc/dhcpcd.conf

profile fb_usb0
static ip_address=

interface usb0
fallback fb_usb0

## Pi 3 setup NAT

sudo sh -c "echo 'net.ipv4.ip_forward=1' >> /etc/sysctl.conf"
sudo sysctl -p /etc/sysctl.conf

sudo iptables -t nat -A POSTROUTING -s ! -o usb0 -j MASQUERADE
sudo iptables -A FORWARD -i usb0 ! -o usb0 -j ACCEPT
sudo iptables -A FORWARD -o usb0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
sudo sh -c "iptables-save > /etc/iptables/rules.v4"

# ^ first you need to
# apt-get install iptables-persistent

These instructions could be easily adapted to give the Pi Zero network access via a laptop or other computer. Once I followed them, I was able to run apt-get on the Zero and finish configuring it to my liking. Before BurtyB told me to use NAT, I had gotten sidetracked trying to set up a bridge with brctl, which doesn't work between ethernet and wireless devices - so don't do that...

(Strangely, after I did these things I no longer had an issue with the routing table on the Pi 3. It had been suggested earlier that I configure metric values in /etc/dhcpcd.conf to fix the routing priority table issue but the problem persisted, which was a mystery. This is from the Pi 3

$ ip route
default dev usb0 scope link
default via dev wlan0 src metric 200 dev usb0 proto kernel scope link src metric 300 dev wlan0 proto kernel scope link src metric 200

whose dhcpcd.conf still has the metric values:

interface wlan0
metric 200

# from BurtyB at #raspberrypi
profile fb_usb0
static ip_address=

interface usb0
fallback fb_usb0
metric 300


| improve this answer | |

There are two options:

1.) A special USB Cable with USB-A Plugs on each end. They have a chip inside that tels both sides that this would be an USB Stick or something. So you will need a special software and that software for ARM to use it. So this is the hard way.

2.) Just use a Ethernet Cable and two USB-Ethernet Adapters. This will be supported by the Kernel and you now have a LAN connection between the two. Only issue is that at least one of the USB-Ethernet Adapters has to support Auto-MDI. If they both do not support it then you need a Cross-Over Cable. A cross over Cable is a special LAN cable that has a special pin layout so that two host can be connected with each other. In the normal case you connect a host to a switch. The Auto-MDI feature automatically detects if a normal cable or a cross over cable is needed and can do the cross over part automatically if needed.

| improve this answer | |

As others have pointed out you can't do this via USB (at least without writing your own drivers).

There are 3 simple options (without any additional hardware); serial, SPI or I²C.

You first have to define what you are trying to achieve.

Serial is the time honoured solution; indeed once all UNIX machines did this, before IP was invented. There is a lot of support built into any Linux system to support this.

The other protocols are more suitable to using one device as a slave.

| improve this answer | |

The only thing that comes close is to access one Pi over the Serial Console using a FTDI USB

enter image description here

These are the same used to programme Arduino 3.3v boards. basically it gives you a Console over USB on Pi, and a Serial on the other.

You asked for USB, but you may just connect the two directly RX to TX and TX to RX. The problem with this is that 2 is the max. There are ways to get more but it get more complicated than needed.

| improve this answer | |
  • 1
    You did not connect your USB to UART to the ground pin. This might work as long as your raspberry pi is powered from the same USB host device but will fail if you power the Raspberry Pi from a USB phone charger or such. – kwasmich Nov 27 '18 at 15:44

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.