In metrology and precision analog instrumentation work environment conditions are great importance. Temperature rise just mere 1 °C can easily upset sensitive low-level measurements, due to thermal drift. Humidity change affect PCBs and components as well, changing resistance of surfaces and change low current leakages. Often metrology labs have environment conditioning, with temperature variation set to +0.5°C or even better. For most stringent requirements, separate enclosed air bath chambers or oil bathes used. Most of these approaches are expensive, bulky and not suitable for hobbyist home lab environments.

Sounds like there is no way to mitigate dependence from environment changes, but we can at least measure it, and include in test results, so correlations can be made, improving confidence level of results achieved.

Here were opted for universal sensor, such as Bosch BME280 as versatile environmental measurement tool, to log ambient temperature, barometric pressure and humidity. This sensor is great for all sorts of weather/environmental sensing and easy to use with digital interfaces, such as SPI or I2C.

Since we already use Raspberry Pi with NI USB-GPIB-HS to interface with test equipment, it is simple call to get BME280 connected to same Raspberry Pi as environment data provider. I got Adafruit BME280 adapter board with everything already assembled on it, so it’s simple plug-and-use module.

Connections to RPi

Don’t pay attention to additional small board mounted on the Raspberry Pi, that is just I2C interface isolator. It’s not required for using BME280. In example below I2C connection was used to I2C1 port of Raspberry Pi I/O header.

Signal

Raspberry Pi pin number

BME280 pin

Power +5V

Pin 2

VIN pin

Data SDA

Pin 3

SDI pin

Clock SCL

Pin 5

SCK pin

Ground

Pin 6

GND pin

Command i2cdetect -y 1 should show presence of device with address 0×77 if connection is correct. Don’t forget to get I2C enabled on your Pi, if it’s not already on.

Raspberry Pi code and software setup

I’ll use Python to interface our sensor, so first we will need Adafruit_Python_GPIO library. This library to provide a cross-platform GPIO interface on the Raspberry Pi and Beaglebone Black using the RPi.GPIO and Adafruit_BBIO libraries.