Help with beeper on walking stick

Ask questions about projects relating to: aerodynamics or hydrodynamics, astronomy, chemistry, electricity, electronics, physics, or engineering

Moderators: AmyCowen, kgudger, bfinio, MadelineB, Moderators

Post Reply
kf2gkf2g
Posts: 1
Joined: Mon Dec 15, 2025 11:34 am
Occupation: Parent

Help with beeper on walking stick

Post by kf2gkf2g »

Hello. I am using your walking stick for a science project. We got it to work, and use it sometimes with a beeper and sometimes with a vibrating motor. The beeper or motor does always just beep a little every second until the sensor is close to bleep. Did we do bleep wrong or is there a way to turn that off until we are close to an object? We are using your code.

Thanks. Alec and Dad


Moderator note: https://www.sciencebuddies.org/science- ... king-stick
CarissaP
Student Expert
Posts: 46
Joined: Mon Jan 06, 2025 4:21 pm
Occupation: Student

Re: Help with beeper on walking stick

Post by CarissaP »

Hello,
A walking stick is a great project! It is odd that your beeper makes noise until the sensor is close to bleep. I would suggest double-checking the code to make sure that line 48 says if(cm < threshold){ and not greater than (>). Could you send a picture of your breadboard wiring?
Carissa
amyCC
Site Admin
Posts: 405
Joined: Wed Apr 01, 2020 4:02 pm
Occupation: Moderator
Project Question: *
Project Due Date: *
Project Status: Not applicable

Re: Help with beeper on walking stick

Post by amyCC »

(posted for family)

Hi Carissa - thanks tons for offering to help. If you have suggestions, we will take them. And if not, we can live with the beep. We've checked line 48, it does say cm<threshold. Here is a pic of the breadboard wiring. My son was just more curious than anything else, and I'd love to foster his learning more.
Image (80).jpg
Image (80).jpg (278.01 KiB) Viewed 2757 times
bfinio
Expert
Posts: 964
Joined: Mon Aug 12, 2013 2:41 pm
Occupation: Lead Staff Scientist, Science Buddies
Project Question: Expert
Project Due Date: n/a
Project Status: Not applicable

Re: Help with beeper on walking stick

Post by bfinio »

Hello,

In cases like this, it's useful to use the Arduino's serial monitor to see if you are getting erroneous sensor readings. You can do this with the following steps:

1. Uncomment lines 29 and 62 in the Science Buddies code by deleting the "//" (that's assuming you haven't edited the code or changed the lines at all)
2. Re-upload the code to your Arduino
3. Leave it plugged into the USB cable
4. Select Tools -> Serial Monitor in the Arduino IDE

This should continuously print out the distance measurement in centimeters. Experiment with moving the sensor around, putting different objects in front of it, slightly to the side or above/below it, etc. The sensor works by emitting a pulse of ultrasonic sound and measuring how long it takes to reflect back, but the sound doesn't just travel in a straight line - it spreads out in a cone in front of the sensor, and reflections can bounce off different objects in different ways. For example, if the sensor is very close to the floor, it may be catching some reflections from the floor even if there's nothing directly in "front" of it. So if it occasionally detects a distance below the threshold set in the code, that can result in a beep.

Depending on what you find, you could try changing your code (increasing or decreasing the threshold variable), or changing the physical design of your walking stick to change the position or orientation of the sensor.

If your son wants to explore more, it can be interesting to "calibrate" the sensor. Get a ruler or meter stick and measure the actual distance from the sensor to an object. How does this compare to the value printed out in the serial monitor? How does it change for a hard, flat object like a book vs a soft object like a pillow or stuffed animal? What if you hold the book at a 45 degree angle? And so on. It's a good way to demonstrate how sensor data is not always 100% reliable.

Let us know if you have more questions!
Post Reply

Return to “Grades K-5: Physical Science”