You can find 100s of guides on how to connect a Raspberry Pi to a network online, even I wrote about connecting it in 4 steps, setting a static IP, or enabling SSH via USB. However unless your board has Ethernet, and you can plug it somewhere, getting your Raspberry Pi online will require a keyboard, screen or working SSH connection. With this tip, you can configure any Raspberry Pi WiFi without a keyboard or cables in seconds.
Raspberry Pi Zero, Raspberry Pi 3A+ WiFi without cables
I came across this tip recently, and I thought I’d share it with you especially that it is very relevant to the release of Raspberry Pi A+, but it is super handy for Raspberry Pi Zero boards and when you can’t find the Ethernet cable.
A new feature has been added since Raspbian “Stretch” release. A WiFi config file can be loaded directly from the SD card.
Access the /boot partition on your SD card. Create the following files in the root directory:
- ssh (empty file) to enable SSH interface
remember the file will disappear after 1st boot and you will have to do it again. To make the SSH permanent use sudo raspi-config to enable interfacing - wpa_supplicant.conf (make sure it’s not saved as .txt) to enter WiFi credentials
you will need to fill the file in with your WiFi information
wpa_supplicant.conf
The fille should be filled with your WiFi credentials. Feel free to use the template below:
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 country=<ISO Country Code> network={ ssid="SSID" psk="PASSWORD" }
You can find your ISO Country code here, just use 2 letters, drop the <> characters. If you want you can specify a list of networks that Raspberry Pi will try to connect to.
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 country=<ISO Country Code> network={ ssid="SSID" psk="PASSWORD" id_str="Work" } network={ ssid="SSID" psk="PASSWORD" id_str="Home" }
If more than one network is present, you can specify the priority of the connections too!
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 country=<ISO Country Code> network={ ssid="SSID" psk="PASSWORD" priority=1 id_str="Network1" } network={ ssid="SSID" psk="PASSWORD" priority=2 id_str="Network2" }
Save the file and then reboot the Rasberry Pi. After a couple of moments, you should be able to see a new device joining the network. I use Fingbox and Fing app to monitor my network.
Once the device is online, use Putty to connect to the board via SSH and run
sudo raspi-config
to change the password, enable SSH permanently and modify the hostname if needed.
Using Raspberry Pi imager
You can also configure the WiFi credentials before you burn the image to the card thanks to new options in Raspberry Pi Imager. The option is hidden, so select your image type and storage location, then hit Ctrl+Shift+X to access the advanced menu.
From there you can set up your WiFi credentials, hostnames and burn this to the SD card. Don’t forget to enable SSH as well, which will save you some work and enable remote access to your Raspberry Pi board. It’s a convenient way of setting it all up as long as you are happy with the selection of the OS’ available on the list.
Final thoughts
It’s a quick and easy way of setting Raspberry Pi Zero, Raspberry Pi 3A+ or Raspberry Pi 4 WiFi without a keyboard or Ethernet. Frankly speaking, I will be using this method from now on, as it saves some time. I will create the zip file which I simply have to unpack to the /boot directory containing ssh & wpa_supplicant.conf files. This way, getting the Raspberry Pi online will only take seconds.
Project Download
Download project files here. Bear in mind that Patreon supporters have early access to project files and videos.