Tutorial: Arduino Interface for Liquid Flow Sensors
Quick Start Guide
This quick start guide is aimed at customers who have worked with our Liquid Flow Meter Kits and are evaluating Sensirion liquid flow sensors in a prototyping scenario. This guide describes how to set up and connect a sensor to an Arduino UNO and how to run a first simple measurement using sample code.
What you have to do
Setting up your Arduino (UNO)
Please note that these steps are simply a suggestion. Sensirion AG is not responsible for any technical issues arising from the Arduino board, setting it up and all electrical connections.
- Download the Arduino Software here: https://www.arduino.cc/en/Main/Software
- Follow Arduino’s Getting Started Guide (https://www.arduino.cc/en/Guide/HomePage)
- For Arduino UNO: We have successfully tested our sample code with the Arduino UNO board and therefore recommend using it (Arduino UNO Getting Started Guide (https://www.arduino.cc/en/Guide/ArduinoUno)).
If you have successfully connected and tested your Arduino board, you are ready to continue to the next part.
Connecting your sensor
Connect your liquid flow sensor to the Arduino board as described in figure above. Using screw headers may help make reliable and easy to use connections (for example: 277-1275-ND from www.digikey.com) In case you want to design and use your own cable, please follow the pin descriptions shown below precisely. Using the wrong voltage or applying voltages to the wrong pins can damage the sensor. Sensirion AG is not responsible for any damages incurred this way.
|Pin Label||4 pin Molex Pin-no. |
(LS32 sensors LPG10 Eval
kit LD20 base station)
|5 pin Molex Pin-no.|
|VDD||2||3||3.5 or 5 V*|
|*3.5 or 5V supply voltage depends on the sensor. Please refer to your sensor's datasheet|
** Analog wire (only for 5 pin Molex. Might be missing)
Running your first measurement
Once you have successfully tested your Arduino and have connected your sensor correctly, you can start your first measurement. Double-click ‘example_01_simple_measurement.ino’ of Example 1 of Sensirion AG’s sample Arduino code. This will launch the Arduino software suite and open the sample code. Simply upload the code to your Arduino board and wait for the process to finish. The measurement will begin automatically. In order to see the results, start the serial monitor from within the Arduino software suite (see arrow in the figure below).
After opening the serial monitor, a window will open that displays the unsigned integer sensor reading, as well as the flow rate in physical units with the two’s complement and scaling factor applied.
All code examples are commented for ease of understanding. Feel free to use and edit the code as you please. Remember to save a new copy before you start editing, to avoid overwriting the original sample code.