I have a Google Nexus 7 (2013) tablet running Android 5.1.1. I have installed ConnectBot and use it to connect to various networks via ssh.

I purchased a Raspberry Pi Zero and copied Raspbian Jessie (11/21/2015) to a micro SD card.

I have made a physical connection between the Pi Zero and the Nexus 7. I am using an OTG cable attached to the Nexus 7, into which is plugged a standard USB-to-micro cable attached to the USB connector on the Pi Zero. When I connect the cables the power light on the Pi Zero begins flashing, indicating that the connection is successful and the Nexus 7 is supplying power to the Pi Zero.

I would like to ssh into the Pi Zero from the Nexus 7 using a direct connection. I found these directions, but they don't work because my Nexus 7 does not have the tethering option on the wireless and network settings.

So how can a establish an ssh connection between the Pi Zero and the Nexus 7?


I got hostapd working. The wifi app on my Nexus 7 sees the Pi Zero and makes a connection.

But when I go to ConnectBot and try to ssh to the Pi Zero, I get a "Connection refused" error. Specifically, I ssh to pi@RaspberryPiZero and get back a message "Failed to connect to RaspberryPiZero/ (port 22): connect failed ECONNREFUSED (Connection refused)" from ConnectBot.

How do I ssh from the Nexus 7 to the Pi Zero?


I got it. I was dumb. Instead of ssh to pi@RaspberryPiZero I did pi@, which is the static address of the Pi Zero. All is working now.

  • 1
    It may not be a direct connection but I use WiFi and juice SSH to connect to my Pi from my nexus tablet. Nov 28 '15 at 16:36

There are two problems with your approach.

First, asking the tablet's boost converter to power the pi is a bit much - at the least it will give you short battery life, and there is a real chance of ultimately damaging it.

Next, putting the OTG adapter on the tablet end means the tablet will be the host and the pi the device. It seems that because the zero does not have a USB hub, it should be possible to operate it in a USB device mode, but as of the moment there doesn't seem to be much support for that (it is possible the introduction of the zero will give momentum to such efforts, but pursuing that path would just duplicate the existing model A / zero device mode questions).

If you want to do a direct USB-USB connection, you should probably turn things around, so that the pi is the host and the tablet is the device. Provide external power to the pi. Then use the USB OTG adapter on the pi end of the cable, and the normal USB cable on the Nexus end so that it's ID pin does not get grounded and it remains in device mode.

Once you have a pi-host to tablet-device connection you will have several options for establishing communication, however their details are Android questions which are more appropriate to the Android site than the pi one.

  1. Use USB network tethering, possibly after installing a different build of Android which supports this (your Nexus was designed to be re-flashable)

  2. Operate the tablet in USB Accessory mode, using software on the pi to be the host (rather than the original idea of something like an Arduino with a host shield)

  3. Enable USB debugging on the tablet and use an ADB port forward for tablet-bound network connections. If you want pi-bound connections you can ssh in and enable a tunnel back through which you can forward them.

Another option would be to use a low voltage USB-serial adapter on the tablet and the UART pins on the pi, or else another USB-serial on the pi.

  • I wondered about the power. In fact I had a power supply set up, but I plugged in the USB-to-USB cable first and noticed I already had power. I won't do that again. You mentioned "software on the pi to be the host." Is that hostap? I'll have to figure out how to configure that. Then I just connect the cable and ssh from the Nexus 7.
    – user448810
    Nov 28 '15 at 17:17
  • No, unless you go the USB tethering route it would need to be software implement the Android Accessory protocol, or else leveraging ADB. If you want something that you can do with much software attention at all, the wifi or UART approaches are probably fastest to get going. Nov 28 '15 at 17:22
  • I don't understand. I could set up the Pi Zero with a wifi adapter on an OTG cable and hostapd configured to look for connections, then use the wifi on the Nexus 7 to connect to the Pi Zero, with ConnectBot providing ssh, or VNC if I want to see the gui. Right? Can't I do the same thing with a cable?
    – user448810
    Nov 28 '15 at 17:27
  • No, you can't do the same thing with a cable. USB is not a network connection, unless you have software on both ends which emulates a network connection over it, but if the normal Android tethering is not a choice for you, that may not be available without a lot of investigation and potentially some development on your part. Nov 28 '15 at 17:35
  • Then I will set up with wifi and hostapd. Thanks for your assistance.
    – user448810
    Nov 28 '15 at 18:08

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.