Arduino library for CozIR Ambient CO2 sensors
The CozIR Ambient family of sensors all provide CO2 measurements, at different ranges. Some are able to measure temperature and relative humidity as well. The sensors use serial UART and analog voltage output.
This library has been developed using a CozIR Ambient 0-5000 ppm CO2 (only) sensor and an Arduino UNO R3 board.
Milestone | Features | Version | Status |
---|---|---|---|
Beta | Basic reading | 0.x.x | โ๏ธ |
Launch | Modes, settings | 1.x.x | |
Sensors | Range, CO2, relative humidity, temperature | 2.x.x | |
Boards | Arduino UNO, Due, MEGA | 3.x.x |
Add the following line to use this libraray:
#include <AmbientCO2.h>
Name | Parameters | Returns | Description |
---|---|---|---|
AmbientCO2() | Stream &serial | void | Constructor |
begin() | none | void | Sensor setup |
getCO2() | none | int | Reads CO2 concentration in PPM |
From SoftwareSerial reference: If using multiple software serial ports, only one can receive data at a time.
- Open Tools -> Manage Libraries... in Arduino IDE
- Search for AmbientCO2
- Install latest version
- Download library zip file from GitHub, and extract it
- Rename resulting folder from AmbientCO2-master to AmbientCO2
- Move folder AmbientCO2 into the Arduino IDE libraries folder
- Restart Arduino IDE, if running
- Examples are available under File -> Examples -> AmbientCO2 in Arduino IDE
- Change rxPin and txPin in the sketch to match board setup
- Connect GND, 3.3V, rxPin and txPin between board and sensor (see User's Manual, page 7, for sensor pinout)
Board | Sensor |
---|---|
GND | Pin 1 |
3.3V | Pin 3 |
rxPin | Pin 7 |
txPin | Pin 5 |
- Upload sketch
- Open Serial Monitor or Serial Plotter in Arduino IDE