With thoughts to miniaturization, the NDIR (Nondispersive Infrared Sensor) technology seems to reach a limit for CO2 sensors, as the sensor sensitivity is directly equivalent to the optical beam path length and thus the sensor size. The Sensirion is always aiming at disrupting sensor markets by making components more price-effective without compromising performance. For CO2 sensing, identified as the photoacoustic technology as the most promising approach: In addition to decreasing the size and the cost of CO2 sensors, this technology allows for SMT (Surface Mounted Technology) assembly to replace arduous through-hole soldering. These three factors combined have the potential to open up new CO2 sensing markets.
The SCD30 with CMOSens® Technology integrates IR detection allows carbon dioxide analyses for the highest accuracy at a rival price. Together with the NDIR measurement technology for detecting CO 2 including the best-in-class Sensirion humidity and temperature sensor integrated on the module.
Ambient humidity and temperature can be measured by Sensirion’s algorithm expertise through modeling and compensating external heat sources without the need for any additional internal or external components. The SCD30 is small module height allows easy integration into different applications such as home, lab, containers that require CO2 readings, health care facilities, IOT Devices, Ventilations, and Supistacated container box that requires monitoring of temperature, humidity, and air quality.
As you can see in the diagram below we have two diagrams the first diagram is using a TTGO module with an integrated OLED display and the second diagram is using an external OLED screen display, Just keep in mind the voltage reference of the display module some manufacturer is using 3.3v and other 5v. if your display module is using 3.3v just use the pin 3.3v otherwise if your display module is supporting 5v then hook it into the 5v pin.
Wiring Guide Diagram
Wiring with TTGO – Integrated OLED Display
Wiring with an external display
Source Code Test Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
#include "SCD30.h" #if defined(PARTICLE) #pragma message("Defined architecture for PARTICLE") #define SERIAL Serial #elif defined(ARDUINO_ARCH_AVR) #pragma message("Defined architecture for ARDUINO_ARCH_AVR.") #define SERIAL Serial #elif defined(ARDUINO_ARCH_SAM) #pragma message("Defined architecture for ARDUINO_ARCH_SAM.") #define SERIAL SerialUSB #elif defined(ARDUINO_ARCH_SAMD) #pragma message("Defined architecture for ARDUINO_ARCH_SAMD.") #define SERIAL SerialUSB #elif defined(ARDUINO_ARCH_STM32F4) #pragma message("Defined architecture for ARDUINO_ARCH_STM32F4.") #define SERIAL SerialUSB #else #pragma message("Not found any architecture.") #define SERIAL Serial #endif void setup() { Wire.begin(); SERIAL.begin(115200); SERIAL.println("14CORE | SCD30 Test Raw Data"); scd30.initialize(); } void loop() { float result[3] = {0}; if (scd30.isAvailable()) { scd30.getCarbonDioxideConcentration(result); SERIAL.print("CO2 Concentration Value: "); SERIAL.print(result[0]); SERIAL.println(" ppm"); SERIAL.println(" "); SERIAL.print("@ Temperature = "); SERIAL.print(result[1]); SERIAL.println(" ℃"); SERIAL.println(" "); SERIAL.print("@ Humidity = "); SERIAL.print(result[2]); SERIAL.println(" %"); SERIAL.println(" "); SERIAL.println(" "); SERIAL.println(" "); } delay(2000); } |
Test Code with TTGO TFT Display
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
#include "esp_timer.h" #include // Go to TTGO T-Display's Github Repository // Download the code as zip, extract it and copy the Folder TFT_eSPI // => https://github.com/Xinyuan-LilyGO/TTGO-T-Display/archive/master.zip // to your Arduino library path #include #include // Download the SeeedStudio SCD30 Arduino driver here: // => https://github.com/Seeed-Studio/Seeed_SCD30/releases/latest #include "SCD30.h" #include "Sensirion_GadgetBle_Lib.h" static int64_t lastMmntTime = 0; static int startCheckingAfterUs = 1900000; GadgetBle gadgetBle = GadgetBle(GadgetBle::DataType::T_RH_CO2_ALT); // Display related #define SENSIRION_GREEN 0x6E66 #define sw_version "v1.0" #define GFXFF 1 #define FF99 &SensirionSimple25pt7b #define FF90 &ArchivoNarrow_Regular10pt7b #define FF95 &ArchivoNarrow_Regular50pt7b TFT_eSPI tft = TFT_eSPI(135, 240); // Invoke library, pins defined in User_Setup.h void displayInit() { tft.init(); tft.setRotation(1); } void displaySplashScreen() { tft.fillScreen(TFT_WHITE); tft.setTextColor(SENSIRION_GREEN, TFT_WHITE); uint8_t defaultDatum = tft.getTextDatum(); tft.setTextDatum(1); // Top centre tft.setTextSize(1); tft.setFreeFont(FF99); tft.drawString("B", 120, 40); tft.setTextSize(1); tft.drawString(sw_version, 120, 90, 2); // Revert datum setting tft.setTextDatum(defaultDatum); } void displayCo2(uint16_t co2) { if (co2 > 9999) { co2 = 9999; } tft.fillScreen(TFT_BLACK); uint8_t defaultDatum = tft.getTextDatum(); tft.setTextSize(1); tft.setFreeFont(FF90); tft.setTextColor(TFT_WHITE, TFT_BLACK); tft.setTextDatum(6); // bottom left tft.drawString("CO2", 10, 125); tft.setTextDatum(8); // bottom right tft.drawString(gadgetBle.getDeviceIdString(), 230, 125); // Draw CO2 number if (co2 >= 1600 ) { tft.setTextColor(TFT_RED, TFT_BLACK); } else if (co2 >= 1000 ) { tft.setTextColor(TFT_ORANGE, TFT_BLACK); } else { tft.setTextColor(TFT_GREEN, TFT_BLACK); } tft.setTextDatum(8); // bottom right tft.setTextSize(1); tft.setFreeFont(FF95); tft.drawString(String(co2), 195, 105); // Draw CO2 unit tft.setTextSize(1); tft.setFreeFont(FF90); tft.drawString("ppm", 230, 90); // Revert datum setting tft.setTextDatum(defaultDatum); } void setup() { Serial.begin(115200); delay(100); // Initialize the GadgetBle Library gadgetBle.begin(); Serial.print("Sensirion Blutooth Lib initialized with deviceId = "); Serial.println(gadgetBle.getDeviceIdString()); // Initialize the SCD30 driver Wire.begin(); scd30.initialize(); scd30.setAutoSelfCalibration(1); // Display init and splash screen displayInit(); displaySplashScreen(); // Enjoy the splash screen for 2 seconds delay(2000); } void loop() { float result[3] = {0}; if (esp_timer_get_time() - lastMmntTime >= startCheckingAfterUs) { if (scd30.isAvailable()) { scd30.getCarbonDioxideConcentration(result); gadgetBle.writeCO2(result[0]); gadgetBle.writeTemperature(result[1]); gadgetBle.writeHumidity(result[2]); gadgetBle.commit(); lastMmntTime = esp_timer_get_time(); // Provide the sensor values for Tools -> Serial Monitor or Serial Plotter Serial.print("CO2[ppm]:"); Serial.print(result[0]); Serial.print("\t"); Serial.print("Temperature[℃]:"); Serial.print(result[1]); Serial.print("\t"); Serial.print("Humidity[%]:"); Serial.println(result[2]); // display CO2 value displayCo2((uint16_t) std::round(result[0])); } } gadgetBle.handleEvents(); delay(3); } |
Downloads
- SENSERION Code Library | Zip
- SENSERION Example Test Codes & Libraries | Zip
- SCD30 Test Code and Libraries | Zip
- ESP32 TTGO w/d TFT Display & Font | Zip
- ESP32 TFT Schematics diagram | PDF
- ESP32 TTGO Pinout Diagram
- ESP32 TTGO ESPI – Code Library | Zip
- LILYGO TFT Firmware Upgrade | Zip
- Senserion CO2 Carbon Dioxide Sensor Technical Data Sheet | PDF
- Download Adafruit_GFX | Zip
- Download Adafruit_SSD1306 | Zip
Hello
is a normal error message when compiling ’round’ is not a member of ‘std’ ?
’round’ is not a member of ‘std’
Its a normal after compiling ?