A while back I posted on a temperature/humidity sensor and logging solution I built using a Raspberry Pi.
Since then, I've added a air quality sensor for particulate matter (sawdust) in the shop. Every 3 minutes a sample is taken and is charted. Logging and visualization of the data is here.
The sensor was $30. I was skeptical about the accuracy of something so cheap. The research indicates there is some variation from more expensive air quality monitors, but is good enough for non-scientific use.
On my original temperature/humidity post, a couple folks asked for step-by-steps on getting it configured. My linux skills are pretty basic. I have to go through about 10 trial and errors to get something to work, not really sure of the exact combination of what was necessary. As a result, I won't be able to give step-by-steps, but am happy to answer questions in a bit more detail about what/how I did things.
The sensor is rated for 1 year of active measurement taking. I have it taking measurements once every 3 minutes. It takes about 10 seconds to turn on, measure, and turn-off. With the sensor sleeping the other 170 seconds, my math suggests this will give 18 years of life for the sensor. If I get even 1/10th of that, it will be $30 well spent.
A few of the resources I used:
- https://www.raspberrypi.org/blog/mon...-raspberry-pi/
- Google: 'sds011 raspberry pi'
- Google: 'sds011 pmtwofive'
- https://github.com/crotwell/airQuali.../airquality.py - A starting place for python script for polling the data. Will need to modify it to the right sleep/measurement cycle times as well as what is done with the data (I dump mine to MQTT).
The basics of the solution:
- The sensor is plugged in via USB directly to the Raspberry Pi
- pmtwofive library to grab the data. Scheduled & executed using shell commands (startup or cron jobs)
- python - see sample/starting script above
- Data is dumped into MQTT (I was already running a local MQTT --> NodeRed instance locally from the temp/humidity project. The NodeRed does de-deplication and publishes to Thingspeak for visualization)
- Thinkspeak for logging, visualization, and access-from-anywhere
Biggest issue I ran into was incompatibility between Python version and the libraries being used due expected data types. I had to be explicit about invoking the right Python version. I think I was accidentally calling python2 when it needed python3.
Again, I'm FAR from being proficient in linux. If you have basic skills, or want to learn, this might be a good project to take on. A raspberry pi runs ~$35-50 if you need to buy one for this. All said, I'm extremely pleased with what I was able to do for < $100, plus some time learning something new (technology).