Browse our open source example apps to accelerate your wireless IoT project.

Blues Developers
What’s New
Resources
Blog
Technical articles for developers
Newsletter
The monthly Blues developer newsletter
Terminal
Connect to a Notecard in your browser
Developer Certification
Get certified on wireless connectivity with Blues
Webinars
Listing of Blues technical webinars
Blues.comNotehub.io
Shop
Docs
Button IconHelp
Notehub StatusVisit our Forum
Button IconSign In
Sign In
Sign In
What’s New
Resources
Blog
Technical articles for developers
Newsletter
The monthly Blues developer newsletter
Terminal
Connect to a Notecard in your browser
Developer Certification
Get certified on wireless connectivity with Blues
Webinars
Listing of Blues technical webinars
Blues.comNotehub.io
Shop
Docs
homechevron_rightExample Appschevron_rightAcceleratorschevron_rightSmart CO2 Sensor

Smart CO2 Sensor

  • Arduino Firmware
  • Environment Variables
  • SMS Notifications
  • Wiring Required

Detect CO2 levels (ppm) in a given environment. Publish the values and set dynamic alarm thresholds for activities via a cellular connection.

Overview

This application continuously reads atmospheric CO2 levels in ppm and checks to see whether the current CO2 levels are cause for concern. When an alarm event is triggered, then an alarm is sounded and a Twilio message is generated to warn employees and/or patrons of dangerous CO2 levels. Periodic samples of atmospheric CO2 are recorded and synced to Notehub via a Notecard .

You Will Need

  • Notecard
  • Notecarrier F
  • Adafruit FeatherWing OLED - 128x32
  • Blues Swan
  • DFRobot Gravity: Digital Speaker Module
  • DFRobot Gravity: UART Infrared Carbon Dioxide Sensor (0-50000 ppm)
  • Momentary push button
  • 5V, 2A DC power supply
  • DC Power Jack Plug Adapter Barrel Connector
  • Micro USB cable
  • Male-to-male jumper wires
  • Soldering iron and solder flux
  • 47pF capacitor (optional)
  • 3D printed enclosure (optional)

Hardware Setup

Notecard and Notecarrier

For prototyping, assemble the Notecard and Notecarrier as described in the Notecard Quickstart.

NOTE: The custom enclosure was designed for the Swan to be soldered directly to the Notecarrier-F without the headers (to minimize the profile).

CO2 Sensor

The CO2 sensor has a breakout board that provides communication via UART, and comes with a prelabeled 4-pin UART connector (5V, GND, TX, RX).

CO2 breakout board

For more information, please review the product Wiki .

OLED Display

The OLED display is powered and updated via the Qwiic connector. Connect directly to the Qwiic connector on the Swan.

For more information, please review the product page .

Speaker

The speaker has a three pin connector (GND,Vcc,Signal). The signal is generated using any pin compatible with the Arduino tone() API.

CO2 breakout board

For more information, please review the product Wiki .

Button

The button is used to request the screen to provide the human readable description of the CO2 ppm value. It will be connected between GND and D13.

Power Supply

A 5V, 2A power supply is sufficient to power all the hardware used in this project. Feed the power into the V+ and GND pins of the Notecarrier-F.

Wiring

CO2 SensorNotecarrier
RXF_RX
TXF_TX
GNDGND
5VVMAIN
SpeakerNotecarrier
GNDGND
VccVMAIN
SignalD12
ButtonNotecarrier
-GND
-D13

TIP: To debounce the button, connect a 47pF capacitor between the legs.

Barrel JackNotecarrier
-GND
+V+

USDA CO2 Table

PPM% of atmosphereSymptoms
50000.5%OSHA Permissible Exposure Limit (PEL) and ACGIH Threshold Limit Value (TLV) for 8-hour exposure
100001.0%Typically no effects, possible drowsiness
150001.5%Mild respiratory stimulation for some people
300003.0%Moderate respiratory stimulation, increased heart rate and blood pressure, ACGIH TLV-Short Term
400004.0%Immediately Dangerous to Life or Health (IDLH)
500005.0%Strong respiratory stimulation, dizziness, confusion, headache, shortness of breath
800008.0%Dimmed sight, sweating, tremor, unconsciousness, and possible death

Notehub Setup

In order to push data from the Notecard to the cloud, you need to sign up for a free account on notehub.io and create a new project.

Arduino Code

note-arduino

Blues provides an Arduino SDK for the Notecard.

SmartCO2Sensor.cpp

The sketch loops infinitely, messuring the CO2 concentration and evaluating it against the USDA thresholds as well as the alarm level. A Note is added to the data.qo Notefile in this format:

{
    "co2": 963,
    "temp": 28.625,
    "voltage": 5.149829688002166
}

co2 is the detected CO2 concentration in parts per million. temp is the temperature of the MCU on the Notecard. The temperature is impacted by the utilization of the MCU, but it can still provide a coarse grained representation of the ambient air temperature. voltage is the power measured on V+, which is provided to the CO2 sensor and speaker.

Environment Variables

There are three environment variables you may wish to configure:

  • alarm_threshold: This is the ppm value where the alarm should trigger.
  • wifi_ssid: The Notecard WBNAW has a built-in Wi-Fi antenna. It will connect via cellular out of the box, but if Wi-Fi ssid and password are provided, then it will prefer to connect over Wi-Fi. You are able to test and deploy this device in separate locations without having to recompile the firmware.
  • wifi_password: The Wi-Fi password used to update the current configuration.

To change these values, go to your Notehub project, find the device you wish to update. Click into the device detail page, then click the Environment tab. Now, enter your desired values and click Apply Changes:

Setting environment variables

The next time data is synced to the Notecard, the environment variables will update on the Notecard.

Updating SmartCO2Sensor.cpp

Before compiling SmartCO2Sensor.cpp, uncomment the following line:

// #define PRODUCT_UID "com.my-company.my-name:my-project"

Replace com.my-company.my-name:my-project with the ProductUID of the Notehub project you created in Notehub Setup.

Notehub Events

To see the data.qo Notes on Notehub, navigate to your project page and click the Events tab on the left-hand side. Here, you should see data.qo Notes with their speeds and timestamps in the Body column.

Blues Community

We’d love to hear about you and your project on the Blues Community Forum !

On This Page

  • Overview
  • You Will Need
  • Hardware Setup
    • Notecard and Notecarrier
    • CO2 Sensor
    • OLED Display
    • Speaker
    • Button
    • Power Supply
    • Wiring
  • USDA CO2 Table
  • Notehub Setup
  • Arduino Code
    • note-arduino
    • SmartCO2Sensor.cpp
  • Notehub Events
  • Blues Community

Resources

  • GitHub
  • Request More Info
© 2025 Blues Inc.
© 2025 Blues Inc.
TermsPrivacy
Notecard Disconnected
Having trouble connecting?

Try changing your USB cable as some cables do not support transferring data. If that does not solve your problem, contact us at support@blues.com and we will get you set up with another tool to communicate with the Notecard.

Advanced Usage

The help command gives more info.

Connect a Notecard
Use USB to connect and start issuing requests from the browser.
Try Notecard Simulator
Experiment with Notecard's latest firmware on a Simulator assigned to your free Notehub account.

Don't have an account? Sign up