You can find 100s of guides 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 Raspberry Pi Zero, Raspberry Pi 3A+ WiFi without 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
Please note that both files will be deleted after the 1st boot, so if something fails, you will have to dump the files again.

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.

Fing - Network Tools
Price: Free

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.

It’s a quick and easy way of setting Raspberry Pi Zero, Raspberry Pi 3A+ WiFi without 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.

Support NotEnoughTech
A lot of time and effort goes into keeping NotEnoughTech alive! If my work helped you out, consider buying me a coffee or check out exclusive rewards available to Patreon supporters.
SHARE