5GHz WiFi on Raspberry Pi 4

In my post about quickly setting up a headless Raspberry I had a simple wpa_supplicant.conf file example. This week I got a Raspberry Pi 4, which according to the documentation supports 5GHz networks and 802.11ac.

I’d been running the command sudo iwlist wlan0 scan | grep ESSID and only seeing 2.4GHz networks.

It occurred to me that I’d seen some people in other countries putting the country detail in their wpa_supplicant.conf file, so I decided to see if it made a difference. Sure enough, after adding the line country=US to my file I was able to see 5GHz networks as well as 2.4GHz networks.

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US

network={
       ssid="MyNetworkSSID"
       psk="MyNetworkPassword"
}
After a bit of reading on the https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md page, I noticed a section that made this point with the Pi 3B+, but because I’d not used a 3B+, I didn’t realize it supported 5GHz networking as well.
On the Raspberry Pi 3 Model B+, you will also need to set the country code, so that the 5G networking can choose the correct frequency bands. You can either use the raspi-config application and select the localisation option, or edit the wpa_supplicant.conf file and add the following. (Note you need to replace ‘GB’ with the ISO code of your country. See Wikipedia for a list of country codes.)
Advertisements

Headless Raspberry Pi Setup

I’ve been using a raspberry pi as a ADSB data feeder for FlightAware and FlightRadar24 for a while and the micro sd card developed a bad sector. That meant I needed to rebuild the installation. I really didn’t want to deal with connecting a keyboard, monitor, and mouse to the Pi for the installation. I found https://core-electronics.com.au/tutorials/raspberry-pi-zerow-headless-wifi-setup.html giving me useful information on how to avoid all that. I’m documenting my steps here for my own memory.

Step 1. Download the most recent version of Raspian Buster Lite from https://www.raspberrypi.org/downloads/raspbian/

Step 2. Download balenaEtcher portable from https://www.balena.io/etcher/

Step 3. Use Etcher to overwrite an SD card with the Raspian image I downloaded earlier.

2019-09-09 (28)2019-09-09 (29)2019-09-09 (30)2019-09-09 (31)2019-09-09 (33)2019-09-09 (34)

Step 4. Eject the flash card and close Etcher, then insert the flash card again, rejecting the option to format the drive.  The flash card is now formatted with multiple partitions, only the first is easily read in windows.

Step 5. create two files on the sd card boot partition. ssh and wpa_supplicant.conf. ssh is an empty file. wpa_supplicant.conf should have the following contents, customized for your WiFi Network:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
       ssid="MyNetworkSSID"
       psk="MyNetworkPassword"
}

Step 6. Eject your micro sd card, put it in the Raspberry Pi and power on the raspberry. You’ll need to wait a couple of minutes for the raspberry to finish several steps before you can connect to it over the network. The Raspberry Pi is expanding the native filesystem to fill the available space on the flash card, then rebooting another time with the new filesystem. You’ll need to figure out what IP address the Raspberry retrieved on your network. If you have access to your router, you may be able to see the attached devices and find the new Raspberry that way. I like the NirSoft Wireless Network Watcher to find what’s on my network https://www.nirsoft.net/utils/wireless_network_watcher.html.

Step 7. Connect to the Raspberry Pi with ssh. You’ll be using the default user and password to connect: “pi” and “raspberry”. I used the new Microsoft Windows Terminal in Windows 10 for this example. https://www.microsoft.com/en-us/p/windows-terminal-preview/9n0dx20hk701#activetab=pivot:overviewtab

2019-09-09 (35)

The Raspberry is up and running now. There are several steps I recommend to do immediately. Use sudo raspi-config to set the user password, the machine hostname, and the timezone you want the machine to use.

2019-09-09 (36)2019-09-09 (37)2019-09-09 (38)2019-09-09 (39)2019-09-09 (40)2019-09-09 (41)2019-09-09 (42)2019-09-09 (49)2019-09-09 (50)2019-09-09 (51)2019-09-09 (52)2019-09-09 (53)2019-09-09 (44)

After waiting for the raspberry to reboot and reconnecting via ssh, updating the software to the latest version is the next step.

sudo apt-get update -y
sudo apt-get upgrade -y
sudo shutdown -r now

2019-09-09 (47)

Then I install several tools that I like to have.

sudo apt-get install lighttpd mc mrtg lrzsz nmap dnsutils etherwake snmpd snmp arp-scan shairport-sync -y

My next steps are to get PiAware and FlightRadar up and running.