Let's Make Robots! | RobotShop

Start Here Robot with a Twist!

Obstacle Avoidance

This my take on the Start Here robot.  I am sure that you can already spot the differences.  I have used a VEX robotics kit for the structure and drivetrain and I am using an Arduino Uno for control.  The other big difference is the use of the SDM-IO ultrasonic range finder.  The servo used is a Hitec HS-422 servo. I also installed a buzzer that will play a tone proportional to the range of an object.  It will also sound an alarm if an object comes close enough.  The robot will veer if an object is detected near but if it gets too close, the robot will pivot.

The sensing range is divided into 4 quadrants.  If an object is detected at 30 cm in the middle two quadrants then the robot will veer away.  The servo will also return to center and an alarm will sound.  If an object is detected 20 cm or closer in the left or right two quadrants then the robot will pivot away, a different alarm will sound and the servo will return to center.  I am working on the code so that the servo will pan away from the object detected.

The ultrasonic range finder brought its own challenges.  This is my first time working with one. I have found that I was getting false close readings in large open spaces.  Perhaps my pause was too short between scans but now the robot takes the average of three scans at designated servo positions, there are five of them: -60, -30, 0, 30 and 60 degrees.  The buzzer will chirp a high tone for close distances.  On the initial sensor set up, it would scan at much smaller increments.  The tones generated were pretty interesting but the robot would react to false close readings thus making it unpredictable.

The coding in Arduino took a little to figure out.  There were challenges of setting the quadrants, tweaking the drivetrain and making it all work together.  I plan on integrating drop-off sensors at the four corners and an IR receiver to give it the ability to navigate to a beacon. 

I welcome all comments, questions or suggestions. Enjoy!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

I am using HC-SR04's and i have found that i also get a lot of "false positives"  or objects detected that don't really exist.

I wrote a java application to see what the US is looking at...


You'll see in the first few frames the same thing you describe... some of those points don't really exist at all.


same thing here.

I have been using the NewPing library... since i have a 4 pin HC-SR04 instead of a 3 pin parallax PING sensor.




you could slim your pin count required to 3. You might (not) require a resistor between your trigger and echo pins to use a single pin to trigger and read the echo.

That is a really cool java application.  All you need is a bluetooth module and you can kiss the usb cable good bye.

It seems that signal noise may be inherent in US range finders.  This is my first experience with them.  I have included my code on another reply.  It seems to work well for me.

I have a bt module for it but haven't gotten it all integrated yet (will be android controlled). 

I like the idea of averaging the readings, I may try that myself.

Averaging readings is bad. Getting rid of the outliers is a better plan.

** Remember the title of this little reply. :) **

I don't recall the reasoning.

I think that is the way to go.  I thought about that at first but averaging was an easier way to go.  Now I have something else to work on.

The thought behind averaging is that it will skew your result, making the object seem closer than it should.  Just taking the middle value gives you, hopefully, a true reading.

With this application, I am not too worried about ojects farther than 18" away.  It seems the rangefinder works great for distances under 3ft.  When the object is close then the averages are fairly accurate.  Now the question is... How much of variation do you need in order to call it an outlier?