Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tomhumphries/mh-z19b
Communication with the MH-Z19B IR CO2 sensor for Node.js
https://github.com/tomhumphries/mh-z19b
co2 iot mh-z19 mh-z19b mhz19 mhz19b node nodejs sensor
Last synced: about 3 hours ago
JSON representation
Communication with the MH-Z19B IR CO2 sensor for Node.js
- Host: GitHub
- URL: https://github.com/tomhumphries/mh-z19b
- Owner: TomHumphries
- Created: 2020-03-24T19:34:49.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-03-26T09:16:41.000Z (over 2 years ago)
- Last Synced: 2024-10-01T12:34:57.030Z (about 1 month ago)
- Topics: co2, iot, mh-z19, mh-z19b, mhz19, mhz19b, node, nodejs, sensor
- Language: JavaScript
- Size: 33.2 KB
- Stars: 6
- Watchers: 3
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MH-Z19B
Communication with the MH-Z19B IR CO2 sensor for Node.js## Declare
```let mhz19b = new MHZ19B('/dev/serial0');```
The default UART port is _'/dev/serial0'_## Commands
Promise based
```
let mhz19b = new MHZ19B();
mhz19b.readCO2()
.then(data => {
console.log('CO2 reading', data);
})
.catch(err => {
console.log('error', err);
})
```Event based
```
let mhz19b = new MHZ19B();
mhz19b.on('CO2', (data) => {
console.log(`${data.co2}`);
});
mhz19b.readCO2();
```Calibrate sensor baseline - set current level to 400 (do outside)
```
let mhz19b = new MHZ19B();
mhz19b.calibrate();
```Enable / Disable ABC mode (auto-recalibration to 400 ppm every 24 hours)
```
let mhz19b = new MHZ19B();
mhz19b.abcOn();
mhz19b.abcOff();
```