I’ve been working on a prototype for a Raspberry Pi weather station this last while and recently I made two new additions to the setup: a pressure sensor and an LCD screen.
The pressure sensor is the BMP180, which also gives a temperature reading. I used the Adafruit BMP libraries to control it (you can find the project on Github at https://github.com/adafruit/Adafruit_Python_BMP). There are plenty of guides online in getting this sensor set up, and it’s straightforward to do.
I was already using the Adafruit DHT library to use the temperature and humidity sensor and send data to Google Docs, so I just added in the imports and stuff to its Google upload script so that both the DHT and BMP stuff could be used in one file.
This week my 16×2 LCD screen arrived and using this information I got it set up. I ran into trouble with running the code in one part: There are instructions for setting up quick2wire and i2clibraries, but I needed to move the contents of one of those directories into the other, as mentioned in this comment. The next problem was that the I2C address in the example code wasn’t pointing to the right place, so I had to change that too. Once I did that, the LCD screen worked perfectly.
Next, back to the Google Docs upload script. That script runs in Python, but the LCD stuff needs Python3, so I couldn’t do everything directly in one Python script. I got around this by calling the LCD script (requiring Python3) as an OS call in the Google Docs script (requiring Python) which gathers the weather data, and passing that data into the call. So, once the main script got its information, it then runs the LCD script which takes the weather data as arguments and prints it on the screen. Following this, it uploads the data to Google.
It sounds hacky, and it is, but it works and it’s quite straightforward to do once you have it in front of you!