Video Tutorial
........Loading...................
Description
Hai friends so here we are going to create a smart walking stick for blind persons. This stick contains a sensor which will detect any object in front of its path. with the help of an alarm, it will give an indication to the blind person. so thereby they can identify some objects are present in front of there path.
Components Required
1. | Arduino UNO | * 1 |
2. | Beeper | * 1 |
3. | Ultrasonic sensor | * 1 |
4. | Jumper Wires | |
5. | Bread Board | *1 |
Circuit Diagram
Beeper: Red wire - 2, brown wire - GND,
Sensor: VCC - 5V, GND-GND, Trig- 11, Echo- 12
Program
Complete your coding with the help of the Arduino ide. Upload program to your Arduino board makes sure that the Arduino port selection option is perfect. Avoid chance to get an error during uploading program to board
Click here to learn: "How to Upload your code to Arduino boards Without Error"
void setup()
{
Serial.begin (9600);
pinMode(2,OUTPUT);
pinMode(10,OUTPUT);
pinMode(9,INPUT);
}
void loop()
{
long duration, distance;
digitalWrite(10, LOW);
delayMicroseconds(2);
digitalWrite(10, HIGH);
delayMicroseconds(10);
digitalWrite(10, LOW);
duration = pulseIn(9, HIGH);
distance = (duration/2) / 29.1;
Serial.print(distance);
Serial.println(" cm");
delay(200);
if (distance > 30)
{
digitalWrite(2,LOW);
delay(20);
}
if (distance < 30)
{
digitalWrite(2,HIGH);
delay(20);
}
}