PiWem (Raspberry Pi Weather Monitor)
Posted: Sun Sep 04, 2016 8:42 am
Well stupid me click on a link in my preview and lost my entire write up, so I have to write it again....
I wanted to start a new project so I decided to make a weather monitor out of a Raspberry Pi. After a little research it didnt look all that hard so I set off and started getting the parts.
I didn't take any pictures yet, but will soon.
Hardware:
I started off with a RespberryPi 3 and the SunFounder 37 Modules Sensor Kit V2.0.
The SunFounder kit has a BMP085 (barometer and temp), DHT11 (humidity and temp), Thermistor, Photoresistor, Analog Temperature Sensor, PCF8591 Analog to Digital Converter, and a small breadboard, and an adapter to go from the GPIO header to the breadboard.
I also went and bought a BMP280 barometer and an AM2302 Humidity and temp sensor
The PCF8591 can address up to 4 devices on the I2C protocal on the address of 0x48. This way I can have the Thermistor, Photoresistor, and ATS all attached and read them through the one device switching the channels (0-3). Really there is no need to have more than one temp sensor, but I did this for development purposes to support as many devices as I physically can at a time. Hopefully I don't need more than 4...
The BMP sensors are I2C. By default they are set to address 0x77 if there is no level set on the SDA pin or it is high (5v). If the SDA pin is Low (ground) the address can be set to 0x76. The problem with the SunFounder BMP085 is they did not breakout the SDA pin, so the address is hard set to 0x77. The BMP280 I got has the SDA pin broken out so that you can ground the pin and set its address to 0x76. This way you can have up to two BMP sensors running on one device at the same time without an I2C multiplexer.
I have not added the AM2302 support yet. I do have the sensor, just need to add the code for it and the table to store the data.
Software:
The code part of the project is hosted on GitHub: https://github.com/pferland/PiWeM
Most if not all of the settings for the daemon can be changed in the settings.ini file.
To create one, just copy the settings.ini.sample to settings.ini and change the settings to your desired ones.
The daemon is written in python at the moment because that is what I know the most at the moment, but I do want to re-write it in C++. On each loop the daemon polls all the enabled sensors and inserts their values into the respective sensor tables with the station hash so that we know what station inserted what values. This is for the front end viewer to get the data.
Initially I was reading that you can use the BMP085 class to read the BMP280. When I tried that, the values were all waaay off . So I set out to find some code that could read the BMP280. I came across this post: https://forums.adafruit.com/viewtopic.php?f=19&t=89049
I took that code and made a class to work with that will setup the BMP280, read the values and return them.
The front end is written in PHP and is very basic and not really all there yet. So far it just has an index page that shows the stations that are logging and their most current values.
Will update with more when it is relevant.
-Phil
I wanted to start a new project so I decided to make a weather monitor out of a Raspberry Pi. After a little research it didnt look all that hard so I set off and started getting the parts.
I didn't take any pictures yet, but will soon.
Hardware:
I started off with a RespberryPi 3 and the SunFounder 37 Modules Sensor Kit V2.0.
The SunFounder kit has a BMP085 (barometer and temp), DHT11 (humidity and temp), Thermistor, Photoresistor, Analog Temperature Sensor, PCF8591 Analog to Digital Converter, and a small breadboard, and an adapter to go from the GPIO header to the breadboard.
I also went and bought a BMP280 barometer and an AM2302 Humidity and temp sensor
The PCF8591 can address up to 4 devices on the I2C protocal on the address of 0x48. This way I can have the Thermistor, Photoresistor, and ATS all attached and read them through the one device switching the channels (0-3). Really there is no need to have more than one temp sensor, but I did this for development purposes to support as many devices as I physically can at a time. Hopefully I don't need more than 4...
The BMP sensors are I2C. By default they are set to address 0x77 if there is no level set on the SDA pin or it is high (5v). If the SDA pin is Low (ground) the address can be set to 0x76. The problem with the SunFounder BMP085 is they did not breakout the SDA pin, so the address is hard set to 0x77. The BMP280 I got has the SDA pin broken out so that you can ground the pin and set its address to 0x76. This way you can have up to two BMP sensors running on one device at the same time without an I2C multiplexer.
I have not added the AM2302 support yet. I do have the sensor, just need to add the code for it and the table to store the data.
Software:
The code part of the project is hosted on GitHub: https://github.com/pferland/PiWeM
Most if not all of the settings for the daemon can be changed in the settings.ini file.
To create one, just copy the settings.ini.sample to settings.ini and change the settings to your desired ones.
The daemon is written in python at the moment because that is what I know the most at the moment, but I do want to re-write it in C++. On each loop the daemon polls all the enabled sensors and inserts their values into the respective sensor tables with the station hash so that we know what station inserted what values. This is for the front end viewer to get the data.
Initially I was reading that you can use the BMP085 class to read the BMP280. When I tried that, the values were all waaay off . So I set out to find some code that could read the BMP280. I came across this post: https://forums.adafruit.com/viewtopic.php?f=19&t=89049
I took that code and made a class to work with that will setup the BMP280, read the values and return them.
The front end is written in PHP and is very basic and not really all there yet. So far it just has an index page that shows the stations that are logging and their most current values.
Will update with more when it is relevant.
-Phil