Ino Getting Started - Infineon/pas-co2-sensor GitHub Wiki
Overview
In this quick tutorial we will go through one of the PAS CO2 sensor examples available using the Shield2Go or the Miniboard and the XMC microcontroller family in Arduino.
Required experience
- Experience level: beginner
- Basic computer user level
- Basic programming skills (C/C++)
- Basic soldering skills (recommended)
Required Hardware
Name | Picture |
---|---|
PAS CO2 Sensor Shield2Go (Coming soon) | |
or PAS CO2 Miniboard | |
XMC 2Go | |
Pin headers (included with the boards) | |
Micro-USB to USB A cable |
Required Software
- Windows 10
- Segger J-Link
- Arduino IDE
- XMC-for-Arduino (Installed with Arduino IDE)
- This library (Installed with Arduino IDE)
Tutorial
Software Installation
-
Install Arduino IDE. If you are new to Arduino, please download the program and install it first.
-
Install XMC Board. The official Arduino boards are already available in the Arduino software, but other third party boards as the Infineon XMC MCU based need to be explicitly included. Follow the instructions in the link to add the XMC board family to Arduino.
-
Install the library. In the Arduino IDE, go to the menu Sketch > Include library > Library Manager. Type pas-co2-sensor and install the library.
Hardware Setup
For this example we are going to use the I2C serial interface.
A. Shield2Go
If you are using the PAS CO2 Sensor Shield2Go, it just need to be stacked on the XMC 2Go microcontroller board. Be sure that that the corresponding solder jumper are set for I2C mode, and PSEL is pulled to GND. Check the Shield2Go Manual (Coming soon) for complete details.
Then, simply connect it to the computer with the USB cable.
B. Miniboard
In order to use the I2C interface we need to add a 10 Kohm pull-up resistors to the SDA and SCL lines, and a 12VDC voltage needs to be additionally provided to VDD12V pin. Connect the boards as shown in the following diagram:
Then, simply connect it to the computer with the USB cable.
Note :warning: : If the pin headers provided are not press-fit you will need to solder them on the corresponding boards. Otherwise, use your preferred way of connecting the hardware.
Ready To Go!
With everything ready now, we are going to upload and run one of the library examples.
-
Select the board.
Once installed, you can select the one of the supported board from the menu Tools > Board:... and configure its parameters.
Then we simply need to install the library to use it in your project:
-
Include it in your sketch. With the library installed in the Arduino IDE, you can include it from the menu "Sketch > Include Library > pas-co2-sensor". The header
#include <pas-co2-serial-ino.hpp>
will be added to your sketch. You can also open and test one of the examples provided in File > Examples > pas-co2-sensorOpen one of the examples: File > Examples > pas-co2-sensor > serial-periodic.
After selecting the board (Tools > Board > XMC1100 2Go*), and the proper COM port ( Tools > Port), the example sketch can be verified and uploaded to the target .
Finally, we can check the monitor output . Do not forget to select the proper baudrate. You can blow in the sensor to see how the CO2 values change :)
What's next!?
This is just the start :rocket: !
Find out more about the available API functions in the source code for the Serial API and Pulse API in the header files pas-co2-serial-ino.hpp
and pas-co2-serial.hpp
, and pas-co2-pulse-ino.hpp
and pas-co2-pulse.hpp
files respectively under the src
folder.
The corresponding .cpp
files include Doxygen comments with the description and usage of each function, which is also available in html here.
And of course, don't forget to check out the available Arduino examples under the examples
folder.