Skip to content

Latest commit

 

History

History
84 lines (81 loc) · 3.47 KB

Pressure.md

File metadata and controls

84 lines (81 loc) · 3.47 KB

Raspberry Pi Pressure Sensor to Weewx

  1. You need a $10 on a pressure sensor
  2. Female/Female dupont cables - I had these lying around.
  3. 3d case for your sensor (optional)

Installation

  1. Connect the sensor device to your Pi
  2. Enable I2C on your Pi. Verify connectivity with the sesnor. You should see 76.
 i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- 76 --
  1. Install the python modules - NOTE, there are working versions of those modules in this repo if you run into issues where things aren't working for you. I have a note in my install notes about a smbus.py change in newer versions of PureIO, so use the one from here if you're having issues.
$ sudo apt-get update
$ sudo apt-get install build-essential python-pip python-dev python-smbus git curl
$ cd ~pi
$ git clone https://github.com/adafruit/Adafruit_Python_GPIO.git
$ cd Adafruit_Python_GPIO
$ sudo python setup.py install
$ cd ..
$ git clone https://github.com/bdwilson/Adafruit_Python_BME280
$ cd Adafruit_Python_BME280
  1. Verify connectivity to your device again to make sure we can read data:
$ python ./Adafruit_BME280_Example.py
Temp      = 31.769 deg C
Pressure  = 1004.16 hPa
Humidity  = 30.67 %
  1. Install Weewx user program (note: I found this program on one of the weewx forums; I modified it to fit my needs)
$ cd /usr/share/weewx/user
$ sudo curl -s https://raw.githubusercontent.com/bdwilson/acurite/master/bme280.py -o bme280.py
  1. Edit Weewx config. Under ''[[Services]]'' section, add this:
[Engine]
    [[Services]]
        data_services = user.bme280.bme

Also add a section for your BME device above the ''[Engine]'' section. In the example below, I'm mapping the BME pressure to the Weewx ''pressure' value. I'm not mapping the temperature from the BME device to anything in Weewx. You'll also need to determine your sea level denominator which is based on # of meters above sea level. This adjusts the pressure output from the BME to the pressure at your altitude. In my example, I'm 78.9432 meters above sea level: (1-(6.87535 x (10^-6)) x 78.9432)^5.2561 = 0.99715048109 The other thing to consider is your location where your Adafruit BME280 modules are installed.

[BME280]
    col_pres = pressure
    col_temp = ''
    sl_denominator = 0.99715048109  # https://www.raspberrypi.org/forums/viewtopic.php?t=154262
    BME280_lib_location = '/home/pi/Adafruit_Python_BME280'
  1. Restart Weewx
sudo /etc/init.d/weewx stop
sudo /etc/init.d/weewx start
  1. Check /var/log/syslog for any errors. If you own an Acurite SmartHUB; throw it away.

Bugs/Contact Info

Bug me on Twitter at @brianwilson or email me here.