Environmental Sensing

08 Jul 2018

This little fella is the BME680 breakout board from Pimoroni. The BME680 itself is the little silver box with a hole in it. It’s an environmental sensor made by Bosch that seems to be able to do pretty much everything – it detects gas (oo-er), pressure, humidity and temperature. The gas part there is about air quality, which is why I got it. You see, past Oisin wrote down in his little project book that future Oisin is to make an air quality monitor, and a humidity monitor, and while current Oisin isn’t quite sure why past Oisin wanted these things, it seemed like a good idea to do both at once.

It’s an I2C device, and my plan is to hook it up to a Pi Zero W, set up as headless and configured to do I2C warbling. The nice chaps at Pimoroni have provided a Python module for it and of course a tutorial which seems to cover everything.

Aside the fact that a Pi Zero W is actually a computer is has me in a constant state of amazement. But look, I am ssh’ing into the damn thing on my network!

Setting up the Pi Zero is a breeze – you ssh into it, change the password and hostname, apt-get to upgrade packages. Python 2.7 is on the box and that’s what we use to put things together.

Bit of soldering later (no headers on these boards by default) and this is the sensor + pooter package:

Extra packages you need to apt-get install are python-pip, python-smbus and, i2c-tools, to enable further Python package installation, and to get the libraries for communicating I2C protocol to the BME680. Follow the instructions in the tutorial to get the bme680 package, the examples, and run the read-all.py script. You might expect it to work out of the box, and it does!

That’s output from the “burn-in” – temperature, pressure, humidity and the raw resistance reading from the gas sensor. About 20 minutes later the gas sensor value stabilized at around 171kΩ. Just to give it a test, I put a permanent marker of the stinky variety beside the sensor and the resistance reading plummeted to 7.6kΩ. So something is happening at least when in the presence of VOCs.

Next step: put this timeseries somewhere so that I can make GRAFFSS. Also I really need to brush up on Python programming.