CIRCUIT DIAGRAM & CONNECTIONS

by Saastha Sree Nnandan in Circuits > Arduino

171 Views, 0 Favorites, 0 Comments

CIRCUIT DIAGRAM & CONNECTIONS

lcd wiring 2.png

GIVE THE CONNECTIONS AS PER THE CIRCUIT DIAGRAM.

1) Vcc pin of Ultrasonic Sensor is connected to 5V power terminal.

2) TRIG pin of Ultrasonic Sensor is connected to PIN 9 of Arduino ECHO pin of Ultrasonic Sensor is connected to PIN 8 of Arduino.

3) GND pin of Ultrasonic Sensor is connected to GND terminal.

4)Led with 220ohm resistor connected to PIN12 of arduino.

Distance Measuring Instrument Using Arduino

Screenshot (200).png

Hello all. I'm going to do a simple DIY - "DISTANCE MEASURING INSTRUMENT" using an ARDUINO UNO. Let's get started.

MATERIALS REQUIRED

download.jpg
download (1).jpg
download (2).jpg
download (3).jpg
wooden-half-meter-scale-500x500.jpeg

1) ARDUINO UNO

2) HC - SRO4 ULTRASONIC SENSOR

3) BREADBOARD

4) LCD DISPLAY MONITOR

5) SCALE

6) ANY OBJECT FOR BRINGING IN CONTACT WITH THE SENSOR

7) A FEW JUMPER WIRES

ARDUINO CODE

#include<LiquidCrystal.h>

LiquidCrystal lcd(10,9,5,4,3,2);

const int trigPin = 11;

const int echoPin = 12;

long duration;

int distance;

void setup() {

analogWrite(6,100);

lcd.begin(16,2);

pinMode(trigPin, OUTPUT);

pinMode(echoPin, INPUT);

Serial.begin(9600);

}

void setup() {

analogWrite(6,100);
lcd.begin(16,2);

pinMode(trigPin, OUTPUT);

pinMode(echoPin, INPUT);

Serial.begin(9600);

}

void loop() {
long duration, distance;

digitalWrite(trigPin,HIGH);

delayMicroseconds(1000);

digitalWrite(trigPin, LOW);

duration=pulseIn(echoPin, HIGH);

distance =(duration/2)/29.1;

Serial.print(distance);

Serial.println("CM");

delay(10);

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

lcd.clear();

lcd.setCursor(0,0);

lcd.print("Distance = ");

lcd.setCursor(11,0);

lcd.print(distance);

lcd.setCursor(14,0);

lcd.print("CM");

delay(500);

}

OPERATE IT

NOW KEEP THE SCALE'S 0 AT THE BEGINNING OF THE ULTRASONIC SENSOR AND BRING ANY MATERIAL AND NOW YOU CAN SEE THE MEASUREMENT IN THE LCD MONITOR. YOU CAN CROSS-VERIFY THE DISTANCE WITH THE SCALE.

DO TRY IT OUT!!!

THANK YOU!!!!