Arduino Height Measure with Ultrasonic Sensor

Introduction

In this project, we will learn how to make Arduino Height Measure with Ultrasonic Sensor. The height measuring device is a simple device used to measure the height of a person who stands under it. The device will be installed at a certain height and when anyone stands under the device, the height measuring device will measure the height of the person by subtracting the distance between the device and the person under it from the height at which the device is installed.

Hardware Required

You will require the following Hardware Components for Arduino Height Measure with Ultrasonic Sensor.

Components#Buy From Amazon
Arduino UNO1Buy Link
HC-SR04 Ultrasonic Sensor1Buy Link
16×2 LCD Display module1Buy Now
Buzzer1Buy Now
9 volts Battery1Buy Now
Jumper WiresFewBuy Link
Breadboard1Buy Link

What is an Ultrasonic Sensor?

An Ultrasonic Sensor is a device that uses sound waves to measure distance. It emits high-frequency sound waves and then listens for the echo. By measuring the time it takes for the echo to return, the sensor can calculate the distance between the sensor and an object.

Specifications

  1. Measurement Range: The HC-SR04 sensor can typically measure distances from 2 cm to 400 cm, making it suitable for a wide range of applications.
  2. High Accuracy: It offers high measurement accuracy, typically within a few millimeters.
  3. Digital Output: The sensor provides distance measurements in digital form, making it easy to interface with microcontrollers like the Arduino UNO.
  4. Compact Size: The sensor’s small form factor allows for easy integration into various projects.

Features

  1. Non-contact Measurement: The sensor can measure distances without physically touching the object, making it suitable for applications where contact is not possible or desired.
  2. Wide Applicability: It finds use in robotics, obstacle avoidance systems, automatic door openers, and many other projects.
  3. Low Power Consumption: The HC-SR04 is energy-efficient, making it suitable for battery-powered applications.

Pinout

Ultrasonic-Sensor-HC-SR04-Pinout

Pinout Configuration

Pin NameDescription
VccThe Vcc pin powers the sensor, typically with +5V
TrigTrigger pin is an Input pin. This pin has to be kept high for 10us to initialize measurement by sending US wave.
EchoEcho pin is an Output pin. This pin goes high for a period of time which will be equal to the time taken for the US wave to return back to the sensor.
GNDThis pin is connected to the Ground of the system.

How does this project work?

The Arduino Uno board will be the brain of our height measuring device. It will be connected to the Ultrasonic Sensor, an I2C LCD, a buzzer, and a breadboard using jumper cables. The Ultrasonic Sensor will be positioned at a certain height, facing downwards. When a person stands under the device, the Ultrasonic Sensor will emit sound waves, which will bounce off the person and return to the sensor. The Arduino board will calculate the time it takes for the sound waves to travel and return, and based on that, it will calculate the distance between the sensor and the person.

The Arduino board will then subtract this distance from the height at which the device is installed, giving us the height of the person. The height will be displayed on the I2C LCD screen. Additionally, a buzzer can be used to provide an audible signal when the measurement is complete.

Circuit Diagram

Arduino-Height-Measure-with-Ultrasonic-Sensor-Circuit

Installing Arduino IDE Software

First, you will require to Download the updated version of Arduino IDE Software and Install it on your PC or laptop. if you Learn How to install the Arduino step-by-step guide then click on how to install Arduino Button given Blow

Installing Libraries

Now when you are Ready to upload the code, to the Arduino Board you will need first to add the Following Libraries in Arduino, If you Learn How to add the library in the Arduino step-by-step guide click on how to install the library Button given Blow

Code

//For more Projects: www.arduinocircuit.com

//Include LCD library
#include <LiquidCrystal_I2C.h>
#include <HCSR04.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal_I2C lcd(0x27,16,2);
UltraSonicDistanceSensor distanceSensor(A0,A1);

float distance;
float boxHeight = 185.0;
int buzzerPin= 8;

void setup() {
   Serial.begin(9600);
   lcd.init();   
   lcd.backlight();
   pinMode(buzzerPin, OUTPUT);
   printInstructions();
}

void loop() {
     distance = distanceSensor.measureDistanceCm();
     Serial.println(distance);
     delay(1000);

     /*
     lcd.clear();
     lcd.setCursor(0,0);
     lcd.print(distance);
     */

     

     if (distance < 65 ) {
      printHeight();
      delay(1000);
      tone(buzzerPin, 1000);
      delay(1000);
      noTone(buzzerPin);
      delay(5000);
     } else {
      printInstructions();
     }
     
}

void printInstructions() {
   lcd.clear();
   lcd.setCursor(0,0);
   lcd.print("Stand under the");
   lcd.setCursor(0,1);
   lcd.print("box!");
}

void printHeight() {
  int heightInCm = boxHeight - distance;
  int heightInInches = heightInCm/2.54;
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("Height:");
  lcd.setCursor(8,0);
  lcd.print(heightInInches);
  lcd.setCursor(11,0);
  lcd.print("IN");
  lcd.setCursor(0,1);
  //lcd.print(distance);
}

Applications

  1. Health and Fitness: The height measuring device can be used in gyms and fitness centers to track the progress of individuals during their fitness journey.
  2. Medical Facilities: Height measurement is an important parameter in medical facilities, especially for children’s growth monitoring.
  3. Amusement Parks: The height measuring device can be used at amusement parks to ensure that individuals meet the height requirements for certain rides.
  4. Sports Training: Coaches and trainers can use the height measuring device to track the progress of athletes, especially in sports where height plays a crucial role.
  5. Home Use: The device can be used at home to keep track of the height of family members, especially children who are still growing.

Conclusion

Arduino Height Measure with Ultrasonic Sensor project provides a simple and cost-effective solution for measuring the height of individuals. With its various applications, it can be used in different settings to serve different purposes. Whether it’s for health and fitness, medical facilities, amusement parks, sports training, or home use, this project offers a versatile and practical solution for height measurement.

Leave a Comment


error: