{"id":19738503,"url":"https://github.com/sensirion/raspberry-pi-uart-sfx6xxx","last_synced_at":"2026-05-14T06:35:12.230Z","repository":{"id":149346081,"uuid":"613955425","full_name":"Sensirion/raspberry-pi-uart-sfx6xxx","owner":"Sensirion","description":" C driver to work with the Sensirion's SFC6xxx mass flow controller or SFM6xxx sensor via UART on Raspberry-Pi ","archived":false,"fork":false,"pushed_at":"2024-05-10T07:46:15.000Z","size":1043,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-10T19:30:06.638Z","etag":null,"topics":["controller","evaluation-kit","flow","meter","raspberry-pi","rs485","sek","sensirion","sfc","sfc6","sfc6000","sfc6xxx","sfm","sfm6","sfm6000","sfm6xxx","shdlc","uart"],"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.txt","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":"2023-03-14T15:47:46.000Z","updated_at":"2024-05-10T07:46:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"eaee1aa8-d0db-4b47-9dee-bf7f5d1c01c2","html_url":"https://github.com/Sensirion/raspberry-pi-uart-sfx6xxx","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sensirion%2Fraspberry-pi-uart-sfx6xxx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sensirion%2Fraspberry-pi-uart-sfx6xxx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sensirion%2Fraspberry-pi-uart-sfx6xxx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sensirion%2Fraspberry-pi-uart-sfx6xxx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Sensirion","download_url":"https://codeload.github.com/Sensirion/raspberry-pi-uart-sfx6xxx/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241067979,"owners_count":19903931,"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":["controller","evaluation-kit","flow","meter","raspberry-pi","rs485","sek","sensirion","sfc","sfc6","sfc6000","sfc6xxx","sfm","sfm6","sfm6000","sfm6xxx","shdlc","uart"],"created_at":"2024-11-12T01:14:24.022Z","updated_at":"2026-05-14T06:35:07.207Z","avatar_url":"https://github.com/Sensirion.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sensirion Raspberry Pi UART SFX6XXX Driver\n\nThe repository provides a driver for setting up a mass flow controller of the SFC6XXX family or a \ngas flow sensor of the SFM6XXX family to run on a Raspberry Pi over UART using the SHDLC protocol. \n\n\u003ccenter\u003e\u003cimg src=\"images/product-image-sfx6xxx.png\" width=\"300px\"\u003e\u003c/center\u003e\n\nClick [here](https://sensirion.com/sfc6000) to learn more about the Sensirion SFC6XXX mass flow controller family.\n\nClick [here](https://sensirion.com/sfm6000) to learn more about the Sensirion SFM6XXX gas flow sensor family.\n\n## Supported sensor types\n\n- [SFC6000](https://sensirion.com/products/catalog/SFC6000/)\n- [SFC6000D-5SLM](https://sensirion.com/products/catalog/SFC6000D-5slm/)\n- [SFC6000D-50SLM](https://sensirion.com/products/catalog/SFC6000D-50slm/)\n- [SFC6000D-20SLM](https://sensirion.com/products/catalog/SFC6000D-20slm/)\n- [SFM6000](https://sensirion.com/products/catalog/SFM6000)\n- [SFM6000D-20SLM](https://sensirion.com/products/catalog/SFM6000D-20slm)\n- [SFM6000D-50SLM](https://sensirion.com/products/catalog/SFM6000D-50slm)\n- [SFM6000D-5SLM](https://sensirion.com/products/catalog/SFM6000D-5slm)\n\nThe following instructions and examples use a *SFC6000*.\n\n\n## Connect the sensor\n\nPlease note that the sensor needs to be connected to a 24V power supply.\n\n\u003cdetails\u003e\u003csummary\u003eConnecting the Sensor over USB\u003c/summary\u003e\n\u003cp\u003e\nPlug in the \u003ca href=\"https://sensirion.com/products/catalog/EK-F5x\"\u003eevaluation kit cable\u003c/a\u003e to power and connect the USB port to your Raspberry Pi.\n\nPlease note that due to the delays introduced by the FTDI driver you can \nreach a maximum sampling frequency of about 20Hz with this setup.\n\u003c/p\u003e\n\u003c/details\u003e\n\n\n\u003cdetails\u003e\u003csummary\u003eConnecting the Sensor over RS485 converter\u003c/summary\u003e\n\u003cp\u003e\n\nWith this connection setup you can reach a sampling frequency of 100Hz or more.\n\n\nTo connect the sensor to your Raspberry Pi serial interface you need a RS485 to RS232 converter. For example, you can use following material:\n\n- [RS485 to RS232 Converter U094 from M5Stack](https://www.distrelec.ch/en/isolated-rs485-transceiver-unit-m5stack-u094/p/30185750)\n- [M8 socket to Bare End Cable](https://www.distrelec.ch/en/actuator-sensor-cable-m8-socket-bare-end-conductors-5m-phoenix-contact-1681842/p/11033799) to connect the sensor to the converter\n- [Grove to pin header cable](https://www.distrelec.ch/en/grove-pin-female-jumper-to-grove-pin-conversion-cable-seeed-studio-110990028/p/30069938) to connect the RS485 converter to your Raspberry Pi board\n\nWire the sensor to the RS485 converter using the M8 socket to Bare End Cable:\n\n| *Sensor Pin* | *Cable Color* | *Name* | *Converter connection*  | *Comments* |\n|--------------|---------------|:-------------:|------------|------------|\n| 1 | brown | VDD | - | Connect to external power supply (+24V).\n| 2 | white | D+ | A | \n| 3 | black | D- | B | \n| 4 | blue | GND | Ground | Connect the Ground of the external power supply to the adapter ground as well\n\n\u003cimg src=\"images/SFx6xxxRS485ConverterPinout.png\" width=\"500px\"\u003e\n\n\nWire the RS485 converter to your Raspberry Pi using the Grove to pin header cable:\n\n| *Converter* | *Cable Color* | *Raspberry Pi Pin* | *Comments* |\n|--------------|---------------|:-------------:|------------|\n| TXD | yellow | Pin 10 (RXD) | UART communication, cross over |\n| RXD | white | Pin 8 (TXD) | UART communication, cross over | \n| 5V | red | Pin 2 (VDD) | Power supply for the RS485 converter |\n| GND | black | Pin 6 (GND) |  |\n\n\u003cimg src=\"images/raspi-pinout-uart-5V-Grove-Cable.png\" width=\"700px\"\u003e\n\n\u003e **Note:** Make sure to [configure your hardware serial interface](https://www.raspberrypi.com/documentation/computers/configuration.html#disabling-the-linux-serial-console) on your Raspberry Pi.\n\n\u003e **Note:** Make sure to connect serial pins as cross-over (RXD of converter -\u003e TXD on Raspberry Pi; TXD of converter -\u003e RXD pin of Raspberry Pi)\n\n\u003c/p\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\nCustom setup - sensor pinout\n\u003c/summary\u003e\n\u003cp\u003e\nThe M8 connector of your SFX6XXX has the following pinout:\n\n\u003cimg src=\"images/product-pinout-sfx6xxx.png\" width=\"300px\"\u003e\n\n| *Pin* | *Cable Color* | *Name* | *Description*  | *Comments* |\n|-------|---------------|:------:|----------------|------------|\n| 1 | brown | VDD | Supply Voltage | +24V\n| 2 | white | D+ |  | \n| 3 | black | D- |  | \n| 4 | blue | GND | Ground | \n\n\u003c/p\u003e\n\u003c/details\u003e\n\u003c/br\u003e\n\n## Quick start example\n\n- [Install the Raspberry Pi OS on to your Raspberry Pi](https://projects.raspberrypi.org/en/projects/raspberry-pi-setting-up)\n- Download the SFX6XXX driver from [Github](https://github.com/Sensirion/raspberry-pi-uart-sfx6xxx) and extract the `.zip`\n  on your Raspberry Pi\n- Connect the SFX6XXX sensor as explained in the [section above](#connect-the-sensor)\n- Check that the correct serial port is set in the define in `sensirion_uart_portdescriptor.h`\n   - For connection over USB (in case you have other devices connected check the USB number)\n\n     `#define SERIAL_0 \"/dev/ttyUSB0\"`\n\n   - For connection over UART Pins using the RS485 Converter\n\n     `#define SERIAL_0 \"/dev/serial0\"`\n\n- Compile the driver\n    1. Open a [terminal](https://projects.raspberrypi.org/en/projects/raspberry-pi-using/8)\n    2. Navigate to the driver directory. E.g. `cd ~/raspberry-pi-uart-sfx6xxx`\n    3. Navigate to the subdirectory example-usage.\n    4. Run the `make` command to compile the driver\n\n       Output:\n       ```\n       rm -f sfx6xxx_uart_example_usage\n       cc -Os -Wall -fstrict-aliasing -Wstrict-aliasing=1 -Wsign-conversion -fPIC -I. -o sfx6xxx_uart_example_usage sfx6xxx_uart.h sfx6xxx_uart.c sensirion_uart_hal.h sensirion_shdlc.h sensirion_shdlc.c \\ \n           sensirion_uart_hal.c sensirion_config.h sensirion_common.h sensirion_common.c sfx6xxx_uart_example_usage.c\n       ```\n- Test your connected sensor\n    - Run `./sfx6xxx_uart_example_usage` in the same directory you used to compile the driver. You should see the\n      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\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-uart-sfx6xxx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsensirion%2Fraspberry-pi-uart-sfx6xxx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsensirion%2Fraspberry-pi-uart-sfx6xxx/lists"}