Headless Raspberry Pi, WiFi & SSH


I want to mount the RPi in the robot and SSH into it. I'm halfway through setting it up to automatically boot when the robot is switched on and to safely shutdown when power is removed (via a small UPS that I'll post details of in the future). I've also configured boot and shutdown behaviour via a GPIO and the heartbeat/load indication function of the activity LED - much more useful.
I discovered that when I switched to the Pi's wifi, from wired ethernet, that it would no longer be available to SSH. An IP scan later indicated that the Pi wasn't auto-connecting to the network after boot. If I logged-in locally then it would connect and be available for SSH. Not a lot of use for a mobile robot.

Resolution (that worked for me)

Most advice I found online was on adding the supplicant info:
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
Make sure these lines are valid, obviously replace with your SSID and password: 
But I had to edit the /etc/network/interfaces too. Note that I saw similar info being suggested in various forums but my attempts failed. I think the iface wlan0 inet dhcp line had default in place of wlan0 in a lot of the suggestions. Anyway, with these additional changes this worked for me:
sudo nano /etc/network/interfaces
auto lo
iface lo inet loopback
allow-hotplug eth0
iface eth0 inet manual
auto eth0
allow-hotplug wlan0
iface wlan0 inet dhcp
auto wlan0
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
I rebooted the Pi and it was then visible to an IP scan and I could SSH into it with PuTTY!


Popular Posts