nova-sds011
v0.0.2
Published
Nova SDS011 serial reader
Downloads
3
Readme
nova-sds011
Nova SDS011 PM sensor serial reader
Quickstart
Plugin the Nova and run "node index.js". (NOTE: script assumes the Nova is at /dev/ttyUSB0)
Library Usage
Use serialport with this library to read values:
let serialport = require("serialport")
let sds011 = require('nova-sds011')
let serial = new serialport.SerialPort("/dev/ttyUSB0", {
baudrate: 9600
})
serial.on('data', function (data) {
let pmValues = sds011(data)
if (!pmValues) {
log.error('failed to parse buffer [' + data.toString('hex') + ']')
return
}
console.info("pm2.5: " + pmValues.pm2_5 + "\tpm10: " + pmValues.pm10)
});