Jan Leow's Press Blog


SSH from PC to Raspberry Pi0 Project

I came across this project to SSH from the computer to the Raspberry Pi Zero using the USB RNDIS ethernet gadget with a self made USB addon board. From the various videos, it looked easy and I decided to give it a go. However I’m still not able to do any wire soldering just yet, and decided to purchase a professionally made Pi0 USB-A addon board by Cytron.io. With all my devices in hand I started to proceed with this SSH project.

Raspberry Pi Zero and USB addon board for SSH ethernet RNDIS gadget

To SSH from my PC to the Raspberry Pi, I prepared the following hardware & software:
a) Raspberry Pi Zero
b) USB-A addon board (optional, as I found out later it wasn’t necessary to have this)
c) USB HUB with microUSB OTG
d) USB LAN or USB WIFI (if just plain old Pi0. Pi0-W or WH has built-in WiFi)
e) Mouse & Keyboard
f) Putty (https://www.putty.org)
g) VNC Viewer (https://www.realvnc.com)

The steps seemed simple enough.

1) Install a fresh Rasbian OS onto a microSD card

2) Edit the config.txt file in the boot partition,
add the following line at the end of the file:

dtoverlay=dwc2

3) Edit the cmdline.txt file and add the following between the rootwait and quiet

modules-load=dwc2,g_ether

4) Some videos & blogs added this SSH file, some didn’t. Since it was just a simple file, I decided to add it whether it was required or not. Create an empty text file without any extension and name it:

SSH

5) Boot up Raspberry Pi0 and run the Raspberry Pi Configuration:

  • enable SSH
  • enable VNC

And shutdown Raspbian

6) Remove all connections from the RPi0, and with the USB addon board, connect to the PC. RPi0 will boot and the PC should detect it and install the required device drivers. If you are lucky, a pop up in Windows 10 will show “setting up USB Ethernet/RNDIS Gadget”. It took me several tries before this pop up appeared.

This was where the trouble started. On many videos and blogs, if you check your PC Device Manager under the Network adapters, a USB Ethernet/RNDIS Gadget would show up. Unfortunately it didn’t work for me, and no matter what I changed, it still won’t detect as that. So that was the end of my attempt for a USB SSH connection.

This was what I tried to fix it:

Reinstall the RNDIS driver. All Windows since XP has this driver, but just in case it wasn’t installed properly, head on to Microsoft and create the inf for RNDIS driver installation.

https://docs.microsoft.com/en-us/windows-hardware/drivers/network/remote-ndis-inf-template

Copy the appropriate Windows version inf code, create a text file with inf extension and paste the inf code. Right click inf and select install. Reboot the PC and insert the RPi0 once more.

If Windows still failed to connect as a USB Ethernet/RNDIS Gadget then that is the end for direct USB SSH connection attempt. You could still try connecting via LAN network though it would be less elegant.

Putty and VNC Viewer

7) Install Putty and VNC Viewer in your Windows PC and start up your RPi normally.

Putty will connect as a terminal to your Raspberry Pi0 and you can key in your linux commands from your Windows PC. While VNC Viewer will mirror your Raspberry Pi0 and you could control all functions of your RPi0.

Make sure your RPi0 is connected via LAN or WiFi to your network or via your USB Ethernet/RNDIS gadget. Then running either software, you will connect by typing raspberrypi.local

Once you are connected, type “pi” as your user ID and “raspberry”, the default password if you haven’t changed it to your own password yet.

Direct microUSB connection to PC for SSH

Trying out this project, I found out that there is no need for the USB-A addon board. You could just as easily connect using a USB-microUSB cable from your PC to the RPi0. However due to my failure to get it to recognize as a USB ethernet RNDIS Gadget, I had to connect via the LAN network, which was still rather interesting. I could remote control my Raspberry Pi as long as it is within the same network infrastructure.

Hope you have better luck with this SSH project!

30-Nov-2020

Leave a Comment

Your email address will not be published. Required fields are marked *

Blue Captcha Image
Refresh

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.