The Raspberry Pi is a tiny and affordable computer that you can use for fun practical projects. This guide will show how to read sensor data from the Airthings Wave using a Raspberry Pi 3 Model B over Bluetooth Low Energy (BLE). The available sensor data are temperature, humidity, running average 24-hour radon concentration and running long-term average radon concentration.
Airthings Wave is a smart radon detector with quick and accurate results on your smartphone. Additionally, you can simply wave in front of the detector to get a visual indication of your radon levels.
The first step is to setup the Raspberry Pi with Raspbian. An installation guide for Raspbian can be found on the Raspberry Pi website. In short: download the Raspbian image and write it to a micro SD card.
To continue, you need access to the Raspberry Pi using either a monitor and keyboard, or by connecting through WiFi or ethernet from another computer. The latter option does not require an external screen or keyboard and is called “headless” setup. To access a headless setup, you must first activate SSH on the Pi. This can be done by creating a file named ssh in the boot partition of the SD card. Connect to the Pi using SSH from a command line interface (terminal):
$ ssh email@example.com
The default password for the “pi” user is “raspberry”.
The next step is to install the bluepy Python library for talking to the BLE stack. For the current released version for Python 2.7:
pi@raspberrypi:~$ sudo apt-get install python-pip libglib2.0-dev
pi@raspberrypi:~$ sudo pip install bluepy
Further installation documentation can found at https://github.com/IanHarvey/bluepy
To read the sensor data from the Airthings Wave, you need the BLE address of the device. If your device is paired and connected to a phone, you may need to turn off bluetooth on your phone while using these scripts.
Next, make sure the BLE interface is turned on:
[bluetooth]# power on
To verify this, look for “Powered: yes” after issuing the following command:
Exit the bluetoothctl with
Download the two Python scripts by doing the following:
Run the Python script “find_wave.py” to find the BLE address of your device:
pi@raspberrypi:~ $ sudo python find_wave.py
The output will display all Airthings devices within range. The BLE address is on the form “xx:xx:xx:xx:xx:xx” and the serial number (SN) should match the SN number on the backside of your Wave. Exit the script using “Ctrl + c”. If you have many devices, you may run the command with a filter to find your BLE address:
pi@raspberrypi:~ $ sudo python find_wave.py | grep [SN]
where you replace [SN] with the serial number on the backside of your Wave.
Now you are ready to read the sensor data from the Wave. Run the attached script:
pi@raspberrypi:~ $ python read_wave.py xx:xx:xx:xx:xx:xx
where xx:xx:xx:xx:xx:xx is the BLE address you found using “find_wave.py”. The sensor data should now be printed. Exit the script using “Ctrl + c”.
The “find_wave.py” is using advertising data from the Wave to find its BLE address. Only one unit can be connected to the Wave at a time. This means that these scripts only can read the Wave data while your phone is not connected to the Wave, and vice versa.
The radon measurements are given in Bq/m3 and the maximum value that can be read by the script is 16383 Bq/m3. Note that the first radon measurements are only available one hour after the batteries have been inserted. The radon long term measurements are averaged from the batteries are inserted up to one year.
This guide has been tested with Raspberry Pi 3 Model B, Raspbian Stretch (November 2017), bluepy 1.1.4 and Python 2.7.13.
Let us know how it went on our facebook page! And what you want to see next.