This is the hardware part of a project I built while volunteering with a research group at a physics lab. I was tasked with using two Raspberry Pi’s to monitor temperature, pressure, and humidity in various places throughout two rooms. To see the software portion of the project, including a simple web app for displaying graph of the data, click here.
- 2 Raspberry Pi’s, one in each lab room
- Up to 8 sensors per Pi
- 50m max cable runs from sensor to Pi
- Sensors read temperature, pressure, humidity all from one I2C breakout board
- Data is sent over ethernet to a database server on the host computer via LAN
Here’s my hardware setup in 5 steps:
Step 1: pick a sensor board
This is the Adafruit BME280. It has temp, pressure, and humidity all on one breakout board. It uses I2C to talk to the Pi.
Step 1 1/3: realize I2C only has a range of ~1 meter after already building half the project
Step 1 2/3: buy cheap I2C buffer chips to extend the range up to 50 meters
I used this one from TI. I also had to mess around a lot with pull-up resistor values to get it to work through a 10m cable.
Step 2: build sensors
I Used AutoCAD and a laser cutter for most of the enclosures for this project.
Step 3: multiplex sensors into Pi
Unfortunately the BME280 sensor boards have a fixed I2C bus address. This multiplexer, also made by Adafruit was a very easy fix. A multiplexer is like a digital selector switch which lets us choose which sensor to read.
Step 4: put pi in a box
I found a really cool website where you just enter your box dimensions and it generates a laser cutter design. All I had to do was add in all the cutouts and epoxy it together.
Step 5: put it all together while attempting to not create an octopus monster of cables
Overall this setup seems to work pretty well. The Pi can handle powering and reading 8 sensors no problem. If I were to redo this in the future I probably wouldn’t use I2C and instead pick a protocol better designed for long distances. Either that or look into making it wireless by sticking a cheap micro at each sensor.
That’s the hardware side of things. Here is how the software came together.