Difference between revisions of "Water level measurement"

From aquarium-doc
Jump to navigationJump to search
 
(One intermediate revision 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 a voltage translator with the commercial name [https://joy-it.net/en/products/COM-KY051VT KY-051].
The device is connected to an Arduino Uno.
[[File:Example Wiring HC-SR04 to KY051VT.png|thumb|Example Wiring HC-SR04 to KY051VT]]
The voltage translator is connected to the GPIO pins of the Raspberry Pi.


The control logic is as following:
The control logic is as following:
Line 27: Line 25:


==== Software ====
==== Software ====
The SW implements an interrupt routine to capture the signal change timing in the component [[SW Component UltrSncDstncMsr]].
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.

Ultra Sonic Distance Sensor Installed On Top Of Refill Tank

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