After completing the experiment, the buzzer is not beeping at all. Attaching picture for reference.
I have made changes to the ping code and uploaded code to the buzzer as well.
Is this code correct?
const int trigPin = 7;
const int echoPin = 8;
void setup() {
Serial.begin(9600);
pinMode(trigPin,OUTPUT);
pinMode(echoPin,INPUT);
}
void loop() {
long duration, inches, cm;
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
// convert the time into a distance
inches = microsecondsToInches(duration);
cm = microsecondsToCentimeters(duration);
Serial.print(inches);
Serial.print("in, ");
Serial.print(cm);
Serial.print("cm");
Serial.println();
delay(100);
}
long microsecondsToInches(long microseconds) {
// According to Parallax's datasheet for the PING))), there are 73.746
// microseconds per inch (i.e. sound travels at 1130 feet per second).
// This gives the distance travelled by the ping, outbound and return,
// so we divide by 2 to get the distance of the obstacle.
// See: https://www.parallax.com/package/ping-u ... downloads/
return microseconds / 74 / 2;
}
long microsecondsToCentimeters(long microseconds) {
return microseconds / 29 / 2;
}
I'm also not sure how to test using breadboard version of the experiment i don't see any video tutorial or a good diagram to outline wires and connections properly.
Moderator Note:
SB Project: https://www.sciencebuddies.org/science- ... ng-glasses
SB Videos: https://www.sciencebuddies.org/science- ... an-arduino
Build obstacle detecting glasses for visually impaired people
Moderators: AmyCowen, kgudger, bfinio, MadelineB, Moderators
-
unsajatoi
- Posts: 2
- Joined: Thu Oct 15, 2026 5:58 pm
- Occupation: Parent
-
calixte
- Student Expert
- Posts: 51
- Joined: Tue Oct 01, 2024 9:42 pm
- Occupation: Student
Re: Build obstacle detecting glasses for visually impaired people
Hi!
The problem is that your code measures the distance to objects but never tells the buzzer to beep! Here's what I'd try: First, check that your wires match the pins in your code (the project uses pins 6 and 7 for the sensor and 11 for the buzzer). Next, open the Serial Monitor and see if the distance numbers change when you move your hand. Then, try testing the buzzer by itself using Step 20 of the arduino guide(https://www.sciencebuddies.org/science- ... an-arduino). Finally, try using the example code in the project's "Test the Code" section, which includes instructions for the buzzer. You got this!
The problem is that your code measures the distance to objects but never tells the buzzer to beep! Here's what I'd try: First, check that your wires match the pins in your code (the project uses pins 6 and 7 for the sensor and 11 for the buzzer). Next, open the Serial Monitor and see if the distance numbers change when you move your hand. Then, try testing the buzzer by itself using Step 20 of the arduino guide(https://www.sciencebuddies.org/science- ... an-arduino). Finally, try using the example code in the project's "Test the Code" section, which includes instructions for the buzzer. You got this!

