Arduino Smart Glasses with Obstacle Detection
The Smart Glasses with Obstacle Detection project utilizes ultrasonic sensors to enhance user safety by detecting obstacles in the surrounding environment.
This Arduino-based project incorporates three ultrasonic sensors strategically positioned to measure distances in front, right, and left directions.
The system triggers corresponding visual and auditory alerts on the glasses, creating a real-time feedback mechanism for the user.
The ultrasonic sensors calculate distances, and if an obstacle is detected within a predefined range, LEDs and a buzzer are activated, providing immediate warnings.
Component List:
Name | Quantity | Component |
---|---|---|
U1 | 1 | Arduino Uno R3 |
DIST1 DIST3 l DIST2 | 3 | Ultrasonic Distance Sensor (4-pin) |
PIEZO1 | 1 | Piezo |
M3 M2 | 2 | Vibration Motor |
Rpot2 | 1 | 250 kΩ Potentiometer |
The ultrasonic sensors emit high-frequency sound waves, and their echoes are analysed to determine distances. The Arduino processes this data and triggers LED indicators and a buzzer when obstacles are within the specified range. The LEDs and buzzer serve as intuitive feedback for the user, enhancing situational awareness. The left, right, and front sensors enable comprehensive coverage, ensuring the user is promptly informed about potential obstacles in different directions.
Arduino Code:
void setup() {
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
pinMode(3, OUTPUT);
pinMode(2, INPUT);
pinMode(5, OUTPUT);
pinMode(4, INPUT);
pinMode(6, OUTPUT);
pinMode(7, INPUT);
pinMode(11, OUTPUT);
Serial.begin(9600);
}
void loop() {
int distance_cm0;
int distance_cm1;
int distance_cm2;
int dur0;
int dur1;
int dur2;
digitalWrite(6, LOW);
delayMicroseconds(2);
digitalWrite(6, HIGH);
delayMicroseconds(10);
digitalWrite(6, LOW);
dur0 = pulseIn(7, HIGH);
distance_cm0 = (dur0 * 0.034) / 2.0;
Serial.println(distance_cm0);
if (distance_cm0 <= 150 && distance_cm0 >= 0) {
digitalWrite(11, HIGH);
} else {
digitalWrite(11, LOW);
}
delay(50);
digitalWrite(3, LOW);
delayMicroseconds(2);
digitalWrite(3, HIGH);
delayMicroseconds(10);
digitalWrite(3, LOW);
dur1 = pulseIn(2, HIGH);
distance_cm1 = (dur1 * 0.034) / 2.0;
if (distance_cm1 <= 150 && distance_cm0 >= 0) {
digitalWrite(12, HIGH);
} else {
digitalWrite(12, LOW);
}
digitalWrite(5, LOW);
delayMicroseconds(2);
digitalWrite(5, HIGH);
delayMicroseconds(10);
digitalWrite(5, LOW);
dur2 = pulseIn(4, HIGH);
distance_cm2 = (dur2 * 0.034) / 2.0;
if (distance_cm2 <= 150 && distance_cm0 >= 0) {
digitalWrite(13, HIGH);
} else {
digitalWrite(13, LOW);
}
}
This project fosters accessibility and safety, making it particularly useful for individuals with visual impairments or those navigating unfamiliar environments.