How to configure Wifi and USB wifi dongles from command-line


We do not recommend using the built-in Raspberry Shake 3 Model B’s wifi, but it is available. Be aware that using the built-in Wifi (as opposed to Ethernet or Wifi from a USB adapter) will introduce high amplitude RF noise into the Raspberry Shake, often seriously compromising the seismic signal by introducing high amplitude low-frequency spikes. This appears to be a result of the proximity of the Wifi antenna to the Raspberry Shake board itself. External/ USB wifi solutions are not as problematic because the wifi antenna is further from the Raspberry Shake board. The Raspberry Pi Zero “W” and Raspberry 3 Model B+ do not appear to suffer from this same problem and can be safely used in native wifi mode.

Easy way

Configure wifi from your Raspberry Shake’s internal web configuration page http://rs.local

Step-by-step guide for advanced users

To configure the wifi from the command-line, start by opening a terminal and opening a connection to your Shake Pi:

$ ssh myshake@rs.local

For SSH instructions, see: How to access your Raspberry Shake’s computer via ssh. If you are a Windows user, you would use PuTTY for this step.

First confirm that the WiFi interface is enabled

$ cat /etc/network/interfaces

And verify that the following lines exist

allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

If they aren’t there, edit the file, add the lines above, and save

$ sudo nano /etc/network/interfaces

Then edit the wpa_supplicant.conf

$ sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Paste the following lines at the end of the file and add your WiFi Connection Details (ssid and psk):

        ssid="SSID of your wifi"
        psk="password of your wifi"

The ” are necessary.

Now reboot your shake:

$ sudo reboot


The Raspberry Pi 3 Model B is limited to 2.4 GHz wifi connections. So “5G” connections, for example, will not work.

Advanced topics

How to encrypt wifi password from command-line

Execute this commmand:

$ wpa_passphrase <your_wifi_ssid_here> <your_wifi_password_here>

For example,

$ wpa_passphrase mywifi mypasswd

This will generate the following:


Copy this output to /etc/wpa_supplicant/wpa_supplicant.conf and remove the #psk line to make it fully encrypted

How to enable both WiFi and Ethernet Interfaces

When your Shake Pi boots, if it detects that an Ethernet interface is active, WiFi will be turned off by default. This is how Ethernet and WiFi network connections work with each other:

  1. If an ethernet cable is plugged in, and the setting in the configuration file is off, WiFi drivers will be automatically turned off at system boot to avoid unnecessary spikes in the signal.
  2. If no ethernet cable is plugged in, and if WiFi is properly configured, a connection will be made to the WiFi network; the setting in the WiFi configuration file is ignored.
  3. If an ethernet cable is plugged in, and the end-user wants a dual network connection over a WiFi network, then WiFi must be properly configured and the setting in the WiFi configuration file must be set to ON (see below).

Per #3, if you wish to enable both WiFi and Ethernet interfaces, changing the configuration file at /opt/settings/user/enable-wifi.conf will allow you to do so. By default this file contains the following lines:

# WiFi enablement configuration file
# should contain a single line not beginning with #
# specifying either ON or OFF


Edit this file

$ sudo nano /opt/settings/user/enable-wifi.conf

Modify the last line from OFF to ON.

Reboot your shake:

$ sudo reboot

How can I set up a USB Wifi Dongle

First you’ll need to verify if your USB was tested on Raspberry Pi computer (RPi):

Then plug your USB Dongle into your RPi and see if the RPi recognizes the device. For example,

$ sudo dmesg -T | grep usb

If your device was succesfully recognized, the OS will answer with something similar to this:

  [Fri Aug  3 13:45:11 2018] usb 1-1.4: new high-speed USB device number 4 using dwc_otg
  [Fri Aug  3 13:45:11 2018] usb 1-1.4: New USB device found, idVendor=0bda, idProduct=8176
  [Fri Aug  3 13:45:11 2018] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
  [Fri Aug  3 13:45:11 2018] usb 1-1.4: Manufacturer: Realtek
  [Fri Aug  3 13:45:11 2018] usb 1-1.4: SerialNumber: 00e04c000001
  [Fri Aug  3 13:45:12 2018] usbcore: registered new interface driver rtl8192cu

Now try this command and see if the RPi mounts the Dongle as wlan

$ iwconfig

   eth0      no wireless extensions.

   docker0   no wireless extensions.

   vethba76434  no wireless extensions.

   wlan0     unassociated  Nickname:"<WIFI@REALTEK>"
             Mode:Auto  Frequency=2.412 GHz  Access Point: Not-Associated
             Retry:off   RTS thr:off   Fragment thr:off
             Power Management:off
             Link Quality:0  Signal level:0  Noise level:0
             Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
            Tx excessive retries:0  Invalid misc:0   Missed beacon:0

  lo        no wireless extensions.

  vetheb6d057  no wireless extensions.

As you can see, the RPi’s OS sees our Dongle as wlan0. But why wlan0 if RpiZw and Rpi3 have their own wifi module inside? This is because, by default, wlan0 is disabled on Raspberry Shake.

The next step will be to adjust your config file to match your wifi parameters and reboot your RPi.

How can I check if my USB Wifi Dongle sees the wifi networks

You can use the following command

$ sudo iwlist wlan0 scanning

The OS will reply

$ wlan0     Scan completed :
            Cell 01 - Address: 00:15:6D:9E:D7:01
            Protocol:IEEE 802.11bg
            Frequency:2.412 GHz (Channel 1)
            Encryption key:on
            Bit Rates:54 Mb/s
            Extra:rsn_ie=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(you will see a numer/character string)
            IE: IEEE 802.11i/WPA2 Version 1
                Group Cipher : TKIP
                Pairwise Ciphers (2) : CCMP TKIP
                Authentication Suites (1) : PSK
             Quality=97/100  Signal level=49/100

The results will be different acording to your wifi network.

How can I configure my USB Wifi Dongle if my Wifi is “hidden”

You will need to specify an extra option in your wpa_supplicant.conf file

$ network={