The Green Building Research Lab @ Portland State University Director, Elliott T. Gall www.pdx.edu/green-building 1 Build instructions for Arduino CO 2 Monitor, Logger and Display The following instructions are provided to assist you in developing a CO2 sensor that can: Measure CO 2 levels in air and record it to a memory card Record CO2 according to the frequency you set in a program (i.e., store a value and timestamp every 1 second, every 5 minutes, etc.) Display the current CO 2 level being measured on a LCD screen. o The brightness of the screen can be adjusted with a potentiometer Be powered independently from your computer, that is, can operate from a normal wall outlet Optional: a real-time clock provides a means of measuring the absolute time (useful if you leave the sensor for long periods of time and are trying to interpret your data) It is recommended that before attempting this build you have completed the circuit builds #1 (Blinking and LED), #2 (Reading a potentiometer), and #6 (reading a photoresistor) from the Sparkfun Inventor’s Kit (SIK). While working on this circuit, try to enjoy the process and know that troubleshooting is an important part building circuits and research in general! Even individuals very experienced with microcontrollers and circuits will spend a lot of time debugging – in fact, the debugging process is central to the learning objectives of this exercise, as it embodies problem-solving skills that are best achieved through a methodical isolation of the various components of your system. These are important skills in science and research! Acknowledgements: This project was supported the BUILT Lab Faculty Fellowship program at Portland State University. Many individuals have contributed to the evolution of this project: Craig Lardiere, Kalina Vanderpoel, Samuel Salin, David Pleshakov, and Corey Griffin. Materials Inventory your materials. Between the Sparkfun Inventor’s Kit (SIK) and the bag of CO 2 sensor parts you have received, you should have the following parts necessary for this build: Arduino Pro Mini 328 3.3V/8MHz This is the “brain” of the operation. It works similarly to the RedBoard used for the SIK circuits, but is a little more compact. It’s good to get used to different versions of microcontrollers and see how they are similar and how they are different.
11
Embed
uild instructions for Arduino O Monitor, Logger and … Figure 3. Example layout on half-size breadboard of the CO2 sensor, Arduino pro mini, barrel jack connector, and SD card. A
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
The Green Building Research Lab @ Portland State University Director, Elliott T. Gall www.pdx.edu/green-building
1
Build instructions for Arduino CO2 Monitor, Logger and Display
The following instructions are provided to assist you in developing a CO2 sensor that can:
Measure CO2 levels in air and record it to a memory card
Record CO2 according to the frequency you set in a program (i.e., store a value and timestamp
every 1 second, every 5 minutes, etc.)
Display the current CO2 level being measured on a LCD screen.
o The brightness of the screen can be adjusted with a potentiometer
Be powered independently from your computer, that is, can operate from a normal wall outlet
Optional: a real-time clock provides a means of measuring the absolute time (useful if you leave
the sensor for long periods of time and are trying to interpret your data)
It is recommended that before attempting this build you have completed the circuit builds #1 (Blinking
and LED), #2 (Reading a potentiometer), and #6 (reading a photoresistor) from the Sparkfun Inventor’s
Kit (SIK). While working on this circuit, try to enjoy the process and know that troubleshooting is an
important part building circuits and research in general! Even individuals very experienced with
microcontrollers and circuits will spend a lot of time debugging – in fact, the debugging process is
central to the learning objectives of this exercise, as it embodies problem-solving skills that are best
achieved through a methodical isolation of the various components of your system. These are important
skills in science and research!
Acknowledgements: This project was supported the BUILT Lab Faculty Fellowship program at Portland
State University. Many individuals have contributed to the evolution of this project: Craig Lardiere,
Kalina Vanderpoel, Samuel Salin, David Pleshakov, and Corey Griffin.
Materials Inventory your materials. Between the Sparkfun Inventor’s Kit (SIK) and the bag of CO2 sensor parts you
have received, you should have the following parts necessary for this build:
Arduino Pro Mini 328 3.3V/8MHz This is the “brain” of the operation. It works similarly to the RedBoard used for the SIK circuits, but is a little more compact. It’s good to get used to different versions of microcontrollers and see how they are similar and how they are different.
K-30 10,000ppm CO2 sensor The sensor itself. The sensor contains circuity and onboard firmware out of the box. As we will see, there is also code provided by the manufacturer to read from the sensor. The white enclosure contains the infrared emitter and infrared detector that allow us to observe CO2 levels in air. microSD Transflash breakout and memory card Similar to the SD card in your phone or camera – this provides a means of storing the output from your CO2 sensor, along with a timestamp. The timestamp may be relative (from a counter that counts milliseconds on the Arduino) or from a real-time clock add-on to give absolute time.
Header pins These have likely already been connected to your components for you– but it’s important to know what these are. These are connections that allow you to easily connect components on the breadboard or directly via jumper cables.
DC Barrel jack adapter – breadboard compatible This provides a way to take power from the wall and apply it to your board. Pay attention to the installation and note where positive and negative leads should go! This is shown later in the instructions.
Wall Adapter power supply – 5V DC 2A Arduino has current (A, or amps) and voltage (V or volts) limits for what it can directly power. If you connect your Arduino directly to the DC Barrel Jack (which you will), you’ll need to make sure the input voltage is maximum of between 7-12 V (here it’s 5 V, so we’re good) or you risk frying your board.
FTDI Basic Breakout 3.3V Unlike the RedBoard, the pro mini does not have a permanent USB connection. This part will allow us to connect a USB cable to “talk” to our microcontroller and upload a program for it to run.
Full-size breadboard The SIK provides you a half-size breadboard, which is a little crowded for the build we’re doing here. You have been provided a longer breadboard – you’re welcome to use a smaller one if you prefer! 10K potentiometer A potentiometer is a variable resistor. You will use this potentiometer (similar to SIK Build #2) to vary the voltage powering the LCD that allows the backlight to be adjusted.
220 ohm resistor (or 330 ohm) Needed to provide the correct current to the LCD – you’ll see the wiring diagram later. Note that a 330 ohm resistor will work as well!
2 female-female jumper cables There are two pins on your Arduino Pro Mini that will be much easier to connect to with a female jumper wire. These are the SCL and SDA pins labeled on your Arduino. For now, it’s enough to know that these are essential for communication between your CO2 sensor and the microcontroller via a protocol called I2C (pronounced “eye squared cee”)
Wires as necessary You will also need a number of male jumper wires. These can be obtained from your SIK, your bag of CO2 build parts, or spools of wire and pre-bent jumper cables available to you. This is largely up to you and how you want to lay out your circuit – some people like to be very neat, some people are less concerned about that. It’s better to spend the time and make things neat… You can strip wire from the spools to the exact length you want if you’re very particular. Also note the wire colors are there for your organizational benefit – It is customary to make power red and ground black, but color does not indicate a wire is different from any other (at least for the range of parts were working with here).
LCD display This component will let you see in real-time what your CO2 sensor is doing.
Part 1: Solder header pins onto components for assembly. NOTE: This is here for completion. Soldering has already been done for you! This section is included for
reference so that you are aware of what subsequent references to header pins are and where header
pins are soldered in the circuit. It also should illustrate that if, for example, you are later working on a
new project where you have ordered parts, you may need to conduct some prep work to use them on a
prototyping, solderless breadboard. By “prototyping, solderless breadboard” we mean that we are not
attempting to build a permanent, soldered circuit in this build, but rather want to be able to connect
and disconnect wires and components relatively easily as we build and troubleshoot the circuit.
Solder the header pins
Start with the Arduino Pro-mini. The side pins we want facing down (away from the numbered side) and
the top and middle pins facing up (opposite of previous, see Fig. 1 and 2 for details).