{"id":19738429,"url":"https://github.com/sensirion/raspberry-pi-i2c-scd30","last_synced_at":"2025-04-30T05:31:27.078Z","repository":{"id":65385514,"uuid":"481136028","full_name":"Sensirion/raspberry-pi-i2c-scd30","owner":"Sensirion","description":"Raspberry-Pi I2C driver for Sensirion's SCD30 sensor","archived":false,"fork":false,"pushed_at":"2024-05-13T13:00:43.000Z","size":270,"stargazers_count":10,"open_issues_count":0,"forks_count":3,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-05-14T14:13:13.673Z","etag":null,"topics":["co2","co2-sensor","driver","humidity","i2c","raspberry-pi","sensirion","temperature"],"latest_commit_sha":null,"homepage":"https://sensirion.com/products/catalog/SCD30/","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}},"created_at":"2022-04-13T08:35:42.000Z","updated_at":"2024-05-14T05:48:13.000Z","dependencies_parsed_at":"2023-01-21T06:45:45.988Z","dependency_job_id":null,"html_url":"https://github.com/Sensirion/raspberry-pi-i2c-scd30","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sensirion%2Fraspberry-pi-i2c-scd30","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sensirion%2Fraspberry-pi-i2c-scd30/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sensirion%2Fraspberry-pi-i2c-scd30/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sensirion%2Fraspberry-pi-i2c-scd30/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Sensirion","download_url":"https://codeload.github.com/Sensirion/raspberry-pi-i2c-scd30/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224197821,"owners_count":17271999,"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":["co2","co2-sensor","driver","humidity","i2c","raspberry-pi","sensirion","temperature"],"created_at":"2024-11-12T01:14:10.025Z","updated_at":"2024-11-12T01:14:10.959Z","avatar_url":"https://github.com/Sensirion.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sensirion Raspberry Pi I2C SCD30 Driver\n\nThis document explains how to set up a  SCD30 sensor to run on a Raspberry Pi\nusing the provided code.\n\n\u003ccenter\u003e\u003cimg src=\"images/sensor_scd30_image.jpg\" width=\"300px\"\u003e\u003c/center\u003e\n\nClick [here](https://sensirion.com/products/catalog/SCD30/) to learn more about the Sensirion SCD30 sensor.\n\n\n\nThe default I²C address of [SCD30](https://sensirion.com/products/catalog/SCD30/) is **0x61**.\n\n\n\n## Setup Guide\n\n### Connecting the Sensor\n\nYour sensor has the 5 different connectors: VDD, GND, SCL, SDA, SEL.\nUse the following pins to connect your SCD30:\n\n| *SCD30* | *Cable Color*  |   *Raspberry Pi*   |\n| :----------------: | -------------- | ------------------ |\n| VDD | red | Pin 1\n| GND | black | Pin 6\n| SCL | yellow | Pin 5\n| SDA | green | Pin 3\n| SEL | blue | Pin 9\n\n\n\u003cimg src=\"images/raspi-i2c-pinout-3.3V-SEL.png\" width=\"400px\"\u003e\n\n\n#### Detaild sensor pinout\n\n\u003cimg src=\"images/scd30_pinout.jpg\" width=\"300px\"\u003e\n\n| *Pin* | *Cable Color* | *Name* | *Description*  | *Comments* |\n|-------|---------------|:------:|----------------|------------|\n| 1 | red |VDD | Supply Voltage | 3.3 to 5.5V\n| 2 | black |GND | Ground | \n| 3 | yellow |SCL | I2C: Serial clock input | \n| 4 | green |SDA | I2C: Serial data input / output | \n| 5 |  |RDY | High when data is available | do not connect\n| 6 |  |PWM |  | do not connect\n| 7 | blue |SEL | Interface select | Pull to ground or floating for I2C\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 I²C interface in the raspi-config](https://www.raspberrypi.org/documentation/configuration/raspi-config.md)\n- Download the SCD30 driver from [Github](https://github.com/Sensirion/raspberry-pi-i2c-scd30) and extract the `.zip` on your Raspberry Pi\n\n- Compile the driver\n    1. Open a [terminal](https://www.raspberrypi.com/documentation/computers/using_linux.html#terminal)\n    2. Navigate to the driver directory. E.g. `cd ~/raspberry-pi-i2c-scd30`\n    3. Run the `make` command to compile the driver\n\n       Output:\n       ```\n       rm -f scd30_i2c_example_usage\n       cc -Os -Wall -fstrict-aliasing -Wstrict-aliasing=1 -Wsign-conversion -fPIC -I. -o scd30_i2c_example_usage  scd30_i2c.h scd30_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 scd30_i2c_example_usage.c\n       ```\n- Test your connected sensor\n    - Run `./scd30_i2c_example_usage` in the same directory you used to\n      compile the driver. You should see the measurement values in the console.\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```bash\n make: command not found\n```\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\n### Initialization failed\n\nIf you run `./scd30_i2c_example_usage` but do not get sensor readings but something like this instead\n\n```\nError executing soft_reset(): -1\nError executing read_firmware_version(): -1\nError executing start_periodic_measurement(): -1\n...\n```\nthen go through the below troubleshooting steps.\n\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 I²C is enabled on the Raspberry Pi. For this redo the steps on\n    \"Enable the I²C interface in the raspi-config\" in the guide above.\n-   Ensure that your user account has read and write access to the I²C device.\n    If it only works with user root (`sudo ./scd30_i2c_example_usage`), it's\n    typically due to wrong permission settings. See the next chapter how to solve this.\n\n### Missing I²C permissions\n\nIf your user is missing access to the I²C 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 your-user i2c\nAdding user `your-user' to group `i2c' ...\nAdding user your-user 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\nreasoably 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\n## Contributing\n\n**Contributions are welcome!**\n\nWe develop and test this driver using our company internal tools (version\ncontrol, continuous integration, code review etc.) and automatically\nsynchronize the master branch with GitHub. But this doesn't mean that we don't\nrespond to issues or don't accept pull requests on GitHub. In fact, you're very\nwelcome to open issues or create pull requests :)\n\nThis Sensirion library uses\n[`clang-format`](https://releases.llvm.org/download.html) to standardize the\nformatting of all our `.c` and `.h` files. Make sure your contributions are\nformatted accordingly:\n\nThe `-i` flag will apply the format changes to the files listed.\n\n```bash\nclang-format -i *.c *.h\n```\n\nNote that differences from this formatting will result in a failed build until\nthey are fixed.\n\n\n## License\n\nSee [LICENSE](LICENSE).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsensirion%2Fraspberry-pi-i2c-scd30","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsensirion%2Fraspberry-pi-i2c-scd30","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsensirion%2Fraspberry-pi-i2c-scd30/lists"}