Page 1 of 1

Obstacle Detecting Glasses

Posted: Mon Jan 13, 2025 10:16 am
by amyCC
Posted on behalf of student
---------------------------------------
Hello, can I ask how I would be able to make an obstacle warning sensor glasses that has 3 sensors in total (one for the front, left, and right side)?

I've been looking for tutorials on how to make this sort of stuff ... mostly (I have found) glasses that had 1 ultrasonic sensor instead of 3.

I have a consultation tomorrow and I know you might not be able to see this email so soon, but I'm really desperate so I'm asking anyone I can.

Thank you.


[Administrator note: Related project: https://www.sciencebuddies.org/science- ... ng-glasses ]

Re: Obstacle Detecting Glasses

Posted: Mon Jan 13, 2025 11:02 pm
by Snehaarun
Hi!

Assuming you are using an Arduino like the Science Buddies tutorial for this project (https://www.sciencebuddies.org/science- ... ng-glasses )…the Arduino does support multiple ultrasonic sensors (especially the Arduino Uno). You would have to connect the ECHO and TRIG pins of the three ultrasonic sensors to different digital pins.

Here’s a circuit diagram for an Arduino with two HC-SRO4 sensors (you would just have to adapt this for 3 sensors)
Circuit Diagram for 2 ultrasonic sensors
Circuit Diagram for 2 ultrasonic sensors
IMG_1689.jpeg (325.49 KiB) Viewed 6285 times


For the code, using the example code from the Science Buddies tutorial is a good place to start.

In order to adapt the code to calculate the distances detected by each ultrasonic sensor, define constant variables for each ECHO and TRIG pin for each sensor, and make sure you set each pin to HIGH and LOW accordingly. Then you can define variables/functions that calculate the distance for each sensor — to do this, calculate the duration for each sensor [pulseIn(echoPin, HIGH)], then do duration / 29 / 2. The pin for ECHO will change per sensor.

These are basic code changes you need to make, but if you need more complete code, let me know and I can help. Or if you need more help with the specific application of your project let me know as well.

These are good tutorials to follow for a circuit that has 3 sensors is linked here as well:
https://tinkercircuits.com/arduino-smar ... detection/
https://www.instructables.com/Arduino-B ... nd-People/