Reading the Meteostick from the Linux terminal

Recently I obtained several Davis Vantage Pro 2 components. Since I'm not interested in using the Davis console, but want to write sensor readings directly to a database, I looked into the Meteostick. Even though the Meteostick costs around 160 euros, it is still a relatively cheap way to access the readings from Davis sensors. 

There is the option to combine the Meteostick with a Meteobridge, but I preferred avoiding the additional cost. My setup is a Raspberry Pi 4 with the Meteostick connected directly to one of the USB ports.

How do you read the data the Meteostick produces?  There are different ways to interface. I tried several options and ended up using screen. You may need to install it. Assuming Raspbian (or any other Debian variation):

sudo apt-get install screen

To use screen, two parameters are required: the device path of the Meteostick and the bit or baud rate. The latter is described in the Meteostick manual. The value is 115200. The device path can be determined using the 'dmesg' command, which will return a message log describing the detection of the Meteostick when it was plugged in. It will be something like this:

 ftdi_sio 1-1.4:1.0: FTDI USB Serial Device converter detected
 usb 1-1.4: Detected FT232RL
 usb 1-1.4: FTDI USB Serial Device converter now attached to ttyUSB0

The last message contains the value 'ttyUSB0'. This is the device path we need. The value may differ, depending on other USB devices connected. The full device path will be '/dev/ttyUSB0'.

Run screen with the device path and bit rate values:

screen /dev/ttyUSB0 115200

Superuser permissions may be required due to permission settings. Alternatively, you can also add your current user to the group 'dialout', which is the owner of the device path file. Assuming the user running screen is 'pi', run the following command to allow access without sudo rights:

sudo usermod -aG dialout pi


 After starting screen, assuming you have a Davis transmitter unit actually sending data, you should start seeing values show up in the log. You may need to run the 'm' command to specifcy the bandwidth. For me the command is 'm1', in order to receive the 868 Mhz band. Upon submitting the command, you should see a response confirming reception.

All the commands are described in the Meteostick manual. One other command I will mention here. The 'o2' command will print the sensor data in human readable form. This is useful to confirm you are actually receiving sensible data. 

One last remark about screen. To end the screen session, press Ctrl+a, then a capital K. You will then be prompted to end the session.

In order to actually write the data to a database, I've written some code in Java, which I will share in a different post.