Giter Club home page Giter Club logo

scd30-cli's Introduction

scd30-cli

CLI for interacting with Sensirion SCD30, the CO2, temperature, and humidity sensor.

The CLI exposes all of the commands supported by the SCD30, as documented in the official Interface Description.

Uses scd30-node for communication with the SCD30.

Usage

yarn global add scd30-cli
$ scd30-cli start-continuous-measurement
Continuous measurement started.
Ambient pressure compensation deactivated.

$ scd30-cli read-measurement
╔═══════════════════╤══════════╗
║ CO2 concentration │ 1054 ppm ║
╟───────────────────┼──────────╢
║ Temperature       │ 24.15°C  ║
╟───────────────────┼──────────╢
║ Humidity          │ 31.86%   ║
╚═══════════════════╧══════════╝

Options

  • -b, --bus <number>
    • The number of the I2C bus to open.
      0 for /dev/i2c-0, 1 for /dev/i2c-1, ...
      (default: 1)
  • -h, --help
    • output usage information

Commands

Refer to official documentation for more details on commands.

read-measurement

Read a measurement of CO2 concentration, temperature, and humidity.

status

Queries for data ready status, ASC status, FRC value, temperature offset, altitude compensation,continuous measurement interval, and firmware version

is-data-ready

Determines if a measurement can be read from the sensor's buffer.

start-continuous-measurement [pressure]

Starts continuous measurement of CO2 concentration, temperature, and humidity.

  • pressure (optional)
    • Ambient pressure to compensate CO2 measurements, 700–1400 mBar.
      Overrides altitude compensation.
      Setting to 0 deactivates ambient pressure compensation.
      To set new value, re-run start-continuous-measurement.

stop-continuous-measurement

Stops continuous measurement of CO2 concentration, temperature, and humidity.

set-measurement-interval <interval>

Sets the interval of continuous measurement.

  • interval
    • Interval of 2–1800 seconds

get-measurement-interval

Returns the interval of continuous measurement.

start-asc

Starts the automatic self-calibration.

stop-asc

Stops the automatic self-calibration.

get-asc-status

Returns the status of automatic self-calibration.

set-frc-value <co2ppm>

Sets the reference CO2 concentration for forced re-calibration.

  • co2ppm
    • Concentration of CO2, 400-2000 ppm

get-frc-value

Returns the reference CO2 concentration for forced re-calibration.

set-temp-offset <offset>

Sets the temperature offset.

  • offset
    • Temperature offset in units of 0.01°C

get-temp-offset

Returns the temperature offset.

set-altitude-compensation <altitude>

Sets the altitude compensation value.

  • altitude
    • Altitude in meters above sea level

get-altitude-compensation

Returns the altitude compensation value.

get-firmware-version

Returns the firmware version.

soft-reset

Performs a soft reset.

scd30-cli's People

Contributors

dependabot[bot] avatar rsmeral avatar

Stargazers

 avatar

Watchers

 avatar  avatar

scd30-cli's Issues

SCD30-CLI bus number option error (Invalid I2C bus number NaN)

Hi

I have 2 x SCD30 sensors on separate I2C busses due to not being able to change the sensors address (hardware set permanently at 0x61).
I have added 2 new busses at /dev/i2c-3 & /dev/i2c-4

 ~$ sudo i2cdetect -y -l
      i2c-3   i2c             3.i2c                                         I2C adapter
      i2c-1   i2c             bcm2835 (i2c@7e804000)       I2C adapter
      i2c-4   i2c             4.i2c                                         I2C adapter

They both return addresses successfully

pi@mypi:~$ sudo i2cdetect -y 3
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- 61 -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
pi@mypi:~$ sudo i2cdetect -y 4
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- 61 -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

However I can't connect to either of then via the scd30-cli to alter any configuration parameters as the command line bus number option always returns error as below:

pi@mypi:~$ scd30-cli -b 3 status
(node:1197) UnhandledPromiseRejectionWarning: Error: **Invalid I2C bus number NaN**
    at checkBusNumber (/usr/local/share/.config/yarn/global/node_modules/i2c-bus/i2c-bus.js:61:11)
    at open (/usr/local/share/.config/yarn/global/node_modules/i2c-bus/i2c-bus.js:35:3)
    at /usr/local/share/.config/yarn/global/node_modules/i2c-bus/i2c-bus.js:53:17
    at new Promise (<anonymous>)
    at Object.openPromisified (/usr/local/share/.config/yarn/global/node_modules/i2c-bus/i2c-bus.js:51:49)
    at /usr/local/share/.config/yarn/global/node_modules/scd30-node/dist/index.js:227:33
    at Generator.next (<anonymous>)
    at /usr/local/share/.config/yarn/global/node_modules/scd30-node/dist/index.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/usr/local/share/.config/yarn/global/node_modules/scd30-node/dist/index.js:4:12)
(node:1197) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:1197) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Same error for bus number 4

Is this a bug or am I providing the bus number in the wrong format?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.