Arduino library for the UFM02 ultrasonic flow sensing module through SPI, I2C, and UART from ScioSense.
The UFM-02 is a complete unit including the sensor electronics, spool piece, connectors with standard ½” thread, and a cable connector supporting single-wire and UART interfaces.
It is assumed that
- The Arduino IDE has been installed. If not, refer to "Install the Arduino Desktop IDE" on the Arduino site.
- The library directory is at its default location. Normally this is
C:\Users\[your_username]\Documents\Arduino\libraries.
- In the Arduino IDE, navigate to the Arduino Library Manager on the left side (or, alternatively, select Sketch > Include Library > Manage Libraries...)
- Search for
ScioSense_UFM02 - Select the library from the search results and press
Install
- Download the code from this repository via "Download ZIP".
- In Arduino IDE, select Sketch > Include Library > Add .ZIP library... and browse to the just downloaded ZIP file.
- When the IDE is ready this README.md should be located at
C:\Users\[your_username]\Documents\Arduino\libraries\ScioSense_UFM02\README.md.
Please make sure that you use the correct supply voltage: The UFM-02 runs at VDD = 5V, but the IO lines operate at 3.3V.
This example shows how to wire an ESP32 with a UFM-02 to communicate through SPI.
| UFM-02 | ESP32 |
|---|---|
| IO1 | - |
| IO2 | - |
| VCC | 5V |
| GND | GND |
| 3V3 | - |
| CS | 5 |
| MO | 23 |
| SCK | 18 |
| MI | 19 |
| INT | 2 |
This example shows how to wire an ESP32 with a UFM-02 to communicate through I2C. Currently, the connections are mediated through a board that transforms the SPI output into I2C
| UFM-02 translation board | ESP32 |
|---|---|
| SDA | 21 |
| SCL | 22 |
| RX | - |
| TX | - |
| AOUT | - |
| 5V0 | 5V |
| GND | GND |
This example shows how to wire an ESP32 with a UFM-02 to communicate through I2C. Currently, the connections are mediated through a board that transforms the SPI output into I2C
| UFM-02 translation board | ESP32 |
|---|---|
| SDA | - |
| SCL | - |
| RX | 17 |
| TX | 16 |
| AOUT | - |
| 5V0 | 5V |
| GND | GND |
To build an example sketch
- (Re)start Arduino.
- Open File > Examples > Examples from Custom Libraries > ScioSense_UFM02 > 01_Basi_SPI (or any other of the provided examples you wish to run)
- Make sure Tools > Board lists the correct board.
- Select Sketch > Verify/Compile.
Contributions in the form of issue opening or creating pull requests are very welcome!



