Home

Awesome

Sensirion Raspberry Pi UART SFX6XXX Driver

The repository provides a driver for setting up a mass flow controller of the SFC6XXX family or a gas flow sensor of the SFM6XXX family to run on a Raspberry Pi over UART using the SHDLC protocol.

<center><img src="images/product-image-sfx6xxx.png" width="300px"></center>

Click here to learn more about the Sensirion SFC6XXX mass flow controller family.

Click here to learn more about the Sensirion SFM6XXX gas flow sensor family.

Supported sensor types

The following instructions and examples use a SFC6000.

Connect the sensor

Please note that the sensor needs to be connected to a 24V power supply.

<details><summary>Connecting the Sensor over USB</summary> <p> Plug in the <a href="https://sensirion.com/products/catalog/EK-F5x">evaluation kit cable</a> to power and connect the USB port to your Raspberry Pi.

Please note that due to the delays introduced by the FTDI driver you can reach a maximum sampling frequency of about 20Hz with this setup.

</p> </details> <details><summary>Connecting the Sensor over RS485 converter</summary> <p>

With this connection setup you can reach a sampling frequency of 100Hz or more.

To connect the sensor to your Raspberry Pi serial interface you need a RS485 to RS232 converter. For example, you can use following material:

Wire the sensor to the RS485 converter using the M8 socket to Bare End Cable:

Sensor PinCable ColorNameConverter connectionComments
1brownVDD-Connect to external power supply (+24V).
2whiteD+A
3blackD-B
4blueGNDGroundConnect the Ground of the external power supply to the adapter ground as well
<img src="images/SFx6xxxRS485ConverterPinout.png" width="500px">

Wire the RS485 converter to your Raspberry Pi using the Grove to pin header cable:

ConverterCable ColorRaspberry Pi PinComments
TXDyellowPin 10 (RXD)UART communication, cross over
RXDwhitePin 8 (TXD)UART communication, cross over
5VredPin 2 (VDD)Power supply for the RS485 converter
GNDblackPin 6 (GND)
<img src="images/raspi-pinout-uart-5V-Grove-Cable.png" width="700px">

Note: Make sure to configure your hardware serial interface on your Raspberry Pi.

Note: Make sure to connect serial pins as cross-over (RXD of converter -> TXD on Raspberry Pi; TXD of converter -> RXD pin of Raspberry Pi)

</p> </details> <details> <summary> Custom setup - sensor pinout </summary> <p> The M8 connector of your SFX6XXX has the following pinout: <img src="images/product-pinout-sfx6xxx.png" width="300px">
PinCable ColorNameDescriptionComments
1brownVDDSupply Voltage+24V
2whiteD+
3blackD-
4blueGNDGround
</p> </details> </br>

Quick start example

Troubleshooting

Building driver failed

If the execution of make in the compilation step 3 fails with something like

 make: command not found

your RaspberryPi likely does not have the build tools installed. Proceed as follows:

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install build-essential

Contributing

Contributions are welcome!

We develop and test this driver using our company internal tools (version control, continuous integration, code review etc.) and automatically synchronize the master branch with GitHub. But this doesn't mean that we don't respond to issues or don't accept pull requests on GitHub. In fact, you're very welcome to open issues or create pull requests :)

This Sensirion library uses clang-format to standardize the formatting of all our .c and .h files. Make sure your contributions are formatted accordingly:

The -i flag will apply the format changes to the files listed.

clang-format -i *.c *.h

Note that differences from this formatting will result in a failed build until they are fixed.

License

See LICENSE.