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 ]
Obstacle Detecting Glasses
Moderators: kgudger, bfinio, MadelineB, Moderators
-
amyCC
- Site Admin
- Posts: 398
- Joined: Wed Apr 01, 2020 4:02 pm
- Occupation: Moderator
- Project Question: *
- Project Due Date: *
- Project Status: Not applicable
-
Snehaarun
- Student Expert
- Posts: 26
- Joined: Fri Oct 04, 2024 11:30 pm
- Occupation: Student
Re: Obstacle Detecting Glasses
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)
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/
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)
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/
Last edited by Snehaarun on Mon Jan 13, 2025 11:05 pm, edited 1 time in total.

