Skip to content
This repository has been archived by the owner on Jul 23, 2020. It is now read-only.
/ arduino-sflow Public archive

Unoffical arduino driver for Sensirion flow sensors

Notifications You must be signed in to change notification settings

winkj/arduino-sflow

Repository files navigation

⚠️ This is a library supporting older generations of flow sensors, and will likely not work for current generation of flow sensors

arduino-sflow

Unofficial Arduino driver support for Sensirion flow sensor products. At this point, only sensors using an I2C interface are supported.

The following sensors are not supported:

  • SFM3000

Installation

Download arduino-sflow either via git or from the releases page and place it in the Arduino/libraries directory. After restarting the Arduino IDE, you will get menu items under libraries and examples.

Integrating it into your sketch

Assuming you installed the library as described above, the following steps are necessary:

  1. Import the Wire library like this: From the menu bar, select Sketch > Import Library > Wire
  2. Import the arduino-sflow library like this: From the menu bar, select Sketch > Import Library > arduino-sflow
  3. Create an instance of the SensirionFlow class, with the I2C address of the sensor as parameter (check datasheet)
  4. In setup(), make sure to init the Wire library with Wire.init()
  5. If you want to use the serial console, remember to initialize the Serial library with Serial.begin(9600)
  6. Finally, call flow.readSample() in the loop() function, which returns a float value of the current flow

Sample code

#include <Wire.h>

#include <sensirionflow.h>

SensirionFlow flow(64);

void setup() {
  // put your setup code here, to run once:
  Wire.begin();  
  Serial.begin(9600);

  flow.init();
}

void loop() {    
  float result = flow.readSample();
  Serial.print("Flow: ");
  Serial.print(result, 2);
  Serial.print("\n");

  delay(1000);
}

About

Unoffical arduino driver for Sensirion flow sensors

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages