Posts tagged: pi

Raspberry Pi WiFi via USB

I’ve been playing with my Raspberry Pi again. Actually, I ordered a Pi Zero and a Pi 3 as well.

I really didn’t need the Pi Zero. It was a bit of a Black Friday impulse purchase. Ordered it from Pimoroni in the UK and took just about a month to arrive. On a related note, Amazon Canada had better Pi 3 deals during Black Friday than they did for Boxing Day (I’m looking at you, Canakit).

I’m still waiting on the Zero4U (USB board) I ordered for the Pi Zero and I don’t have any microUSB adapters so the Zero is sitting unused in its antistatic bag. By coincidence, both the Pi Zero I ordered from the UK and the USB WiFi dongles I ordered from China arrived on the same day.

All that aside, both my 1st gen Pi Model B and the Pi Zero need WiFi capabilities. I barely use my Model B because it’s a nuisance to plug it in where my router is.

Here’s how I got wifi working on my Pi. Credit goes to the two articles I found here and here, because the first article mostly worked, and the second article had the command to actually connect to my access point.

From the pi command line:


It’ll give you a number. 0 in my case.


Locate the access point you want to connect to.

set_network 0 ssid "your-access-point"
set_network 0 psk "the-passphrase-goes-here"

The first article tells me the Pi should connect to the network now. Mine didn’t. So the second article says to

select_network 0

Provided your settings are correct it should connect. Now to figure out how to connect every time the Pi is rebooted.

Getting it to connect on startup

Turns out wpa_cli wasn’t enough. Or if it is sufficient, I’m missing steps to add the required values. According to this other article you need to edit the wpa_supplicant config.

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

I then added the lines that were missing from mine and actually deleted one (disabled=1).

EDIT: In the case of my Pi Zero I actually had to type out the entire block below.


I then added a required line to the network interfaces file.

sudo nano /etc/network/interfaces

Which required the following line added somewhere near the top (I put it just below auto lo).

auto wlan0

The Pi now connects to my network after a reboot.

Staypressed theme by Themocracy