Difference between revisions of "Water level measurement"

From aquarium-doc
Jump to navigationJump to search
Line 20: Line 20:
The voltage translator is connected to the GPIO pins of the Raspberry Pi.
The voltage translator is connected to the GPIO pins of the Raspberry Pi.


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

Revision as of 14:45, 27 March 2022

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 a voltage translator with the commercial name KY-051.

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