conferences | speakers | series

What's That Smell? Detecting Air Quality with Python, Raspberry Pi, and Redis

home

What's That Smell? Detecting Air Quality with Python, Raspberry Pi, and Redis
PyCascades-2023

With a little wiring and a few lines of code, one can create your own hyperlocal air sensor system to send alerts, activate smart-windows, and gather data. A sensor measures air particulate density and sends the values to a Raspberry Pi compute unit. The Raspberry Pi then sends the data along with a timestamp and location information to a cloud instance of Redis, a NoSQL data store. Once in Redis, the data can trigger SMS notifications, feed data visualization libraries, or activate electronics such as air purifiers or motors to open or close windows. This can be scaled to monitor air quality in multiple rooms, offices, city blocks, or cities.

This project was created 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. Talk attendees should have a comfortable grasp of Python, basic data structures, and a novice understanding of NoSQL databases.

Speakers: Justin Castilla