I've had a spare Raspberry Pi Zero 2 W floating around, along with a Waveshare Enviroment HAT, and I finally got around to doing something with them. The Pi Zero 2 W is probably overkill for the simple task of reading some sensors and recording to a database, but it has the benefit of a 64-bit processor which makes it easier to find working libraries.
The Enviroment HAT is a great little board. It comes with an array of sensors:
TSL25911 Digital Ambient Light Sensor
- I2C address: 0x29
- Effective range: 0~88000 Lux
BME280 Temperature, Humidity, and Air Pressure Sensor
- I2C address: 0x76
- Temperature: -40~85°C (0.01°C resolution, ±1°C accuracy)
- Humidity: 0~100%RH (0.008%RH resolution, ±3%RH accuracy, 1s response time, ≤2%RH delay)
- Air Pressure: 300~1100hPa (0.18Pa resolution, ±1hPa accuracy)
ICM20948 9-DOF Motion Sensor
- I2C address: 0x68
- Accelerometer:
- Resolution: 16-bit
- Range: ±2, ±4, ±8, ±16g (configurable)
- Gyroscope:
- Resolution: 16-bit
- Range: ±250, ±500, ±1000, ±2000°/sec (configurable)
- Magnetometer:
- Resolution: 16-bit
- Range: ±4900µT
LTR390-UV-1 UV Sensor
- I2C address: 0x53
- Response wavelength: 280nm - 430nm
SGP40 VOC Sensor
- I2C address: 0x60
- Measuring range: 0 ~ 1,000 ppm ethanol equivalent
- Limit condition: <0.05 ppm ethanol equivalent OR < 10% preset concentration point
- Response time: <10s (tau 63%)
- Start time: < 60s
I'm recording a bit aggressively right now. A new entry is created every 60 seconds. Mostly. There are occasional hiccups where the sensors stop collecting, but that is usually smoothed over by the database aggregation and some error handling that tries to reinitialize the sensors before rebooting if needed.
The project is open source, and currently split between two repositories:
One hosts a Vite + React frontend that reads the data from Supabase, and the other is some python and systemd code that runs on the Pi as a service.