Difference between revisions of "Water level measurement"
| (2 intermediate revisions by the same user not shown) | |||
| Line 16: | Line 16: | ||
* ECHO: measurement of return of sound wave | * ECHO: measurement of return of sound wave | ||
The device is connected to | The device is connected to an Arduino Uno. | ||
The control logic is as following: | |||
* The control system sets the TRIG channel to high. | |||
* HC-SR04 sends an ultrasonic wave to the surface of the water tank and set the ECHO channel to high at the same time. | |||
* The surface reflects the wave back towards the microphone of the HC-SR04. | |||
* The HC-SRC04 sets the ECHO channel to low upon receiving the reflected wave. | |||
==== Software ==== | ==== Software ==== | ||
The SW | The Arduino Uno measures the travel time of the Ultra Sonic Wave. | ||
Arduino Uno and Raspberry Pi are connected via USB. | |||
The control SW running on the Raspberry Pi | |||
* reads the travel time of the wave in the [[SW Component ArdnIntrfc]]. | |||
* calculates the travel distance and a low-pass filtered version of this signal in the [[SW Component UltrSncDstncMsr]]. | |||
* calculates the corresponding water level of the refill tank in the [[SW Component RefillTnkLvl]]. | |||
Latest revision as of 10:52, 19 February 2023
Motivation
The measured water level is input for the calculation of the refill tank content. In order not to contaminate the water, a contact-less measurement is preferred.
Implementation
The control system uses a device which generates an ultrasonic sound and measures when the sound wave has travelled back from the water surface. The SW system will record the time used for this travel and calculate the corresponding distance using the speed of sound.
Hardware
The ultrasonic distance measurement device is sold with the commercial name HC-SR04. The device has 4 pins:
- VCC: Supply voltage 5V
- GND
- TRIG: external trigger for sound wave
- ECHO: measurement of return of sound wave
The device is connected to an Arduino Uno.
The control logic is as following:
- The control system sets the TRIG channel to high.
- HC-SR04 sends an ultrasonic wave to the surface of the water tank and set the ECHO channel to high at the same time.
- The surface reflects the wave back towards the microphone of the HC-SR04.
- The HC-SRC04 sets the ECHO channel to low upon receiving the reflected wave.
Software
The Arduino Uno measures the travel time of the Ultra Sonic Wave. Arduino Uno and Raspberry Pi are connected via USB. The control SW running on the Raspberry Pi
- reads the travel time of the wave in the SW Component ArdnIntrfc.
- calculates the travel distance and a low-pass filtered version of this signal in the SW Component UltrSncDstncMsr.
- calculates the corresponding water level of the refill tank in the SW Component RefillTnkLvl.