Nose Picking Mechanisms
Publish your own packages to the world's most popular software ecosystem with npm Pro.Get started »

nova-sds011

0.0.2 • Public • Published

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)
});

Install

npm i nova-sds011

DownloadsWeekly Downloads

4

Version

0.0.2

License

GPL-3.0

Last publish

Collaborators

  • avatar