katrotz / nova-sds011

Nova SDS011 PM sensor serial reader

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nova-sds011

Build Status

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("/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)
});

About

Nova SDS011 PM sensor serial reader

License:GNU General Public License v3.0


Languages

Language:JavaScript 100.0%