-
Notifications
You must be signed in to change notification settings - Fork 8
Connect to Pi
SSH is often used to remotely access embedded computers. SSH is built-in to MacOS, Linux and Windows 10 from the factory.
From your laptop with the SD card having the Pi operating system in your laptop, manipulate files on the SD card as follows.
If on Windows, don't use Notepad or Wordpad or similar for this as they mess up the Unix-style \n text file line endings. On Windows, use Atom or Notepad++ or similar with Unix line endings--you'll need this in general for coding.
-
Enable SSH server on the Pi by putting an empty file named
sshinto SD card/bootpartition. This file is erased by the Pi after the first bootup, and isn't necessary after that. - edit /boot/config.txt, adding a line
dtoverlay=dwc2- edit /boot/cmdline.txt, inserting inline after
rootwait:
modules-load=dwc2,g_ether
Connect to the Pi using SSH over micro-USB cable to the "USB" port on the Pi Zero W.
default password is raspberry
Some micro-USB cables are "charge-only", they don't make a data connection (or have worn-out data pins). There isn't an easy way to tell this besides swapping with a known good micro-USB data cable.
If the Pi isn't fully booting, SSH won't work. You can check that it's fully booting to the login prompt with an HDMI monitor in the lab.
If the Pi isn't showing up as an Ethernet gadget on your laptop, SSH won't work. Check that you see the Pi available as a network device via ifconfig or ipconfig (compare with / without Pi plugged into your laptop)
If your Pi is internet connected, consider changing the default password. The BU networks are constantly scanned by malware. Most computers are scanned hundreds or thousands of times a day for vulnerabilities. Numerous previous teams have had Raspberry Pi's (and other SSH servers with default passwords) hacked shortly after setup since they didn't change the default password.
After plugging in the Pi and waiting 30-60 seconds, type
lsusbThe Pi will show up as:
ID 0525:a4a2 Netchip Technology, In. Linux-USB Ethernet/RNDIS Gadget
Typing ifconfig should show a new connection with an IP address in the 169.xxx.xxx.xxx range.
If using MacOS, MacOS Sierra (10.12) or newer is strongly recommended in general to have the latest development tools.
Look in Network settings for a RNDIS/Ethernet Gadget. If that's not visible, SSH won't work.
If using Windows, Windows 10 is strongly recommended as SSH and Windows Subsystem for Linux are built in from the factory.
Upon plugging in the Pi, within about 10 seconds you'll get a popup about RNDIS device being added. Within about 30-60 seconds you'll see in Windows Device Manager → Network adapters → USB Ethernet/RNDIS Gadget.
If you don't see this device, check that /boot/config.txt and /boot/cmdline.txt are as specified above.
SSH will not work if the Pi isn't seen in Device Manager.
Check ipconfig, that you see an "Ethernet Adapter" with "Autoconfiguration IPv4 Address" in the 169.xxx.xxx.xxx range that appears only when the Pi is connected.
https://learn.adafruit.com/turning-your-raspberry-pi-zero-into-a-usb-gadget/ethernet-gadget