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

Raspberry PiZeroW Camera Module

20190913_140539

When you’ve gotten used to Amazon Prime and free shipping, purchasing inexpensive items from other online retailers where the shipping doubles the cost of the item makes it harder to impulse buy items. An item for $5 that costs $7 in shipping often doesn’t get bought. Even a pair of items that cost $16 together that then cost $7 in shipping cause me to delay the purchase.

20190913_143154

Because I was purchasing a Raspberry Pi 4 and Raspberry Pi USB-C Power Supply from Sparkfun, I decided to throw in another Pi ZeroW and case for another $16. I then added the Raspberry Pi Camera module because the case has an optional cover enclosing the camera and I wanted to see how it all worked together. I only wish I’d realized that there was a Noir version, because I’ve always wanted to play with infrared photography.

Having recently streamlined the installation of a Pi Zero, I installed the camera and Pi ZeroW in the case, put the configured micro sd card in place, plugged it into my HDMI monitor just to watch it boot and applied power. I never saw anything on the monitor. The Pi ZeroW only has a single LED, which is generally on, but blinks for micro sd activity. Because I’d closed the case, the LED wasn’t visible, and with no monitor activity I was wondering if I’d gotten a bad board.

20190913_143130

I opened the case and powered it on again, this time I knew I was seeing LED activity. I did a quick search of my network for new devices and found the new board was responding on ssh and appeared to be working correctly other than no HDMI output.  I was even able to take a snapshot with the camera using the command:

raspistill -o image.jpg

I decided to test booting the device without the camera installed. That worked fine, and I had HDMI output during the boot process. Now I started to wonder if perhaps the power supply I was using didn’t provide enough power. Perhaps the camera and the HDMI device were mutually exclusive in the amount of power required

A lot of searching on the web resulted in nothing about the power required for the camera affecting the HDMI output. I found that I might be able to reduce the power requirements by 25mA by turning off the HDMI, but that the Pi ZeroW was already the lowest power draw available. https://www.jeffgeerling.com/blogs/jeff-geerling/raspberry-pi-zero-conserve-energy

I found the tvservice command and the -s option with the camera installed was resulting in a different result from without the camera installed.

pi@WimPiZeroCamera:~ $ sudo /usr/bin/tvservice -s
state 0x40000 [NTSC 4:3], 720x480 @ 60.00Hz, interlaced
pi@WimPiZeroW:~ $ sudo /usr/bin/tvservice -s
state 0xa [HDMI CEA (16) RGB lim 16:9], 1920x1080 @ 60.00Hz, progressive

At least recognizing that difference was progress. For some reason under Raspian Buster the camera module is causing the HDMI output to be different. I found options in https://www.raspberrypi.org/documentation/configuration/config-txt/video.md that allow me to force the HDMI output to what I want. I changed /boot/config.txt with the following and now I’ve got both camera and video working properly.

# uncomment to force a specific HDMI mode (this will force [HDMI CEA (16) RGB lim 16:9], 1920x1080 @ 60.00Hz, progressive)
hdmi_group=1
hdmi_mode=16

I hope that this helps someone else having problems with both camera and hdmi video output. I don’t know if this was specific to Buster since I never tried it under Jessie or Stretch.

USPS Informed Delivery Daily Digest and Netflix DVDs

I use the USPS service Informed Delivery and highly recommend it. I get a daily email from USPS with a scanned picture of most of the mail that will arrive in my mailbox that day. Occasionally the email will say that there were items that could not be scanned, but it’s very useful since I don’t check my mailbox on a daily basis, but don’t want to have important items sit for extended times.

My mailbox is fairly secure, but I’ve also read that Informed Delivery has both good and bad features for people related to mail theft or identity theft.

I’ve been getting Netflix DVDs in the mail since 2000.  I’ve always been slightly fascinated with the efficiencies the post office and Netflix have worked out. If I take a DVD mailer to my local post office here in Seattle, Netflix recognizes it has been returned the next business day. If I drop a DVD at the local post office on Tuesday, Netflix acknowledges it on Wednesday, and I’ve usually got the next DVD delivered Thursday.

Until recently the Netflix DVDs were scanned like all other mail.

2019-09-13 (3)

It appears to have changed at the beginning of September. Now there’s a pair of fixed images arriving with a link that will take you directly to Netflix.

2019-09-13 (2)

The new behavior isn’t bad since all the Netflix disk scans look very similar, but are interesting to note. I wouldn’t be surprised that the new full color image reduces bandwidth over individual scans along with added benefit of the link to Netflix.

My new favorite WiFi Analysis Program

I recently came across WinFi Lite, and while it claims to be in beta and for professionals only, it’s currently my favorite WiFi analysis program.  The fact that it was in the Microsoft store gives me the idea that it will uninstall cleanly if I decide to get rid of it later.

2019-09-10

The default view shows details about both 2.4 and 5 GHz networks nearby. The first picture was what it looked like when I ran it in my local Starbucks on my Microsoft Surface 4 Pro.  The next picture was what it looked like when I ran it in my apartment. In my apartment I was connected to my network via wired ethernet, so the Surface WiFi adapter wasn’t being used for my active connection. At Starbucks, I was connected to the WiFi.

2019-09-11 (1)

While I was at Starbucks, the number of networks it could see was 188. That number is visible in the top right of the image. Just to the left of that number are a set of buttons that allow you to look at 2.4GHz, 5GHz, or All available networks.

My apartment showed only 161 networks by comparison, but that number was bouncing around as it rescanned in both locations. I was surprised that the Starbucks had so many visible networks. There are a lot of details available in this tool, and it’s current price makes it an interesting tool to work with. I used to like inSSIDer, but the developers choice to dumb down the free version led me to drift away from it.

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.