This tutorial enables you to setup a CO2-Monitor sending CO2 measurements via Bluetooth to nearby mobile phones. It also features a onboard screen to directly read the C02 measurements. More specifically, we will here use a LILYGO® TTGO T-Display ESP32 which is an ESP32 DevKit with a small 1.14 inch display attached.
All steps necessary and links to the compatible app for Android and iOS 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:
- LILYGO® TTGO T-Display ESP32
- Sensirion SCD30 Sensor (available here or with Grove Plug if you don't want to solder anything)
- Cables for soldering the connection or a Grove-to-Jumper cable (available here)
- USB cable to connect the ESP32 DevKitC module to your computer
Connect the SCD30 sensor to the TTGO T-Display ESP32 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 SCD30 to the 3.3V of the ESP32
- GND of the SCD30 to the GND of the ESP32
- SCL of the SCD30 to the IO22 of the ESP32
- SDA of the SCD30 to the IO21 of the ESP32
The following instructions originate from here
- Install the current version of the Arduino IDE (at least 2.0).
- Open the Boards Manager and install the esp32 platform (by Esspressif Systems).
- Select your ESP32 board from the
Tools -> Board
menu after the successfull installation.- E.g.
ESP32 Dev Module
- E.g.
We'll be installing the following libraries using the library manager included with Arduino IDE:
- Sensirion Gadget BLE Arduino Library
- Sensirion I2C SCD30
- NimBLE (dependency of Sensirion Gadget BLE Arduino Library)
- Sensirion Core (dependency of Sensirion Gadget BLE Arduino Library)
- Sensirion UPT Core (dependency of Sensirion Gadget BLE Arduino Library)
Additionally to use the onboard screen we will install the TFT_eSPI libray using the instructions below
Once done, it is good to restart the Arduino IDE.
- Go to TTGO T-Display's Github Repository
- Download the code as zip and extract its content
- Copy the Folder
TFT_eSPI
to your Arduino library path- On Windows, this is by default
C:\Users\Your User Name\Documents\Arduino\libraries
- On Windows, this is by default
- Open the Arduino IDE.
- Go to
File -> Examples -> Sensirion Gadget BLE Lib -> Example3_SCD30_BLE_TTGO_Gadget
. - 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 SCD30 sensor:
- Go to
Tools -> Serial Plotter
- Make sure on the bottom left corner
115200 baud
is selected, as depicted in the image below
Download the Sensirion MyAmbience app to monitor your CO2 levels, 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 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 Example3_SCD30_BLE_TTGO_Gadget contains a platformio.ini
file which allows you to use PlatformIO instead fo ArduinoIDE if you wish to do so.