From 224d2768843da330a7a6f0a98f6530c377e6a737 Mon Sep 17 00:00:00 2001 From: Ron Smeral Date: Tue, 18 Feb 2020 23:58:24 +0100 Subject: [PATCH] Add support for SCD30 on Raspberry Pi --- ...e-CO2_Temperature_Humidity_Sensor-SCD30.md | 88 ++++++++++++++++++- docs/Raspberry_Pi.md | 5 +- mkdocs.yml | 3 +- 3 files changed, 90 insertions(+), 6 deletions(-) diff --git a/docs/Grove-CO2_Temperature_Humidity_Sensor-SCD30.md b/docs/Grove-CO2_Temperature_Humidity_Sensor-SCD30.md index b491e975..906eacb3 100644 --- a/docs/Grove-CO2_Temperature_Humidity_Sensor-SCD30.md +++ b/docs/Grove-CO2_Temperature_Humidity_Sensor-SCD30.md @@ -132,15 +132,17 @@ In addition to the Non-Dispersive Infrared(NDIR) measurement technology for CO2 ## Platforms Supported -| Arduino | Raspberry Pi | BeagleBone | Wio | LinkIt ONE | -|-----------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------| -| ![](https://raw.githubusercontent.com/SeeedDocument/wiki_english/master/docs/images/arduino_logo.jpg) | ![](https://raw.githubusercontent.com/SeeedDocument/wiki_english/master/docs/images/raspberry_pi_logo_n.jpg) | ![](https://raw.githubusercontent.com/SeeedDocument/wiki_english/master/docs/images/bbg_logo_n.jpg) | ![](https://raw.githubusercontent.com/SeeedDocument/wiki_english/master/docs/images/wio_logo_n.jpg) | ![](https://raw.githubusercontent.com/SeeedDocument/wiki_english/master/docs/images/linkit_logo_n.jpg) | +| Arduino | Raspberry Pi | BeagleBone | Wio | LinkIt ONE | +|-------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------| +| ![](https://raw.githubusercontent.com/SeeedDocument/wiki_english/master/docs/images/arduino_logo.jpg) | ![](https://raw.githubusercontent.com/SeeedDocument/wiki_english/master/docs/images/raspberry_pi_logo.jpg) | ![](https://raw.githubusercontent.com/SeeedDocument/wiki_english/master/docs/images/bbg_logo_n.jpg) | ![](https://raw.githubusercontent.com/SeeedDocument/wiki_english/master/docs/images/wio_logo_n.jpg) | ![](https://raw.githubusercontent.com/SeeedDocument/wiki_english/master/docs/images/linkit_logo_n.jpg) | ## Getting Started +* [Play With Arduino](#play-with-arduino) +* [Play With Raspberry Pi](#play-with-raspberry-pi) ### Play With Arduino @@ -282,6 +284,86 @@ void loop() ![](https://github.com/SeeedDocument/Grove-CO2-Temperature-Humidity-Sensor-SCD30/raw/master/img/c2.jpg) +### Play With Raspberry Pi + +#### Hardware + +Connect the SCD30 sensor to an I2C port of the GrovePi+ as described in the [Quickstart Guide to the GrovePi+](http://wiki.seeedstudio.com/GrovePi_Plus/). + +#### Software + +**Node.js** + +To use the sensor in your JavaScript or TypeScript Node.js project, use the [scd30-node](https://www.npmjs.com/package/scd30-node) package. + +``` +npm install --save scd30-node +``` + +```typescript +import {SCD30} from 'scd30-node'; + +// ... + +const scd30 = await SCD30.connect(); +await scd30.startContinuousMeasurement(); + +const measurement = await scd30.readMeasurement(); +console.log(measurement.co2Concentration); +console.log(measurement.temperature); +console.log(measurement.relativeHumidity); + +await scd30.disconnect(); +``` + +See the [scd30-node](https://www.npmjs.com/package/scd30-node) package for full API documentation. + +**Command-line interface** + +You can also interact with the SCD30 from a command line using the [scd30-cli](https://www.npmjs.com/package/scd30-cli) package. + +``` +npm install -g 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% ║ +╚═══════════════════╧══════════╝ +``` + +See the [scd30-cli](https://www.npmjs.com/package/scd30-cli) package for full documentation of available commands. + +**Node-RED** + +You can read data from the SCD30 also in your Node-RED flows using the [node-red-contrib-scd30](https://www.npmjs.com/package/node-red-contrib-scd30) node. + +In Node-RED, open the top-right corner hamburger menu > Manage Palette > Install, search for `node-red-contrib-scd30`, and click **Install**. + +Find the `scd30` node in the **sensors** section and add it to your flow. + +![SCD30 node in Node-RED](https://github.com/rsmeral/node-red-contrib-scd30/blob/master/scd30-node.png?raw=true) + +The node replaces the message payload with an object containing the measured values: + +```typescript +{ + co2Concentration: , + temperature: , + relativeHumidity: +} +``` + +See the [node-red-contrib-scd30](https://www.npmjs.com/package/node-red-contrib-scd30) package for more details. ## Calibration and Placement diff --git a/docs/Raspberry_Pi.md b/docs/Raspberry_Pi.md index 03c0781c..0eb391c8 100644 --- a/docs/Raspberry_Pi.md +++ b/docs/Raspberry_Pi.md @@ -8,17 +8,18 @@ Raspberry Pi is originally designed and created by a non-profit organization in Several generations of Raspberry Pis have been released. The first generation (Pi 1) was released in February 2012 in basic model A and a higher specification model B. A+ and B+ models were released a year later. Raspberry Pi 2 model B was released in February 2015 and Raspberry Pi 3 model B in February 2016. -At Seeed Studio, we provide not only different raspberry pi boards that mentioned above , but also provide different accessories and starter kits that can help you creating raspberry pi project. What’s more, we have created numbers of tutorials in Seeed’s raspberry pi community where you can easily building circuits of raspberry pi. +At Seeed Studio, we provide not only different Raspberry Pi boards mentioned above, but also provide different accessories and starter kits that can help you start creating Raspberry Pi projects. What's more, we have created numbers of tutorials in Seeed's Raspberry Pi community where you can easily start building circuits with Raspberry Pi. ## Product List --- -Here is the list of the Raspberry Pi Boards you can find in the Seeed WiKi. The list will be constantly updated. +Here is the list of the Raspberry Pi Boards you can find in the Seeed Wiki. The list will be constantly updated. - [Grove Base HAT](/Grove_Base_HAT/) - [Grove Starter Kit for IoT based on Raspberry Pi](/Grove_Starter_Kit_for_IoT_based_on_Raspberry_Pi/) - [GrovePi+](/GrovePi_Plus/) +- [Grove - CO2 & Temperature & Humidity Sensor (SCD30)](/Grove-CO2_Temperature_Humidity_Sensor-SCD30/) - [Raspberry Pi Breakout Board v1.0](/Raspberry_Pi_Breakout_Board_v1.0/) - [Raspberry Pi Motor Driver Board v1.0](/Raspberry_Pi_Motor_Driver_Board_v1.0/) - [Raspberry Pi RS232 Board v1.0](/Raspberry_Pi_R232_Board_v1.0/) diff --git a/mkdocs.yml b/mkdocs.yml index 7d0c08c2..d7a85310 100755 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,4 +1,4 @@ -# Copyright (c) 2016-2017 Martin Donath +# Copyright (c) 2016-2017 Martin Donath # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to @@ -150,6 +150,7 @@ pages: - 3D Gesture Tracking Shield for Raspberry Pi MGC3130: 3D-Gesture-Tracking-Shield-for-Raspberry-Pi-MGC3130.md - Grove Base HAT: Grove_Base_HAT.md - GrovePi Plus: GrovePi_Plus.md + - Grove - CO2 & Temperature & Humidity Sensor (SCD30): Grove-CO2_Temperature_Humidity_Sensor-SCD30.md - Raspberry Pi Breakout Board v1.0: Raspberry_Pi_Breakout_Board_v1.0.md - Raspberry Pi Motor Driver Board v1.0: Raspberry_Pi_Motor_Driver_Board_v1.0.md - Pi RTC (DS1307): Pi_RTC-DS1307.md