- Read data from UART(serial)-connected MH-Z14 sensor using python,
- visualize received data using html and plotly.js library.
(peak at 6:50 AM is when my cat walked over my desktop and probably sniffed the sensor)
Sensor can be queried using 3.3v UART at 9600 bps. Sensor main feed voltage is 5v.
Can be connected to computer using almost any USB-UART converter if voltage matches.
$ python CO2Reader.py /dev/ttyUSB0 10
Connected to /dev/ttyUSB0
2016-03-25 22:04:16 1134 69
...
4 fields separated by tab: timestamp, CO2 concentration (ppm), internal sensor temperature (celsius?), checksum validation result
python script and library is expecting python 3.7+ and has dependency on pyserial 3.4 (may be installed via pip)
Use stream redirection to save data series to file.
$ python CO2Reader.py /dev/ttyUSB0 >example.log
- install npm dependencies
npm install
- start server
python -m SimpleHTTPServer 8088
- open browser at http://localhost:8088/plot.html
- select your log file in input field
MIT licence