co2-monitor

Measure CO2 and temperature in nodejs with the TFA-Dostmann AirControl Mini

Usage no npm install needed!

<script type="module">
  import co2Monitor from 'https://cdn.skypack.dev/co2-monitor';
</script>

README

co2monitor

Reads the CO2 level and temperature from the TFA-Dostmann CO2-Monitor AIRCO2NTROL MINI via USB.

Just connect the sensor via USB and run the example script. There is no need to set up the sensor or USB port.

Hardware

TFA-Dostmann CO2-Monitor AIRCO2NTROL MINI 31.5006

Install

npm install co2-monitor

Example

const Co2Monitor = require('co2-monitor');

let co2Monitor = new Co2Monitor();

co2Monitor.on('connected', (device) => {
  co2Monitor.startTransfer();

  console.log('Co2Monitor connected');
});

co2Monitor.on('disconnected', () => {
  console.log('Co2Monitor disconnected');
});

co2Monitor.on('error', (error) => {
  console.error(error);

  co2Monitor.disconnect(() => {
    process.exit(1);
  });
})

co2Monitor.on('co2', (co2) => {
  console.log('co2: ' + co2);
})

co2Monitor.on('temp', (temp) => {
  console.log('temp: ' + temp);
})

co2Monitor.on('data', (data) => {
  console.log('data: ' + data);
})

co2Monitor.on('rawData', (rawData) => {
  console.log(rawData);
})

co2Monitor.connect();

credits

based on code by henryk ploetz

license

MIT