sunglasses that provide benefits beyond only shielding the blind’s eyes. They can support their ability to perceive things in front of them.
SUPPLIES AND PARTS
- SparkFun Arduino Pro Mini 328 – 5V/16MHz
- Ultrasonic Sensor – HC-SR04 (Generic)
- Buzzer
- Jumper wires (generic)
- Sunglasses
TOOLS AND MACHINES REQUIRED
- Soldering iron (generic)
- Hot glue gun (generic)
ONLINE SERVICES AND APPS
- Arduino IDE
Description
The HC-SR04 ultrasonic sensor and an Arduino Pro Mini microcontroller are used in this Arduino code. With this code, any Arduino microcontroller may be used.
By converting the milliseconds it takes for sound waves to bounce back into centimetres, the algorithm can calculate distance.
If an item is within 62 cm of it, it beeps sporadically (about 2 feet). One continuous, loud beep tone may be heard at a distance of 31 cm (or roughly 1 foot).
The code is fairly straightforward because it just makes use of the hardware libraries that come with the Arduino IDE.
Code
#define trigPin 8 // These lines assign names to values
#define echoPin 7 // so they can be easily identified.
#define buzzer 12 // These are set before the code
/* This section of code below runs only one time.
* It enables the serial monitor to see output and
* sets the pins to input or output.
*/
void setup() {
Serial.begin (9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(buzzer, OUTPUT);
}
/* The remaining part of the code runs in a constant loop.
* It triggers the ultrasonic sensor and calculates the
* time it took for the sound waves to return. It converts
* the time in milliseconds into distance in centimeters.
*/
void loop() {
long duration, distance;
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration/2) / 29.1;
Serial.print(distance);
Serial.println(" cm");
// This part of the code below determines whether to
// beep depending on the distance detected. If the object
// is within 62 start the beeps.
if (distance > 30 and distance < 62) {
tone(buzzer,100,50); // Intermitten beeps
}
if (distance > 0 and distance < 31) {
tone(buzzer,100); // Long solid beep
}
else {
}
delay (500);
}
SCHEMATICS
This is the ultrasonic glasses’ schematic. The HC-SR04 ultrasonic sensor and an Arduino Pro Mini are both utilised. An 9V battery is used to power it.
The lion of the circus is not the king
kp
“Don’t waste your TIME” – kp
No one will understand your vision, If you want to be successful just follow your passion by executing it because vision without execution is a delusion and there is no success without risk
kp
“Don’t feel shy if you are not wrong” – kp
Helping Hands.