Category Archives: MySQL

Monitoring air quality with a Nova PM2.5/PM10 Sensor and Python

It is a major problem in almost all large German cities, that fine particulate matter is frequently exceeding  its maximum permissible value of 50 μg/m3. In a special issue of the Make Magazine (IoT special 01/2017), I read an article about the Nova PM SDS011 sensor, which is using the principle of laser scattering to measure the concentration of particulate matter between 0.3 to 10 μm in the air. The sensor is cheap (about 20 Euro) and easy to use, since it communicates via serial connection.

For placing the sensor into an enclosure,  it is equipped with a nozzle that allows to connect a hose of max. 1 m length. The UART communication protocol requires a bit rate of 9600 baud, with 8 data bit, no parity and one stop bit.

Continue reading Monitoring air quality with a Nova PM2.5/PM10 Sensor and Python

How to plot the frequency of PIR sensor events?

With a PIR sensor one can detect movements within it’s field of view and trigger other hardware, such as surveillance cameras. It is also possible to record the frequency of movements over time, e.g. to monitor motion activity in a room of your apartment.

pir_sensorWith a PIR sensor attached to my RasPi, I recorded motion events by storing UNIX timestamps in a single-column MySQL table. I wanted to visuaize these data points as a histogram displaying the frequency of motion events over time, but this task turned out to be more complicated than expected using GNUPlot. So here’s a short tutorial how it works:

Continue reading How to plot the frequency of PIR sensor events?