{"id":18346575,"url":"https://github.com/infineon/sensor-xensiv-pasco2","last_synced_at":"2026-02-27T06:04:16.947Z","repository":{"id":43636167,"uuid":"347440439","full_name":"Infineon/sensor-xensiv-pasco2","owner":"Infineon","description":"This library provides APIs to interface with the PAS CO2 sensor that allows user to read the CO2 concentration.","archived":false,"fork":false,"pushed_at":"2025-10-10T21:24:18.000Z","size":2308,"stargazers_count":3,"open_issues_count":4,"forks_count":2,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-11-03T14:25:46.208Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Infineon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-03-13T17:53:32.000Z","updated_at":"2025-10-10T21:24:20.000Z","dependencies_parsed_at":"2022-07-10T19:20:28.473Z","dependency_job_id":null,"html_url":"https://github.com/Infineon/sensor-xensiv-pasco2","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/Infineon/sensor-xensiv-pasco2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Infineon%2Fsensor-xensiv-pasco2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Infineon%2Fsensor-xensiv-pasco2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Infineon%2Fsensor-xensiv-pasco2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Infineon%2Fsensor-xensiv-pasco2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Infineon","download_url":"https://codeload.github.com/Infineon/sensor-xensiv-pasco2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Infineon%2Fsensor-xensiv-pasco2/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29887009,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-27T05:38:26.446Z","status":"ssl_error","status_checked_at":"2026-02-27T05:38:25.235Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["makers"],"created_at":"2024-11-05T21:11:50.894Z","updated_at":"2026-02-27T06:04:16.918Z","avatar_url":"https://github.com/Infineon.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# XENSIV™ PAS CO2 sensor\n\n## Overview\n\nThis library provides functions for interfacing with the XENSIV™ PAS CO2 sensor.\n\nThe sensor features a small form factor with accurate and robust performance at ppm level (±30 ppm ±3% of reading). The XENSIV™ PAS CO2 sensor integrates a photo-acoustic transducer and a microcontroller which runs ppm calculations as well as compensation and configuration algorithms on the PCB.\n\n### Quick start\n\nFor the hardware setup, check the \"Quick start with the PSoC™ 6 Wi-Fi Bluetooth\u0026reg; pioneer kit\" section of the [Programming guide for XENSIV™ PAS CO2 sensor](https://www.infineon.com/cms/de/product/sensor/co2-sensors/#!?fileId=5546d4627600a6bc0176041139e77780).\n\n**Figure 1. XENSIV™ PAS CO2 Sensor2Go kit I2C interface connection to the PSoC™ 6 Wi-Fi Bluetooth\u0026reg; pioneer kit**\n\n![](docs/images/pasco2_i2c_connection.png)\n![](docs/html/pasco2_i2c_connection.png)\n\n\nAlternatively you can use the [CYSBSYSKIT-DEV-01 Rapid IoT Connect Developer Kit](https://github.com/Infineon/TARGET_CYSBSYSKIT-DEV-01) together with the XENSIV™ PAS CO2 Wing Board.\n\n\nDo the following to create a simple application which outputs the CO2 ppm data from the sensor to the UART.\n\n1. Create an empty ModusToolbox application for your board, e.g. CYSBSYSKIT-DEV-01.\n\n2. Add this library, i.e. sensor-xensiv-pasco2, to the application using the Library Manager.\n\n   **Figure 2. Library Manager**\n\n   ![](docs/images/library_manager.png)\n   ![](docs/html/library_manager.png)\n\n3. Add the retarget-io library using the Library Manager.\n\n4. Place the following code in the *main.c* file.\n\n5. Define I2C SDA and SCL as appropriate for your hardware configuration. \n   **Note** If using CYSBSYSDEV-DEV-01 kit and PAS CO2 wingboard, define macro USE_CYSBSYSDEV_KIT_01_WINGBOARD\n\\cond\n\u003cdetails\u003e\n\n\u003csummary\u003ePSOC6\u003c/summary\u003e\n\n```cpp\n#include \"cyhal.h\"\n#include \"cybsp.h\"\n#include \"cy_retarget_io.h\"\n#include \"xensiv_pasco2_mtb.h\"\n\n/*******************************************************************************\n* Macros\n*******************************************************************************/\n#define PIN_XENSIV_PASCO2_I2C_SDA   \tCYBSP_I2C_SDA\n#define PIN_XENSIV_PASCO2_I2C_SCL   \tCYBSP_I2C_SCL\n\n#if defined(USE_CYSBSYSDEV_KIT_01_WINGBOARD)\n/* Output pin for sensor PSEL line */\n#define PIN_XENSIV_PASCO2_PSEL   \t\tP5_3\n/* Output pin for PAS CO2 Wing Board power switch */\n#define PIN_XENSIV_PASCO2_POWER_SWITCH  P10_5\n#endif\n\n#define I2C_MASTER_FREQUENCY        \t(100000U)\n\n/* Wait time for sensor ready (milliseconds) */\n#define WAIT_SENSOR_RDY_MS          \t(2000)\n\n/* The CO2 concentration value acquired by the sensor depends on the external atmospheric pressure.\n   To compensate for this effect, pressure values can be acquired from a pressure sensor such as an\n   Infineon XENSIV\u0026trade; DPS3xx. (https://github.com/Infineon/sensor-xensiv-dps3xx) */\n#define DEFAULT_PRESSURE_REF_HPA        (0x3F7)     /* Default atmospheric pressure to compensate for (hPa) */\n\n/*******************************************************************************\n* Global Variables\n*******************************************************************************/\nstatic cyhal_i2c_t cyhal_i2c;\nstatic xensiv_pasco2_t xensiv_pasco2;\n\nint main(void)\n{\n    cy_rslt_t result = CY_RSLT_SUCCESS;\n\n    /* Initialize the device and board peripherals */\n    result = cybsp_init();\n    CY_ASSERT(result == CY_RSLT_SUCCESS);\n\n    __enable_irq();\n\n    /* Initialize retarget-io to use the debug UART port. */\n    result = cy_retarget_io_init(CYBSP_DEBUG_UART_TX, CYBSP_DEBUG_UART_RX, CY_RETARGET_IO_BAUDRATE);\n    CY_ASSERT(result == CY_RSLT_SUCCESS);\n\n    printf(\"XENSIV PAS CO2 Example\\r\\n\");\n\n    /* Initialize I2C */\n    cyhal_i2c_cfg_t i2c_master_config = {CYHAL_I2C_MODE_MASTER,\n                                         0,\n                                         I2C_MASTER_FREQUENCY};\n\n    result = cyhal_i2c_init(\u0026cyhal_i2c, PIN_XENSIV_PASCO2_I2C_SDA, PIN_XENSIV_PASCO2_I2C_SCL, NULL);\n    CY_ASSERT(result == CY_RSLT_SUCCESS);\n\n    result = cyhal_i2c_configure(\u0026cyhal_i2c, \u0026i2c_master_config);\n    CY_ASSERT(result == CY_RSLT_SUCCESS);\n\n#if defined(USE_CYSBSYSDEV_KIT_01_WINGBOARD)\n    /* Initialize and enable PAS CO2 Wing Board I2C channel communication*/\n    result = cyhal_gpio_init(PIN_XENSIV_PASCO2_PSEL, CYHAL_GPIO_DIR_OUTPUT, CYHAL_GPIO_DRIVE_STRONG, false);\n    CY_ASSERT(result == CY_RSLT_SUCCESS);\n\n    /* Initialize and enable PAS CO2 Wing Board power switch */\n    result = cyhal_gpio_init(PIN_XENSIV_PASCO2_POWER_SWITCH, CYHAL_GPIO_DIR_OUTPUT, CYHAL_GPIO_DRIVE_STRONG, true);\n    CY_ASSERT(result == CY_RSLT_SUCCESS);\n#endif\n\n    cyhal_system_delay_ms(WAIT_SENSOR_RDY_MS);\n\n    /* Initialize PAS CO2 sensor with default parameter values */\n    result = xensiv_pasco2_mtb_init_i2c(\u0026xensiv_pasco2, \u0026cyhal_i2c);\n    if (result != CY_RSLT_SUCCESS)\n    {\n        printf(\"PAS CO2 device initialization error\");\n        CY_ASSERT(0);\n    }\n\n#if defined(USE_CYSBSYSDEV_KIT_01_WINGBOARD)\n    /* Configure PAS CO2 Wing board interrupt to enable 12V boost converter in wingboard */\n    xensiv_pasco2_interrupt_config_t int_config =\n    {\n        .b.int_func = XENSIV_PASCO2_INTERRUPT_FUNCTION_NONE,\n        .b.int_typ = (uint32_t)XENSIV_PASCO2_INTERRUPT_TYPE_LOW_ACTIVE\n    };\n\n    result = xensiv_pasco2_set_interrupt_config(\u0026xensiv_pasco2, int_config);\n    if (result != CY_RSLT_SUCCESS)\n    {\n        printf(\"PAS CO2 interrupt configuration error\");\n        CY_ASSERT(0);\n    }\n#endif\n\n    uint16_t ppm;\n    for (;;)\n    {\n        result = xensiv_pasco2_mtb_read(\u0026xensiv_pasco2, DEFAULT_PRESSURE_REF_HPA, \u0026ppm);\n        if (result == CY_RSLT_SUCCESS)\n        {\n            printf(\"CO2 %d ppm.\\n\", ppm);\n        }\n        cyhal_system_delay_ms(10);\n    }\n}\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003ePSOC Edge\u003c/summary\u003e\n\n\n```cpp\n/*******************************************************************************\n* Header Files\n*******************************************************************************/\n\n#include \"cybsp.h\"\n#include \"retarget_io_init.h\"\n#include \"xensiv_pasco2_edge.h\"\n\n/*******************************************************************************\n* Macros\n*******************************************************************************/\n\n#define DEFAULT_PRESSURE_REF_HPA        (0x3F7)     /* Default atmospheric pressure to compensate\n                                                       for (hPa) */\n\n\nstatic mtb_hal_i2c_t CYBSP_I2C_3V3_hal_obj;\ncy_stc_scb_i2c_context_t CYBSP_I2C_3V3_context;\nstatic xensiv_pasco2_t xensiv_pasco2;\n\nint main(void)\n{\n    cy_rslt_t result = CY_RSLT_SUCCESS;\n\n    /* Initialize the device and board peripherals */\n    result = cybsp_init();\n\n\n    /* Enable global interrupts */\n    __enable_irq();\n\n    /* Initialize retarget-io middleware */\n    init_retarget_io();\n\n\n    Cy_GPIO_Write(CYBSP_CO2_5V_EN_PORT, CYBSP_CO2_5V_EN_PIN, 1u);\n\n    result = Cy_SCB_I2C_Init(CYBSP_I2C_3V3_HW, \u0026CYBSP_I2C_3V3_config, \u0026CYBSP_I2C_3V3_context);\n\n    if (CY_RSLT_SUCCESS != result)\n    {\n        printf(\" Error : I2C initialization failed !!\\r\\n\");\n        handle_app_error();\n    }\n\n\n    Cy_SCB_I2C_Enable(CYBSP_I2C_3V3_HW);\n\n    result = mtb_hal_i2c_setup(\u0026CYBSP_I2C_3V3_hal_obj, \u0026CYBSP_I2C_3V3_hal_config,\n                               \u0026CYBSP_I2C_3V3_context, NULL);\n\n    if (CY_RSLT_SUCCESS != result)\n    {\n        printf(\" Error : I2C setup failed !!\\r\\n\");\n        handle_app_error();\n    }\n\n\n\n    /* Initialize PAS CO2 sensor with default parameter values */\n    result = xensiv_pasco2_mtb_init_i2c(\u0026xensiv_pasco2, \u0026CYBSP_I2C_3V3_hal_obj);\n    if (result != CY_RSLT_SUCCESS)\n    {\n        printf(\"PAS CO2 device initialization error\\r\\n\");\n        handle_app_error();\n    }\n\n\n    uint16_t ppm;\n\n\n    for (;;)\n    {\n        result = xensiv_pasco2_mtb_read(\u0026xensiv_pasco2, DEFAULT_PRESSURE_REF_HPA, \u0026ppm);\n        if (result == CY_RSLT_SUCCESS)\n        {\n            printf(\"CO2 %d ppm.\\r\\n\", ppm);\n        }\n        Cy_SysLib_Delay(10);\n    }\n}\n\n/* [] END OF FILE */\n```\n\n\u003c/details\u003e\n\\endcond\n\n\n6. Connect the board to your PC using the provided USB cable through the KitProg3 USB connector.\n\n7. Open a terminal program and select the KitProg3 COM port. Set the serial port parameters to 8N1 and 115200 baud.\n\n8. Build the application and program the kit. After programming, the application starts automatically.\n\n   **Figure 3. Terminal output on program startup**\n\n   ![](docs/images/example-terminal.png)\n   ![](docs/html/example-terminal.png)\n\n\n### Use the library in your own platform\n\nThe library can be used in your own platform copying following files to your project:\n- *xensiv_pasco2.c*\n- *xensiv_pasco2.h*\n- *xensiv_pasco2_platform.h*\n- *xensiv_pasco2_regs.h*.\n\nThe library depends on platform-specific implementation of functions declared in *xensiv_pasco2_platform.h*:\n\n```cpp\n/* Target platform-specific function to perform I2C write/read transfer. Only needed if using I2C sensor interface */\nint32_t xensiv_pasco2_plat_i2c_transfer(void * ctx, uint16_t dev_addr, const uint8_t * tx_buffer, size_t tx_len, uint8_t * rx_buffer, size_t rx_len);\n\n/* Target platform-specific function to read over UART. Only needed if using UART sensor interface */\nint32_t xensiv_pasco2_plat_uart_read(void *ctx, uint8_t * data, size_t len);\n\n/* Target platform-specific function to write over UART. Only needed if using UART sensor interface */\nint32_t xensiv_pasco2_plat_uart_write(void *ctx, const uint8_t * data, size_t len);\n\n/* Target platform-specific function that waits for a specified time period in milliseconds */\nvoid xensiv_pasco2_plat_delay(uint32_t ms);\n\n/* Target platform-specific function to reverse the byte order (16-bit) */\nuint16_t xensiv_pasco2_plat_htons(uint16_t x);\n\n/* Target platform-specific function that implements a runtime assertion; used to verify the assumptions made by the program and take appropiate actions if assumption is false */\nvoid xensiv_pasco2_plat_assert(int expr);\n```\n\nSee an implementation for the platform-specific functions in *xensiv_pasco2_mtb.c* using the PSoC™ 6 HAL.\n\n### More information\n\n- [PAS CO2 sensor API reference guide](https://infineon.github.io/sensor-xensiv-pasco2/html/index.html)\n- [XENSIV™ PAS CO2 sensor](https://www.infineon.com/cms/en/product/sensor/co2-sensors/)\n- [Connected sensor kit](https://www.infineon.com/connectedsensorkit)\n- [EVAL_PASCO2_MINIBOARD](https://www.infineon.com/cms/en/product/evaluation-boards/eval_pasco2_miniboard)\n- [Infineon Technologies website](https://www.infineon.com)\n- [Infineon Technologies GitHub repos](https://github.com/infineon)\n- [ModusToolbox\u0026trade; software](https://www.cypress.com/products/modustoolbox-software-environment)\n\n---\n© Infineon Technologies AG, 2021-2022.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfineon%2Fsensor-xensiv-pasco2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finfineon%2Fsensor-xensiv-pasco2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfineon%2Fsensor-xensiv-pasco2/lists"}