Turn your Raspberry Pi into a wireless monitoring sensor

Wireless is connecting the world

802.11 networks are not just providing connectivity to our laptops and smartphones, but are also allowing us to interact with IoT devices like refrigerators, light bulbs, and cars. When complemented with Internet access, wireless connectivity is, in the end, a utility, a service that is provided to the public and that must be assured. And at NetBeez, we are not the only ones to think so; recently, the United Nations have declared that all people have the right to Internet access in order to enjoy their right to freedom of expression and opinion.

WiFi BEEZ

Like any other service in your house, wireless networks require proper monitoring. If you look at your home environment, you have a thermostat that measures your home’s temperature so you can monitor and adjust your heat. You have water and gas meters that track your consumption levels so you can keep costs under control. It should be the same for your “Internet pipe”. Since most home networks nowadays are based on wireless access, the best way to monitor the end-user experience is with a wireless network sensor.

Wireless Monitoring Sensor

For this reason, in 2015, we launched a WiFi monitoring sensor that, very similarly to the wired one, actively probes the network and accesses the applications as a regular user would. With this technique, we generate a performance baseline that reflects the end user experience. This baseline is used by our dashboard to automatically detect performance degradation issues, enforce service level agreements with an Internet Service Provider, and, when complemented with wireless metrics like signal strength of channel information, troubleshoot RF coverage issues.

wireless tab agent

Intrigued?  If so, keep reading because now it’s time to turn your own Raspberry Pi into a wireless sensor so you can start monitoring the performance of your wireless home network. 🙂

Ready, set, go … here’s the procedure:

Step 1 – Get your dashboard.

First, request a NetBeez dashboard. Then, follow the instructions that you’ll receive with the welcome email to load the NetBeez agent image on your Raspberry Pi’s SD card.

Step 2 – Set up your wireless card.

If you are using a new Raspberry Pi 3, then the WiFi interface should appear when you run ifconfig. In this case, you can skip this step and go to Step 3. Just be aware that the built-in wireless card of the Raspberry Pi 3 only supports the 2.4GHz band, so if your network is dual-band, you won’t be able to monitor the 5.0GHz spectrum.

If you have a first or second generation Raspberry PI, then you will need to procure a wireless dongle that is supported by the Raspberry Pi and install the proper drivers.

To do this, first plug the WiFi dongle into the Raspberry Pi. If you run the ifconfig command you won’t see the wlan0 interface unless you are using the ASUS N53. In this case skip the driver installation Step 2.1.

Step 2.1 – Install the wireless drivers.

This sub step is not needed if you are using the built-in wireless card of the Raspberry Pi 3 or if you are using the ASUS N53 wireless dongle.

Run the following commands to download the driver installation software:

wget http://www.fars-robotics.net/install-wifi
sudo chmod +x install-wifi

After you have downloaded the script, run the command to install the required driver for the kernel version you are running:

/home/pi/install-wifi.sh

Note that you have to use the absolute path when executing the install-wifi script.
If you are having problems with the script, review the help information by running the command with the --help option:

/home/pi/install-wifi.sh --help

If the script cannot find a driver for your dongle, run the installation script with the -c option to double check if there is a driver available:

/home/pi/install-wifi.sh -c

Once you complete those steps, run ifconfig to see the wlan0 interface.

Step 3 – Install the WPA supplicant client.

Now you need to configure wpa_supplicant. If you have are using WPA2 with a pre-shared key, the content of /etc/wpa_supplicant/wpa_supplicant.conf should look like this (please remember that if you have used a Raspberry Pi image from NetBeez, by default the / and /boot partitions are mounted as read-only and you have to use the command mount -o remount,rw /):

$ cat /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant
    update_config=1
    network={

         ssid="[put your ssid here]"
         scan_ssid=1
         key_mgmt=WPA-PSK
         psk="[put your password here]"

}

If you have an alternate configuration, please check out this article we wrote about configuring your wireless client to use wpa supplicant.

After that, bounce your wireless interface so it can take the new settings. Run the following command:

ifdown wlan0; ifup wlan0

If everything went fine, the Raspberry Pi will connect to the wireless and obtain an IP address from your router. If it doesn’t, then reboot it and log back in. Verify that the wlan0 has received an IP address.

Step 4 – Turn the wired agent into a wireless one.

(PLEASE NOTE: As of release 1.1 (2/2017) this step is no longer required) 

To do this, you have to edit the /etc/netbeez/netbeez-agent.conf file and change the interfaces parameter from using the eth0 interface:

{"host":"hostname.netbeezcloud.net", "secure_port":"20018", "interfaces":"eth0", "model":"rpi-model-b"}

to using the wlan0 one (leave the other options unchanged):

{"host":"hostname.netbeezcloud.net", "secure_port":"20018", "interfaces":"wlan0", "model":"rpi-model-b"}

Now reboot the agent from the command line and disconnect the ethernet interface*. After having rebooted the agent, delete the old wired agent from the dashboard following this procedure (the free tier allows only one agent). You should then see the wireless agent appear on the dashboard.

*Keep in mind that when you ask the agent to connect through wlan0 to the NetBeez dashboard, you have to disconnect the wired interface. If you have both interfaces enabled, the agent won’t be able to connect.

Closing remarks

I hope this procedure was clear enough for you to set up everything on your own. If you need help or assistance, you can chat with us by using the integrated chat that is available on the bottom right of your dashboard. 

Happy wireless monitoring!

decoration image

Get your free trial now

Monitor your network from the user perspective

You can share

Twitter Linkedin Facebook

Let's keep in touch

decoration image