Looking at the current challenge of ventilating a classroom properly, i thought that an arduino could do that quite nicely.
I researched a little on the internet and found this post by Zentris using
- a nodeMCU ESP 8266 board
- an Sensiron SCD30 CO2 sensor (NDIR ==> thus quite accurate)
- and some displays, that I had no access to.
I ordered all components only to find out that I had no clue what to do next. Some more research revealed an existing library for the SCD30 sensor from sparkfun.
I found an old Grove-LCD RGB display in my arduino box and felt ready to go.
Then came the wiring. How to connect the SCD30 to the nodeMCU? After again some research, here is the correct set up
red: 3V - 3V
brown: GND - GND
blue: SDA - D2/GPIO4 (nodeMCU)
yellow: SCL - D1/GPIO5 (node MCU)
As also the display was using the i2l bus system, I added
yellow: SCL - SCL
blue: SDA - SDA
black: GND - GND
There is conflicting information on whether or not you can use the VIN port on the nodeMCU as 5V power supply, thus I used a second USB port via the funduino for that.
In the preferences of the Arduino package, add the proper board library:
On the software side: some libraries need to be included
- SparkFun SCD30 Arduino Libary
- Grove LCD RGB backlight
And that’s it. I will paste the code below. It is very raw and I hope to be able to connect it to an epaper and to beam the data to a webserver.
if you have any insights, I would appreciate you sharing them.
all the best, Thomas
Reading CO2, humidity and temperature from the SCD30
By: Nathan Seidle
Date: May 22nd, 2018
License: MIT. See license file for more information but you can
basically do whatever you want with this code.
Feel like supporting open source hardware?
Buy a board from SparkFun! CO₂ Humidity and Temperature Sensor - SCD30 - SEN-15112 - SparkFun Electronics
This example prints the current CO2 level, relative humidity, and temperature in C.
Attach RedBoard to computer using a USB cable.
Connect SCD30 to RedBoard using Qwiic cable.
Open Serial Monitor at 115200 baud.
/* Include RGB Library */
const int colorR = 0;
const int colorG = 255;
const int colorB = 0;
#include “SparkFun_SCD30_Arduino_Library.h” //Click here to get the library: http://librarymanager/All#SparkFun_SCD30
if (airSensor.begin() == false)
Serial.println(“Air sensor not detected. Please check wiring. Freezing…”);
//The SCD30 has data ready every two seconds
// set up the LCD’s number of columns and rows:
lcd.setRGB(colorR, colorG, colorB);
// Print a message to the LCD.
lcd.print(“CO2 in ppm”);
lcd.print(“temp. in C”);
Serial.println(“Waiting for new data”);
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
// print the temperature in the second row:
if (airSensor.getCO2() >= 1000)
lcd.setRGB(255, 0, 0);
else if (airSensor.getCO2() < 1000)
lcd.setRGB(0, 255, 0);
// Turn on the display: