This tutorial enables you to setup a CO2-Monitor sending Temperature, Humidity and Carbon Dioxide (CO2) measurements via Bluetooth to nearby mobile phones. All steps necessary and links to the compatible app for the interaction with the created Gadget are provided here.
The tutorial is structured in 3 parts
- Hardware Setup: Learn how to wire the sensor to the development board.
- Software Setup: Learn how to setup your computer to program the development board.
- Monitor Setup: Learn how to monitor your CO2 levels on your computer and via the Sensirion MyAmbience app.
To complete this tutorial, you'll need:
- ESP32 DevKitC-32D (available here)
- Sensirions SEK-SCD41
- USB cable to connect the ESP32 DevKitC module to your computer
Connect the SEK-SCD41 module to the ESP32 DevKitC as depicted below. Please note, that your developer kit may have a different pin layout. If you're using different pins or have a different layout, you might have to adjust the code accordingly.
- VDD of the SEK-SCD41 to the 3.3V of the ESP32
- GND of the SEK-SCD41 to the GND of the ESP32
- SCL of the SEK-SCD41 to the IO22 of the ESP32
- SDA of the SEK-SCD41 to the IO21 of the ESP32
The following instructions originate from here.
- Install the current version of the Arduino IDE.
- Start the Arduino IDE and open the Preferences window from
File -> Preferences. - Enter the following link into the Additional Board Manager URLs field. You can add multiple URLs, separating them
with commas.
https://dl.espressif.com/dl/package_esp32_index.json
- Open the Boards Manager from
Tools -> Board -> Board Managerand install the esp32 platform. - Select your ESP32 board from the
Tools -> Boardmenu after the successfull installation.- E.g.
ESP32 Dev Module
- E.g.
You will need to install the following libraries using the library manager included with Arduino IDE:
- The Sensirion GadgetBle Arduino Library
- The Sensirion I2C SCD4x Arduino Library
- The Sensirion Arduino Core Library
- The Sensirion UPT Core Library
- The NimBLE-Arduino Library
Once it is done, restart the Arduino IDE.
- Open the Arduino IDE.
- Go to
File -> Examples -> Sensirion Gadget BLE Lib -> Example8_SCD4x_BLE_Gadget_with_RHT. - Make sure the ESP32 is connected to your computer.
- Press the Upload button on the top left corner of the Arduino IDE.
To verify that everything is working fine, open the Serial Plotter, while your ESP32 ist still connected to your computer to see the sensor values measured by the SCD41 module:
- Go to
Tools -> Serial Plotter - Make sure on the bottom left corner
115200 baudis selected, as depicted in the image below
You should see the measured values plotted in the opened window. Alternatively you can choose Tools -> Serial Monitor
to see the values in text form.
Download the Sensirion MyAmbience app to monitor your sensor signals, download history values and export and share the data with your friends.
Note that on Android devices the Location services need to be enabled and the corresponding permissions granted to the application. This is required to allow the app to continuously scan for nearby Bluetooth devices. This is a requirement of the Android OS for Bluetooth scanning. The app itself does not use your location.
The folder Example8_SCD4x_BLE_Gadget_with_RHT contains a platformio.ini file which allows you to use PlatformIO instead of ArduinoIDE if you wish to do so.



