Skip to content

4.1.31. High Precision Liquid Level Meter

| Description In Project 86, learners will engineer an advanced 'High-Precision Liquid Level Meter' multi-component system. This design integrates HC-SR04 Ultrasonic + 8x8 Dot Matrix + Active Buzzer into a cohesive industrial automation unit.|------------------|----------------------------------------------------------------| | Use case |This project connects to real-world industrial and IoT applications such as: Project 86 provides essential master-level engineering skills for real-world IoT, safety, and control systems.|

Components (Things You will need)

Arduino Uno Arduino USB Cable Bread Board Jumper Wires Buzzer Ultrasonic Sensor 8x8 Dot Matrix

Building the circuit

Things Needed:

  • Arduino Uno Core Board = 1
  • HC-SR04 Ultrasonic = 1
  • 8x8 Dot Matrix = 1
  • Active Buzzer = 1
  • USB Cable & Jumper Wires = 1
  • Bread Board

Mounting the component on the breadboard and wiring the circuit

Step 1: Inventory all modules listed in the Required Components table.

Step 2: Connect line [Sensor / Input Leads] to [Analog / Digital Pins] — (Primary signal input bus.).

Step 3: Connect line [Actuator / Display Leads] to [PWM / I2C Bus Pins] — (Primary control output bus.).

Step 4: Connect line [VCC / Power Lines] to [5V / 3.3V] — (System power rails.).

Step 5: Connect line [GND Lines] to [GND] — (Common ground reference.).

Step 6: Double-check all VCC, 5V, 3.3V, and GND polarities to prevent electrical shorts.

Step 7: Connect USB programming cable only after verifying all signal path wiring.

Components on breadboard

Make sure to connect the Arduino USB cable to the Arduino board.

PROGRAMMING

Step 1: Open your Arduino IDE. See how to set up here: Getting Started.

Step 2: Write the complete program implementing the system logic with appropriate pin definitions, setup configuration, and the main control loop.

#include <LedControl.h>

// Pin Definitions
const int trigPin = 9;
const int echoPin = 8;
const int buzzerPin = 7;

// Dot Matrix Pins (DIN, CLK, CS)
// Wiring: DIN=11, CS=10, CLK=13
LedControl lc = LedControl(11, 13, 10, 1);

void setup() {
  Serial.begin(9600);
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  pinMode(buzzerPin, OUTPUT);

  lc.shutdown(0, false);
  lc.setIntensity(0, 8);
  lc.clearDisplay(0);
  Serial.println("Project 86: High-Precision Liquid Level Meter Initialized...");
}

void loop() {
  long duration;
  int distance;

  // Trigger pulse
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);

  // Measure echo
  duration = pulseIn(echoPin, HIGH);
  distance = duration * 0.034 / 2;

  Serial.print("Distance: ");
  Serial.print(distance);
  Serial.println(" cm");

  // If liquid is too high (distance < 10cm), trigger alarm and display
  if (distance > 0 && distance < 10) {
    digitalWrite(buzzerPin, HIGH);
    // Display alert pattern on 8x8 matrix
    for(int i=0; i<8; i++) lc.setRow(0, i, B00011000); 
  } else {
    digitalWrite(buzzerPin, LOW);
    lc.clearDisplay(0);
  }
  delay(500);
}

Step 7: Save your code. See the Getting Started section

Step 8: Select the arduino board and port See the Getting Started section:Selecting Arduino Board Type and Uploading your code.

Step 9: Upload your code. See the Getting Started section:Selecting Arduino Board Type and Uploading your code

CONCLUSION

The system responds dynamically when physical conditions cross pre-programmed setpoints, driving output devices reliably.