Raspberry pi weather stations

Weather station playing up has to rebuild, but found Weewx 5 has some breaking changes and world has moved on so here goes.

NB Weewx can be installed

10 Feb 2024. Weewx 5.0.2

1) Burn images Raspberry pi Legacy 32 bit lite.023-12-05 for headless operation, then install updates and Nginx.

pi@PiWeewx:~ $ sudo apt update
....
pi@PiWeewx:~ $ sudo apt full-upgrade
...
pi@PiWeewx:~ $ sudo apt remove apache2
...
pi@PiWeewx:~ $ sudo apt install nginx
...
pi@PiWeewx:~ $ sudo systemctl start nginx

### Check webserver is running.

Install Weewx. Instructions here.

# 1st time only allow apt to see weewx
sudo apt install -y wget gnupg
# NB Bug workaround: You may need to use the keys-old.html
wget -qO - https://weewx.com/keys.html | \
    sudo gpg --dearmor --output /etc/apt/trusted.gpg.d/weewx.gpg
 echo "deb [arch=all] https://weewx.com/apt/python3 buster main" | \
    sudo tee /etc/apt/sources.list.d/weewx.list

## Install Weewx 
sudo apt update
sudo apt install weewx

Install SDR extension for Weewx. This is a bit undocumented at present so some experimentation gives:.

pi@PiWeewx:~ $ sudo systemctl stop weewx
pi@PiWeewx:~ $ wget -O weewx-sdr.zip https://github.com/matthewwall/weewx-sdr/archive/master.zip
pi@PiWeewx:~ $ sudo weectl extension install weewx-sdr.zip
...
## Install drivers
pi@PiWeewx:~ $ sudo apt-get install rtl-433
...
## Free up the USB port
sudo rmmod rtl2832_sdr dvb_usb_rtl28xxu rtl2832
...
# Later you will need the Vendor ID and product ID for USB stick
# With USB stick inserted the command is lsusb -v
pi@PiWeewx:$> lsusb -v
Bus 001 Device 002: ID 0bda:2838 Realtek Semiconductor Corp. RTL2838 
DVB-T
...
idVendor 0x0bda Realtek Semiconductor Corp.
idProduct 0x2838 RTL2838 DVB-T
...
pi@PiWeewx:sudo rtl_433
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
time : 2024-02-13 16:48:08 brand : OS
model : Oregon-PCR800 House Code: 9
Channel : 0 Battery : 0 Rain Rate : 0.0 in/h
Total Rain: 6.2 in
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
time : 2024-02-13 16:48:11 brand : OS
model : Oregon-THGR810 House Code: 176
Channel : 1 Battery : 1 Celsius : 17.30 C
Humidity : 60 %
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
time : 2024-02-13 16:48:55 brand : OS
model : Oregon-PCR800 House Code: 9
Channel : 0 Battery : 0 Rain Rate : 0.0 in/h Total Rain: 6.2 in
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
time : 2024-02-13 16:49:04 brand : OS
model : Oregon-THGR810 House Code: 176
Channel : 1 Battery : 1 Celsius : 17.30 C Humidity : 60 %
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
time : 2024-02-13 16:49:42 brand : OS
model : Oregon-PCR800 House Code: 9
Channel : 0 Battery : 0 Rain Rate : 0.0 in/h Total Rain: 6.2 in
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
time : 2024-02-13 16:49:57 brand : OS
model : Oregon-THGR810 House Code: 176
Channel : 1 Battery : 1 Celsius : 17.30 C Humidity : 60 %

Run sdr.py to examine parsed output:

pi@PiWeewx:$ cd /etc/weewx
pi@PiWeewx:$ sudo PYTHONPATH=/usr/share/weewx python bin/user/sdr.py --cmd="rtl_433 -M utc -F json"

# If using USB stick you may need to give the user weewx permission to accesss the USB port

sudo usermod -aG plugdev weewx 

Now the BME280 drivers. First activate the I2C and spi interfaces:

     pi@PiWeewx:~ $sudo raspi-config
     # Select interface options->I2C->Yes
     # Select interface options->SPI->Yes
     # Reboot computer
     sudo reboot.

You may need to install pip, the python package installer before you can install the BME drivers.:

pi@PiWeewx:~ $ sudo apt install python3-pip