Open Source Solutions for Schools
the last 100 records are written to /var/www/html/aqi.json.
Both are the last read value. There is no calculation of the average.
The script outputs the raw values. The big numbers on the website are the AQI that is calculated from these values. AQI is not the same as the raw PM2.5 measurements. That’s why it differs.
There is not much on the hardware side to do, because it is just plugging in the USB-Serial converter, that comes with the sensor.
Thanks, so you are not using the USB serial adapter that comes with the sensor? The script is written for that adapter. If you use your own one, you need to adapt the code to read from another interface.
Thanks. Is the sensor connected? Could you post the output of “lsusb”, please?
And could you please add the full output after you started the script?
Did you run these commands?:
$ sudo chown pi:pi /var/www/html/
$ echo  > /var/www/html/aqi.json
Checkout this line: https://github.com/zefanja/aqi/blob/master/python/aqi.py#L102
It’s not recommend to make it to short, because the sensor takes some time to adjust, after you woke it up.
Currently I don’t have a solution for Python 3 :(