{"id":19738400,"url":"https://github.com/sensirion/raspberry-pi-i2c-sen5x","last_synced_at":"2025-06-13T21:02:02.841Z","repository":{"id":50534955,"uuid":"444758278","full_name":"Sensirion/raspberry-pi-i2c-sen5x","owner":"Sensirion","description":"C driver to work with Sensirion's SEN5x environmental sensor modules via I2C","archived":false,"fork":false,"pushed_at":"2024-07-31T08:52:18.000Z","size":968,"stargazers_count":24,"open_issues_count":0,"forks_count":11,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-05T22:51:15.545Z","etag":null,"topics":["all-in-one","driver","environmental","evaluation-kit","i2c","module","nox","particulate-matter","raspberry-pi","relative-humidity","sek","sen54","sen55","sen5x","sensirion","sensor","temperature","voc"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Sensirion.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2022-01-05T10:19:35.000Z","updated_at":"2025-03-18T02:18:03.000Z","dependencies_parsed_at":"2024-05-13T14:12:46.556Z","dependency_job_id":"3e5e0661-4f7c-4317-b6cb-067fed15f189","html_url":"https://github.com/Sensirion/raspberry-pi-i2c-sen5x","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sensirion%2Fraspberry-pi-i2c-sen5x","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sensirion%2Fraspberry-pi-i2c-sen5x/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sensirion%2Fraspberry-pi-i2c-sen5x/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sensirion%2Fraspberry-pi-i2c-sen5x/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Sensirion","download_url":"https://codeload.github.com/Sensirion/raspberry-pi-i2c-sen5x/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251648785,"owners_count":21621415,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["all-in-one","driver","environmental","evaluation-kit","i2c","module","nox","particulate-matter","raspberry-pi","relative-humidity","sek","sen54","sen55","sen5x","sensirion","sensor","temperature","voc"],"created_at":"2024-11-12T01:14:06.867Z","updated_at":"2025-04-30T05:31:21.214Z","avatar_url":"https://github.com/Sensirion.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sensirion Raspberry Pi I2C SEN5x Driver\n\nThis document explains how to set up the Sen5x sensor to run on a Raspberry Pi using the provided code.\n\n\u003ccenter\u003e\u003cimg src=\"images/SEN5x.png\" width=\"500px\"\u003e\u003c/center\u003e\n\n## Supported sensors\n\n- SEN50 (only particulate matter signals available)\n- SEN54 (no NOx signal available)\n- SEN55 (full feature set)\n\n## Setup Guide\n\n### Connecting the Sensor\n\nYour sensor has the five different connectors: VCC, GND, SDA, SCL, SEL (the sixth connector will not be used for now).\nUse the following pins to connect your SEN5x:\n\n *SEN5x*  |    *Raspberry Pi*           |   *Jumper Wire*   |\n :------: | :-------------------------: | :---------------: |\n   VCC    |        Pin 2 (5V)           |   Red             |\n   GND    |        Pin 6                |   Black           |\n   SDA    |        Pin 3                |   Green           |\n   SCL    |        Pin 5                |   Yellow          |\n   SEL    |        Pin 9 (GND for I2C)  |   Blue            |\n\n\u003ccenter\u003e\u003cimg src=\"images/GPIO-Pinout-Diagram.png\" width=\"900px\"\u003e\u003c/center\u003e\n\n\u003ccenter\u003e\u003cimg src=\"images/SEN5X_pinout.png\" width=\"300px\"\u003e\u003c/center\u003e\n\n| *Pin* | *Name* | *Description*                   | *Comments*                       |\n|-------|--------|---------------------------------|----------------------------------|\n| 1     | VCC    | Supply Voltage                  | 5V ±10%\n| 2     | GND    | Ground                          |\n| 3     | SDA    | I2C: Serial data input / output | TTL 5V and LVTTL 3.3V compatible\n| 4     | SCL    | I2C: Serial clock input         | TTL 5V and LVTTL 3.3V compatible\n| 5     | SEL    | Interface select                | Pull to GND to select I2C\n| 6     | NC     | Do not connect                  |\n\n### Raspberry Pi\n\n- [Install the Raspberry Pi OS on to your Raspberry Pi](https://projects.raspberrypi.org/en/projects/raspberry-pi-setting-up)\n- [Enable the I2C interface in the raspi-config](https://www.raspberrypi.org/documentation/configuration/raspi-config.md)\n- Download the driver for the [Sensirion Github Page](https://github.com/Sensirion/raspberry-pi-i2c-sen5x) and extract the `.zip` on your Raspberry Pi\n- Compile the driver\n    1. Open a [terminal](https://www.raspberrypi.org/documentation/usage/terminal/?)\n    2. Navigate to the driver directory. E.g. `cd ~/raspberry-pi-i2c-sen5x`\n    3. Run the `make` command to compile the driver\n\n       Output:\n       ```\n       rm -f sen5x_i2c_example_usage\n       cc -Os -Wall -fstrict-aliasing -Wstrict-aliasing=1 -Wsign-conversion -fPIC -I. -o sen5x_i2c_example_usage  sen5x_i2c.h sen5x_i2c.c sensirion_i2c_hal.h sensirion_i2c.h sensirion_i2c.c \\\n           sensirion_i2c_hal.c sensirion_config.h sensirion_common.h sensirion_common.c sen5x_i2c_example_usage.c\n       ```\n- Test your connected sensor\n    - Run `./sen5x_i2c_example_usage` in the same directory you used to\n      compile the driver.\n\n      Output:\n      ```\n      Serial number: 213100019\n      Product name: \n      Firmware: 1.0, Hardware: 4.0\n      Mass concentration pm1p0: 0.0 µg/m³\n      Mass concentration pm2p5: 0.0 µg/m³\n      Mass concentration pm4p0: 0.0 µg/m³\n      Mass concentration pm10p0: 0.0 µg/m³\n      Ambient humidity: 39.6 %RH\n      Ambient temperature: 28.0 °C\n      Voc index: 0.0\n      Nox index: 0.0\n      Mass concentration pm1p0: 0.0 µg/m³\n      Mass concentration pm2p5: 0.0 µg/m³\n      Mass concentration pm4p0: 0.0 µg/m³\n      Mass concentration pm10p0: 0.0 µg/m³\n      Ambient humidity: 39.2 %RH\n      Ambient temperature: 30.1 °C\n      Voc index: 0.0\n      Nox index: 0.0\n      ...\n      ```\n    \n    - Wait a few minutes until Voc/NOx index values are stable.\n\n## Troubleshooting\n\n### Building driver failed\n\nIf the execution of `make` in the compilation step 3 fails with something like\n\n\u003e -bash: make: command not found\n\nyour RaspberryPi likely does not have the build tools installed. Proceed as follows:\n\n```\n$ sudo apt-get update\n$ sudo apt-get upgrade\n$ sudo apt-get install build-essential\n```\n\n### Initialization failed\n\n-   Ensure that you connected the sensor correctly: All cables are fully\n    plugged in and connected to the correct pin.\n-   Ensure that I2C is enabled on the Raspberry Pi. For this redo the steps on\n    \"Enable the I2C interface in the raspi-config\" in the guide above.\n-   Ensure that your user account has read and write access to the I2C device.\n    If it only works with user root (`sudo ./sen5x_i2c_example_usage`), it's\n    typically due to wrong permission settings. See the next chapter how to solve this.\n\n### Missing I2C permissions\n\nIf your user is missing access to the I2C interface you should first verfiy\nthe user belongs to the `i2c` group.\n\n```\n$ groups\nusers input some other groups etc\n```\nIf `i2c` is missing in the list add the user and restart the Raspberry Pi.\n\n```\n$ sudo adduser ${USER} i2c\nAdding user `pi' to group `i2c' ...\nAdding user pi to group i2c\nDone.\n$ sudo reboot\n```\n\nIf that did not help you can make globally accessible hardware interfaces\nwith a udev rule. Only do this if everything else failed and you are\nreasonably confident you are the only one having access to your Pi.\n\nGo into the `/etc/udev/rules.d` folder and add a new file named\n`local.rules`.\n```\n$ cd /etc/udev/rules.d/\n$ sudo touch local.rules\n```\nThen add a single line `ACTION==\"add\", KERNEL==\"i2c-[0-1]*\", MODE=\"0666\"`\nto the file with your favorite editor.\n```\n$ sudo vi local.rules\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsensirion%2Fraspberry-pi-i2c-sen5x","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsensirion%2Fraspberry-pi-i2c-sen5x","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsensirion%2Fraspberry-pi-i2c-sen5x/lists"}