One of the key differences between analog and digital sensors is their output resolution. For example, analog sensors provide infinite resolution since they provide a continuous range of values, while digital sensors have a finite resolution determined by the number of bits used to represent the signal. Another difference is the susceptibility to noise. Analog
How to Build a DIY CO2 Meter with Arduino
Share This Post
In this tutorial, we will show you how to make a benchtop-style CO2 meter using our EZO-CO2™ Embedded Carbon Dioxide Sensor connected to an Arduino Uno. The real-time readings will be shown on a liquid crystal display (LCD) in PPM. Both the sensor and display are connected to the Arduino via I2C.
This device was developed and tested using a Windows computer. It was not tested on Mac.
This CO2 sensor is for gaseous CO2 only, do not submerge!
Before we begin have the following items readily available
- 1x Arduino Uno
- 1x Atlas Scientific EZO-CO2™ Embedded Carbon Dioxide Sensor
- 1x Atlas Scientific Sensor Bridge
- 1x 16 x 2 LCD Module
- 1x Adafruit i2c / SPI character LCD backpack
- 1x 158 x 90 x 60 mm enclosure
- 1x USB cable type A – B male/male
- 1x 12V power supply
- 4x male to female jumper wires
- 4x male to male jumper wires
- 3x 11mm standoffs with screws
Hand tools and fabrication machines used
Below is a list of tools we used for this tutorial. You do not need to have ALL these tools, although they will greatly speed up the process.
- Drill press
- (1/4″, 7/64″) drill bits
- (1″ 1/16″) annular cutter
- Milling machine
- (1/8″) endmill
- Solder iron & solder
- Hand files
- Phillips-head screwdriver
- Painters tape
- Sharpie marker
1. Prepare the enclosure
Safety: Remember to take care when handling tools/machinery and to wear proper safety gear such as goggles, gloves, and respirators.
Opening for the LCD
a) The LCD is placed in the top portion of the enclosure. Cover the surface with painters tape and center a (71 x 24mm) rectangle on it.
b) Using a 1/8″ endmill, cut just on the inside of the drawn rectangle as close to the line as possible.
c) With a hand file, remove the excess material and shape the opening to the required size.
Openings for the Arduino’s USB and power jack
a) Cover one of the long sides on the bottom portion of the enclosure with painters tape. Mark off the locations for the USB and power jack.
b) With the 1/8″ endmill, cut within the outline of the two rectangles.
c) Use a hand file to remove the excess material and shape the opening to the required size.
Opening for CO2 sensor
a) On the same side as the Arduino ports, mark off the spot for the CO2 sensor and drill a (1/4″) pilot hole.
b) Using a (1″ 1/16″) annular cutter, cut the hole for the CO2 sensor.
Holes for standoffs
a) Mark the locations for the three 11mm standoffs.
b) Use a (7/64″) drill bit to bore the holes.
Now that the enclosure is complete, let’s move on to the
2. Solder I2C backpack to display
Since the I2C backpack is a separate component, solder it onto the pins of the LCD as shown below.
3. Set CO2 sensor to I2C mode
By default, the CO2 sensor comes in UART mode. You will need to set it to I2C mode at the default address of 105 for this project.
Refer to the datasheet on how to change modes.
4. Install and wire components in the enclosure
a) Attach the three 11mm standoffs.
b) Mount the Arduino into place and secure it to standoffs with screws.
c) Add the sensor bridge and secure it with a screw.
d) Connect the sensor bridge to the Arduino using the male-to-male jumper wires as shown in the wiring diagram.
e) Next, install the CO2 sensor using a (3/4″ NPT) locknut and O-ring and plug the data cable into the sensor bridge. Be sure to align the white and blue wires of the data cable with the corresponding labels on the bridge.
f) Insert the LCD into the enclosure’s cover. (You can use some hot glue to help hold it in place).
g) Connect the LCD to the sensor bridge using the male to female jumper wires following the wiring diagram.
h) Using the A – B male/male USB cable, connect the Arduino Uno to your computer and open the Arduino IDE software. It’s time to get the code onto the Arduino.
Make sure your Arduino IDE libraries are up to date
Add the EZO I2C library
To download the Ezo_I2c library file, click HERE.
Click on the green “Code” button, then click “Download Zip” as shown in the image below
*Don’t unzip this file!
Import the.ZIP file to your Arduino IDE. To import the.ZIP file go to Sketch > Include Library > Add.ZIP Library
Install the Adafruit Liquid Crystal library
In the IDE go to Sketch > Include Library > Manage Libraries
Lookup “Adafruit LiquidCrystal” in the search bar of the Library Manager
Click on Install
Flash Arduino with the code
a) Open the code by going to File > Examples > EZO_I2C_lib-master > Examples > Projects > arduino_co2_meter
b) Set the target CPU to flash: Tools > Board > Arduino AVR Boards > Arduino Uno
c) Select the port to which your Arduino is connected: Tools > Port > COM “X”
(comport address will change from user to user)
d) Compile and flash the code to the Arduino. Once completed you should see the CO2 readings on your serial monitor (append carriage return only and set the baud rate to 9600) as well as the LCD. Adjust the screen contrast of the display as needed using the nob on the i2c backpack.
a) Unplug the device from your computer and screw the top and bottom portions of the enclosure together to complete the assembly.
b) You can now power the meter with an external 12V barrel jack supply. Congratulations, you now have a benchtop Co2 Meter ready to go!
Products used in this tutorial
Subscribe To Our Newsletter
Get product updates and learn from the best!
More To Explore
Pros of hydroponics include efficient water use, faster growth rates, and the ability to grow crops in limited spaces. However, cons may involve higher initial setup costs, the need for technical expertise, and a reliance on artificial lighting and climate control. Also, many argue that hydroponically grown produce may lack certain flavors or nutrients compared