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
autors:

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() {

Serial.begin(9600);

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);

delay(50);

float v2 = sensorValue12 * (5.0 / 1023.0);

delay(50);

float v22 = sv2 * (5.0 / 1023.0);

delay(50);

float v3 = sensorValue13 * (5.0 / 1023.0);

delay(50);

float v23 = sv3 * (5.0 / 1023.0);

delay(50);

float v4 = sensorValue14 * (5.0 / 1023.0);

delay(50);

float v24 = sv4 * (5.0 / 1023.0);

delay(50);

float v5 = sensorValue14 * (5.0 / 1023.0);

delay(50);

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*/

delay(100);

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*/

Serial.println("time1");

Serial.println(t1);

}

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

mn2 = m2;

t2 = millis();

Serial.println("time2");

Serial.println(t2);

}

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.setCursor(0,1);

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

} }

<p>For a real life application (where you can't simply put hot water in the stream every time you need to mesure the flow) you could apply the Thermal Mass Flowmeter principle.</p><p>See links below:</p><p><a href="http://www.flowmeters.com/thermal-technology" rel="nofollow">http://www.flowmeters.com/thermal-technology</a></p><p><a href="https://en.wikipedia.org/wiki/Thermal_mass_flow_meter" rel="nofollow">https://en.wikipedia.org/wiki/Thermal_mass_flow_me...</a></p><p><a href="https://sagemetering.com/back-to-basics/thermal-mass-flow-meter-working-principle-and-theory/" rel="nofollow">https://sagemetering.com/back-to-basics/thermal-ma...</a></p>
<p>Interesting. Thanks for sharing this!</p><p>Do you have any additional photos to show how you put this device together?</p>