Measuring Flow Velocity by Heat Advection

Introduction: Measuring Flow Velocity by Heat Advection

Measuring flow velocity by heat advection

For the course "Meten aan water" (TU Delft), we have made a device to measure the flow velocity by advection of hot water. In this article we describe how we made the device and how the arduino is used to measure flow velocity. The measurement is based on the assumption that the peak in temperature of the hot water advection will travel at the same speed as the water.

How to build the device?

To make this instrument you need an arduino(we used: UNO), two temperature sensors(TMP 36), an arduino breadboard, some wires and (optional) a LCD screen. The first step is to make your temperature sensors water proof, you need to make sure the "head" of the sensor will still be in contact with the water. Then build something to hold the two termperature sensors in place, on the same depth and same location in the water. We used a piece of wood with two holes in it. The depth for the temperature sensors is six cm below the water surface. The distance between the temperature sensors is ten cm in the direction of the stream.

The next step is to connect the temperature sensors with your arduino, the + and - are connected to 5V and GND port of the arduino, and the third (measure) wires of both sensors are connected to A0 and A1, A0 is for the upstream sensor and A1 for the downstream sensor.

The code

The code is based on Arduino examples > 01.basics > ReadAnalogVoltage.

The code you need to run is written below this article, it can be used with or without the LCD screen. If you don't use the LCD screen you can read the measurements in the serial monitor of the arduino program.

The code takes the averages of five measurements for both sensors and then test them whether the average is the highest average so far, if this is true it remembers the time. The code does this for both sensors and then it calculates the difference in time (t2 - t1). With the known distance between both sensors and the difference in time the flow velocity is calculated.

The measurement

When you have build the device and uploaded the code, you can start measuring.You might want to use a water boiler for the heat wave. The next steps have to be done for every measurement:

1. Press the reset button on your arduino;

2. Put a standard amount of hot water in the stream (upstream) you want to measure;

3. The arduino returns the flow velocity when the whole heat wave has flown by.

The amount of water we applied was 25 ml, and the distance upstream of the first temperature sensor was 0.75 meter (this worked for us but for your stream it might be different, so try different distances and amounts of water).

Date: 26-11-2014

Ludo Schuurman

Daan Houtzager

The arduino code:

We used: ReadAnalogVoltage, then we wrote a new code to measure flow velocity by heat advection.


#include <LiquidCrystal.h> /* here the variables are defined*/

LiquidCrystal lcd(12,11,5,4,3,2);

float dt = 0; /* dt is the time between t2 en t1*/

float measurement = 0; /* measurement = flow velocity (u)*/

float un = 0; /* un is the new flow velocity*/

float mn2 = 0; /* mn is the new mean for sensor 2*/

float u = 0 ; /* u is the flow velocity*/

float mean_new = 0; /* mean_new is the new mean for sensor 1*/

float t1 = 0; /* t1 is the time of the highest mean of sensor 1*/

float t2 = 0; /* t2 is the time of the highest mean of sensor 2*/

void setup() {


lcd.begin(16, 2);

lcd.print("snelheid [m/s]");


void loop() {

int sensorValue1 = analogRead(A0); /* here the code reads the sensor input*/

float v1 = sensorValue1 * (5.0 / 1023.0); /* here the sensor input is converted to voltage*/

delay(50); /* the delay is needed to convert from A0 to A1*/

int sv1 = analogRead(A1); /* 5 measurements are done as above for every sensor*/

float v21 = sv1 * (5.0 / 1023.0);


int sensorValue12 = analogRead(A0);

float v2 = sensorValue12 * (5.0 / 1023.0);


int sv2 = analogRead(A1);

float v22 = sv2 * (5.0 / 1023.0);


int sensorValue13 = analogRead(A0);

float v3 = sensorValue13 * (5.0 / 1023.0);


int sv3 = analogRead(A1);

float v23 = sv3 * (5.0 / 1023.0);


int sensorValue14 = analogRead(A0);

float v4 = sensorValue14 * (5.0 / 1023.0);


int sv4 = analogRead(A1);

float v24 = sv4 * (5.0 / 1023.0);


int sensorValue15 = analogRead(A0);

float v5 = sensorValue14 * (5.0 / 1023.0);


int sv5 = analogRead(A1);

float v25 = sv5 * (5.0 / 1023.0);

float mean1 = (v1 + v2 + v3 + v4 + v5)/5.0; /* here the mean of the five measurements is calculated for sensor 1*/

float m2 = (v21 + v22 + v23 + v24 + v25)/5.0; /* here the mean of the five measurements is calculated for sensor 2*/


if (mean1 > mean_new){ /* in the if loop the mean is tested for mean1 > mean_new*/

mean_new = mean1;

t1 = millis(); /* if the mean is the highest so far the time is stored in t1*/




if (m2 > mn2){ /* same as above but for sensor 2*/

mn2 = m2;

t2 = millis();




if (t2 >t1){ /* when the heat wave is large both means are increasing at the same time, for the peak t2 must be larger than t1*/

dt = (t2/1000-t1/1000); /* dt is calculated */

u = (0,1/dt); /* flow velocity is calculated */

Serial.println(u); /* flow velocity is printed in serial monitor */

if (u < un+0,5){ /* the adaption time for the measurement is large, this loops filters out high values of u that aren't real*/

if ( u < 100){ /* this if statement filters out high u's in the adaption time*/

un = u; measurement = u;




lcd.print(measurement); /* flow velocity is printed on the LCD */

} }

Be the First to Share


    • Leather Challenge

      Leather Challenge
    • Tinkercad to Fusion 360 Challenge

      Tinkercad to Fusion 360 Challenge
    • Make It Modular: Student Design Challenge

      Make It Modular: Student Design Challenge



    7 years ago on Introduction

    Interesting. Thanks for sharing this!

    Do you have any additional photos to show how you put this device together?