Session
What's that smell? Detecting air quality with Python, Raspberry Pi, and Redis
With a little wiring and a bit of code, create your own air sensor system to send alerts, activate appliances, and gather data. A sensor measures air quality and relays data to a Raspberry Pi compute unit. The Pi unit sends readings to Redis, which fans out data to multiple outlets in real-time!
This project was born when air quality was at an all-time low on the west coast of North America due to wildfires. Using an inexpensive and widely available air sensor module and a Raspberry Pi computer, I created a small portable device that would serve as a perfect platform to deliver air quality data points to a database in the cloud.
The Raspberry Pi accepts incoming sensor data, converts it to a timestamped entry in a timeseries, and sends the payload to a Redis instance in the cloud. The data is then able to feed visualization software (finale of presentation), send alerts via email/SMS, or activate servo motors to open or close windows or activate air purifiers.
All code is written in Python. Communication with Redis is done with redis-py, a client library providing Redis commands.