Calculate Your Own Height Using Arduino

by itsarduinoboy in Circuits > Arduino

563 Views, 1 Favorites, 0 Comments

Calculate Your Own Height Using Arduino

fdws.jpeg

Hi this is me Rohan Barnwal. welcome back with another project In this project I talk about how you create a device that will help you in calculation of the height

Story

So one day I was sitting on my room and wondering something after few minutes I want to calculate my height but the inch tape was very short at that time I decided to make only a project which will calculate my height and all then only I decided to make this project

Supplies

download (1).jpeg
download.jpeg
LCD.jpeg
HCSR04.jpeg
Pot.jpeg

Things Required For Making of The Project:-

  1. Ultrasonic Sensor
  2. Arduino Mega 2560
  3. 16X2 LCD Display
  4. Male To Female Jumper Wires
  5. 10K Potentiometer

Software Required:-

  1. Arduino IDE

Connection of All Components

distance_claculator_sfyBK8Dl1U.JPEG
  • HC-SR04 To Arduino Mega:-

GND To GND

VCC To 5V

ECHO To PIN 52

TRIG To PIN 53


  • LCD To Arduino Mega:-

GND To GND

VCC TO 5V

RS TO PIN 12

R/W TO GND

EN TO PIN 11

AFTER THAT LEAVE 4 DATA PINS AND CONNECT REMAINING PINS

PIN 5

PIN 4

PIN 3

PIN 2

GND TO GND

VCC TO 5V


AND THIS IS HOW WE COMPLETED THE WHOLE CONNECTION

Now Coding Part

So if I talk about the code you can see it below:-

// Created by Rohan Barnwal!!!!!!!! 
// -:AATAM NIRBHAR BHARAT:- 
#include <LiquidCrystal.h> 

// includes the LcdBarGraph Library
#include <LcdBarGraph.h>

// Maximum distance we want to ping for (in centimeters).
#define max_distance 200

// Creates an LCD object. Parameters: (rs, enable, d4, d5, d6, d7)
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); 

LcdBarGraph lbg(&lcd, 16, 0, 1); // Creates an LCD Bargraph object.

const int trigPin = 52;
const int echoPin = 51;
long duration;
int distance;
int distance1;
int speakerPin = 8;
void setup() 
{
  lcd.begin(16,2); // Initializes the interface to the LCD screen
  
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
}

void loop() 
{
  // Write a pulse to the HC-SR04 Trigger Pin
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);
  
  // Measure the response from the HC-SR04 Echo Pin
  duration = pulseIn(echoPin, HIGH);
  
  // Determine distance from duration
  // Use 343 metres per second as speed of sound
  distance= duration*0.034/2;
  distance1= 180 - distance ;
  // Prints "Distance: <value>" on the first line of the LCD

  if (distance1 > 100) {
   tone (speakerPin, 1000);
  
   } else {
    noTone (speakerPin);

  }
  lcd.setCursor(0,0);
  lcd.print("HEIGHT: ");
  lcd.print(distance1);
  lcd.print("  cm  ");

  // Draws bargraph on the second line of the LCD
  lcd.setCursor(0,1);
  lbg.drawValue(distance1, max_distance);
  delay(500);
}

So this is the whole code So that's all about the project