tnaegele / sensirion_slf3s

Python driver for Sensirion SLF3S flow sensors
https://tnaegele.github.io/sensirion_slf3s/
Apache License 2.0
0 stars 0 forks source link

sensirion_slf3s

Python driver for Sensirion SLF3S_XXXXX type flow sensors attached to a Sensirion SCC1-USB sensor cable. These come as part of the evaluations kits such as the one for the SLF3S-0600F sensor. The cables communicate to the host via the SHDLC (Sensirion High-Level Data Link Control) protocol.

Installation

It is recommended to create and activate a virtual environment before installation.

pip install sensirion-slf3s

The API documentation can be found here: https://tnaegele.github.io/sensirion_slf3s/.

Example

The following example code starts the sensor and prints periodically the measured values (requires at least Python 3.10):

from sensirion_slf3s import slf3s,find_sensor_port
from sensirion_shdlc_driver import ShdlcSerialPort, ShdlcConnection
import time

sensor_port = find_sensor_port()

with (ShdlcSerialPort(port=sensor_port, baudrate=115200) as port, 
        slf3s(ShdlcConnection(port), slave_address=0) as device):

    device.start(water=True)

    while True:
        flow,temp,flag = device.get_last()
        print(f'flow rate: {flow} ul/min, temperature: {temp} C, flag: {flag}')
        time.sleep(0.1)

Todo