M4 microcontroller, with a FeatherWing OLED
display and FeatherWing data logger; he shared
his code and bill of materials at github.com/
stephanschulz/co2-monitor.
If you’d like to roll your own CO
2
device, Carter
Nelson wrote an excellent mix-and-match list of
Adafruit parts at makezine.com/go/co2-adafruit.
SOFTWARE
The CO
2
monitor can be programmed in Arduino
or ArduBlock, a visual block programming
editor that is similar to Scratch (Figure
R
).The
program consists of a loop that reads the sensor
and provides the logic for what to do based on the
sensor values, and which LED light to turn on.
The code for the CO
2
Traffic Light can be
downloaded from github.com/make-IoT/CO2-
Ampel in ArduBlock or Arduino. The IoT Werkstatt
portable Arduino version includes all needed
libraries; download it from the Quick Start guide
in English at umwelt-campus.de/en/research/
projects/translate-to-englisch-iot-werkstatt.
The highlights of the code are as follows:
Enclose the procedure in a loop.
Create a variable to store for our sensor
reading. We called it CO2.
Select the sensor from a library folder: the
SCD30 or the MH-Z19.
Get the reading from a sensor.
The sensor is always two blocks. One
sends a reading and the other is used for
Guido Burger
1
2
3
4
1. Adafruit SCD30 NDIR CO
2
sensor, part #4867
2. Feather M4 Express microcontroller, #3857
3. Adalogger FeatherWing with RTC and SD slot, #2922
4. FeatherWing 128×32 OLED display, #2900
Stephan Schulz’s battery-powered CO
2
monitor
based on Adafruit FeatherWings:
R
ArduBlock can be used to program the CO
2
monitor.
calibration.Initially, we use the first block
just to read a value from the sensor.
Select from the different values that the sensor
provides: CO
2
, temperature, and humidity.
Use the CO
2
level only and connect it to the
CO2 variable.
Create the logic that checks the value and
decides what to do, using if- else controls
and a logic operator:
Look for a threshold: if its less than
1000ppm then turn on green light.
If above 1000ppm, turn on the yellow light.
If above 1400ppm, turn on the red light.
At end of loop, add a 2000 millisecond delay,
which means we are sampling readings every
2 seconds.
33
make.co
S
M78_024-35_CO2Monitor_F1.indd 33M78_024-35_CO2Monitor_F1.indd 33 7/13/21 9:50 AM7/13/21 9:50 AM
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.187.103