ENTRY2 - Connecting PAS CO2 Sensor - Connect things with code!
Fun with the Infineon Ecosystem
This project was created to participate in the Challenge Connect things with code
For this this project my idea is to connect a Sensor the EVAL PASCO2 MINIBOARD to the PSoC 62S2 evaluation kit
Components used in this project:
MCU: Infineon PSoC® 6 WiFi-BT Pioneer Kit (CY8CKIT-062S2-43012)
Sensor: EVAL PASCO2 MINIBOARD
- Infineon PSoC® 6 WiFi-BT Pioneer Kit (CY8CKIT-062S2-43012)
- EVAL PASCO2 MINIBOARD
- CO₂ sensor
- Infineon-programming_guide_PAS_CO2_evaluationkit-Application
- There is an example of connecting the PAS CO2 sensor to the PSoC6 WiFi-BT Pioneer Kit.
- The pins are different from mine. Must be an old version of the DK?
- Here is the wiring diagram.
- HOW DO I SUPPLY 12v TO THE SENSOR?
- Answer:
- Use a 12 volt electric razor charger.
- I’ll need to connect the 5 pins to my Infineon PSoC® 6 WiFi-BT Pioneer Kit (CY8CKIT-062S2-43012) and the pins are slightly different.On the CY8CKIT-062S2043012, The I2C pins are available on J3 - Pin 10 (SCL) and Pin 9 (SDA). There are 4.7K pull ups on these pins. (These are the equivalent pins on the Arduino compatible headers as the PSoC 6 WiFi-BT Pioneer kit shown in the PAS_CO2 application notes.).
- I used the knowledge from this wiring diagram and the help from the discord Infenion Moderator cjarvis_40542, to wire up the connection.
- Ok, now that I have attained a better understanding on how to wire the Co2 sensor to my PSoC® 6 WiFi-BT Pioneer Kit (CY8CKIT-062S2-43012), it’s time to connect it.
- This section contains the wiring diagram I drew to make all the connections.
- I used the following components that are included in the diagram
- My PS0C 6 WiFi-BT Pioneer Kit
- 1x Breadboard
- Various jumper wires.
- 12v electric shaver charging adapter
- Alligator clip jumper wires (alligator clip to male)
- 2x nails connecting(used to form conductor terminals at the end of my 12V charger.)
- WIring Diagram
- Here is what I came up with for connecting the Co2 sensor:
- Here is a pictorial of the connections
This photo shows the nails placed into the Positive (RED clip) and Negative (GREEN clip) of the female end of the charger to create connectors to attach the alligator clips.
I'm using the Modustoolbox 3.1 Toolchain to develop firmware to test and run a test on the wiring diagram. I first went to the document for a firmware solution, but the solution did not use Modustoolbox, so in a second attempt I found a library for the CO2 sensor on the github infineon Repo.
- I'm using the Modustoolbox 3.1 Toolchain to develop firmware to test and run a test on the wiring diagram. I first went to the document for a firmware solution, but the solution did not use Modustoolbox, so in a second attempt I found a library for the CO2 sensor on the github infineon Repo.
- The following section describes what I discovered and my final results to use Modustoolbox to get an example to run.
- The programming guide at Infineon-programming_guide_PAS_CO2_evaluationkit-Application demonstrates how to use the CO2 sensor with an arduino and the PSoC6. Unfortunately it does not demonstrate how to use the sensor with Modustoolbox
- The guide explains how to use the Bridge Control Panel, which is a simple debugging tool that comes with PSoC Programmer. Bridge Control Panel is not provided or used directly with ModusToolbox. It is a separate tool that is available within the PSoC Programming installation. PSoC Programmer is also not required by ModusToolbox. All the programming capabilities needed by ModusToolbox and built into the installation. The Bridge Control Panel is being used as just a manual test application to send I2C commands directly to the PAS CO2 sensor to power it on and initialize it. In a real application these will be part of the source code that initializes and interfaces with the CO2 sensor.but not with MODUSTOOLBOX
- You do not need to use or install PSoC Programmer to get ModusToolbox or the CO2 sensor working. You can install it, if you'd like to test out sending commands manually via the I2C interface.
- I needed to find some answers on how to program the CO2 sensor from Modustoolbox. Is there an example using Modustoolbox, the PSoC 6 EVK, and the CO2 sensor, that demonstrates an implementation? Is there a way of USING ModusToolbox to write firmware like the Arduino example? Can I use the Arduino example to mimic it using the SDK (PDL, )
- I found a library example on the infineon github repo. Just search for “pas co2 sensor”. Here is the example
- GITHUB REPO: sensor-xensiv-pasco2
- This library provides APIs to interface with the PAS CO2 sensor that allows firmware to read the CO2 concentration.
- This is perfect. Just what I needed.
- I cloned the file to my PC zip archive.
- I read the README file on the Repo and on step2 iit indicated
- “2.Add this library, i.e. sensor-xensiv-pasco2, to the application using the Library. With the following screenshot.
- At the Time I could not find the pasco2 library? Sensor-xensiv-pasco2 library under “Peripheral”?.I
SIDEBAR: it turns out I should have gone to the Library manager and added a library and it would have been under t
- I just copied the c and h files from the Github zip archive. Then I replaced the code in main.c with the suggested code in the README doc.
- Built the application. It was built fine.
- No move on to the next section if you have the wiring done. If not then go back to the section above “Connect it - My 2nd attempt”.
- IMPORTANT !!! Before adding any power BE SURE TO FOLLOW the following Initialization sequence.You need to supply power to the PSoC 6 kit before plugging in the 12V power supply.
- Set up the terminal program on your desktop. I used TeraTerm and set it up as per instructions in the README file.
- Launch it and debug the code. it will stop in main. You should see the title in the terminal program on your desktop. At this point you can step through the code to understand how it is worki
- Here is a pictorial view of my results
- Reading the CO2 concentration values
I kept this running for several days. I received various value ranges depending on the weather (temprature and humidity) outside.
CONCLUSIONS & TAKEAWAYS- I was able to connect the Co2 Sensor to my PSOC6 MCU.
- I was able to install a library that provides APIs to interface with the PAS CO2 sensor that allows firmware to read the CO2 concentration.
- I was able to use firmware to call this library and read CO2 concentration levels in 2 places in my home My office and My basemeent
OFFICE – Windows open value range: 420-550
OFFICE –Windows CLOSED and Central air on value range: 737-900
Basement - windows open value range: 800-920
Basement - windows closed value range: 400-900
- Since there was a well supported library for Both ModusToolbox and Arduino IDE, there was no reason to create a library for this sensor. Instead I experimented with the Library using ModusToolbox
Thank you for reading through my project. It was fun. Please comment on your thoughts.
BACK to the introduction blog for this challenge Unleashing the Power of the Infineon Ecosystem
Comments