0% found this document useful (0 votes)
10 views6 pages

iotproject

Uploaded by

bizzsetuuser8
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views6 pages

iotproject

Uploaded by

bizzsetuuser8
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

409

Topic name: Led distance indicator using Arduino


uno
Purpose

Led distance indicator senses the motion by echo as input. An


ultrasonic sensor that is able to measure the distance from the
selected points of a motor vehicle. The sensor is based on the
measurement of time of flight of an ultrasonic pulse, which is
reflected by the obstacle. The sensor is composed of only low-
cost components, thus being apt for distance measurement in
many cases, and is able to self-adapt to different conditions in
order to give the best results.
The development of "smart cars" requires new sensors that are
able to measure distances in the range of a few centimeters to a
few meters. Parking aids, obstacle detection, as well as intelligent
suspensions and headlight levelling, are some examples of
features that require a distance measurement to be performed with
contactless sensors. In this paper the authors describe a low-cost
ultrasonic distance measurement that performs contactless
measurement of the distance of obstacles from the vehicle body.

Components
1. Arduino Uno
2. Ultrasonic sensor Hc-sr04
3. 7 x LEDs
4. 7 x 220ohm resistor
5. Breadboard
6. jumper wire

Hardware and software


1. Arduino uno
2. Arduino ide
3. CH34XSER_MAC

1
409

Features

Distance measure:- 2cm to 400cm.


Power Supply: +5V DC.
Measuring Angle: 30 degree.
uses as: Obstacle avoiding robot, distance measure, measure
water level and many more.

The Ultrasonic sensor is very popular and used to measure the


distance to an object. It comes complete with ultrasonic
transmitter and receiver modules. Hc-sr04 transmit high-
frequency sound and when an object detects then reflect the
signal to echo.

Circuit diagram
Add LED and resistor according to circuit diagram .keep common all
the negative terminal of all 5 LED's.Connect resistors with the
positive terminal of this LED's.Now take arduino and connect pin
no. 4,5,6,7 with second terminal of this resistors.Now connect the
ground pin of arduino with the ground negative terminal of
LED's.Now take ultrasonic sensor HCSR-04 and connect it's
VCC to 5V pin of arduino and it's GND pin with arduino GND
pin.Finally connect the Trigger pin of ultrasonic sensor with pin
no. 2 of arduino and echo pin of ultrasonic sensor with pin no. 3
of arduino.

2
409

Code:
nt Time ;
int distance;

void setup()
{
pinMode(12,OUTPUT);
pinMode(13,INPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
pinMode(7,OUTPUT);
Serial.begin(9600);

3
409

void loop()
{
digitalWrite(2,HIGH);
delayMicroseconds(10);
digitalWrite(2,LOW);
delayMicroseconds(5);
digitalWrite(2,HIGH);
delayMicroseconds(10);

Time = pulseIn(3,HIGH);

distance= 0.0343*Time/2;
Serial.print("distane from sensor to object is =");
Serial.println(distance);
delay(5);

if(distance>1 && distance <=10 )


{

digitalWrite(4,HIGH);
digitalWrite(5,HIGH);
digitalWrite(6,HIGH);
digitalWrite(7,HIGH);
}

if(distance>10 && distance <=15)


{
digitalWrite(4,HIGH);
digitalWrite(5,HIGH);
digitalWrite(6,HIGH);
digitalWrite(7,LOW);

if(distance>15 && distance <=20)


{

digitalWrite(4,HIGH);
digitalWrite(5,HIGH);
digitalWrite(6,LOW);
digitalWrite(7,LOW);

if(distance>20 && distance <=25)


{

4
409

digitalWrite(4,HIGH);
digitalWrite(5,LOW);
digitalWrite(6,LOW);
digitalWrite(7,LOW);

}
if(distance>25 && distance <=30)
{
digitalWrite(4,LOW);
digitalWrite(5,LOW);
digitalWrite(6,LOW);
digitalWrite(7,LOW);
}

Working of project
Add LED and resistor according to circuit diagram .keep
common all the negative terminal of all 5 LED's.Connect resistors
with the positive terminal of this LED's.Now take arduino and
connect pin no. 4,5,6,7 with second terminal of this resistors.Now
connect the ground pin of arduino with the ground negative
terminal of LED's.Now take ultrasonic sensor HCSR-04 and
connect it's VCC to 5V pin of arduino and it's GND pin with
arduino GND pin.Finally connect the Trigger pin of ultrasonic
sensor with pin no. 2 of arduino and echo pin of ultrasonic sensor
with pin no. 3 of arduino.

Distance calculation

Distance = speed × time


Distance = (0.034 Cm/micro sec) ×time /2

5
409

You might also like