HomeRaspberry PiSetting Raspberry Pi WiFi without keyboard or cables

Setting Raspberry Pi WiFi without keyboard or cables

Connecting Raspberry Pi board to WiFi in seconds

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
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.

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.

PayPal

Nothing says "Thank you" better than keeping my coffee jar topped up!

Patreon

Support me on Patreon and get an early access to tutorial files and videos.

image/svg+xml

Bitcoin (BTC)

Use this QR to keep me caffeinated with BTC: 1FwFqqh71mUTENcRe9q4s9AWFgoc8BA9ZU

M5Paper

Programable, ESP32 based awesome dev platform with 4.7 e-ink display by M5Stack

More HATs

client-image
client-image

Argon One M.2

Enclose Raspberry Pi 4 inside this great case with custom I/O, cooling and GPIO and M.2 SSD support

More cases on

client-image
client-image

Best Raspberry Pi Projects

How to use Raspberry PI as WOL (wake on lan) server

0
While you could wake up your PC from a mobile directly, having a dedicated server capable of doing so is the best solution. The reason is simple. You can hook up as many devices as you wish with a single endpoint. This is why Raspberry Pi is perfect for this.

Slow Internet Warning

0
From time to time my Internet grinds to a stop. Since Raspberry Pi 4 comes with a 1Gbps Ethernet, I decided to take advantage of it and create a reporting system in NodeRED that will monitor and report when the ISP is not keeping the contractual agreements. Works with Alexa, Google Home, Android and Windows 10.

How fast Raspberry Pi NAS is?

0
Let's see how fast Raspberry Pi NAS really is?

Argon18: Argon ONE SSD modification

0
Argon One case just got better - now you can boot it from USB without ruining the design thanks to Argon 18: Argon One SSD modification

HOW TO...

How to boot Raspberry Pi 5 from NVMe M.2 SSD

0
This is how you can boot your Raspberry PI 5 from NVMe in 10 min! Check out these easy instructions

It took me 2 months to boot CM4 from NVMe

0
Complete beginners guide to Compute Module 4 boot from NVMe.

Raspberry Pi Zero 2 W vs other Zero boards

0
It's time to test the Raspberry Pi Zero 2 W against other Raspberry Pi boards from Zero series: power, WiFi, temperature and core performance

C/C++ and MicroPython SDK for Raspberry Pi Pico on Windows

0
A guide to SDK toolchain for Raspberry Pi Pico and C/C++ , Micropython on Windows.

A comprehensive guide to Grafana & InfluxDB

0
How to use Grafana and InfluxDB on Raspberry Pi for IoT sensors in home automation