Roanoke Robotics & Makers Club of Southwest Virginia Message Board › Improved drivers for ping))) style ultrasonic distance sensors

Improved drivers for ping))) style ultrasonic distance sensors

Tim B.
Tim_Brandsberg
Goode, VA
Post #: 2
One of the problems with the ping sensor is that if it does not receive back an echo, it will wait a long time before giving up. This can really slow down the rest of the sketch loop processing. I found a new driver that limits the distance and time that it will wait for a response.
The improved driver for ping))) style ultrasonic distance sensors can be found at:

http://code.google.co...­

Tim Brandsberg
Gary Y.
user 38202422
Roanoke, VA
Post #: 6
Very helpful, thank you.
A former member
Post #: 2
These can be improved further using the pin change interrupts, as shown here. Unfortunately, the code you need depends on the variant of Arduino that you're using, so it's difficult to make a general library that works on all arduinos.
Gary Y.
user 38202422
Roanoke, VA
Post #: 39
Finally had a chance to use it with an HC-SR04 ping module. Oh yeah - using with an ARDUINO NANO
Ping Distance : 2cm - 500cm, I only see it working to ~ 100cm. Sensor : max 15 deg so it better be directly in front of it. The reflection angle has a big effect, ( if it hits something at a 45 degree angle, signal doesnt come back to sensor. Same as hardness of target. ) Now for the NewPing 1.5 program itself: I had to slow the serial port baud rate down to 9600 (from 115000) and increase the delay time to 1 second for testing. I put an LED on the ECHO pin, which was cool, the pulse width is widest at maximum distance , so the LED brightness at flash gives you an idea what it is seeing, Bright far away, dim is close. Helps to give you feedback the sensor is working ( and maybe your code isnt)
Mark S.
user 140724882
Roanoke, VA
Post #: 1
I've had good success with combining the Echo and Trigger pins on the HC-SR04 into just one Arduino pin using a 2.2 kohm resistor. For less than $3 you can get the functionality of a $30 Ping. I'm looking forward to trying the interrupt scheme described here: http://homediyelectro...­
Gary Y.
user 38202422
Roanoke, VA
Post #: 44
Fantastic. Would enjoy a presentation of this at the next meeting if you have time to try it out.
Mark S.
user 140724882
Roanoke, VA
Post #: 4
Fantastic. Would enjoy a presentation of this at the next meeting if you have time to try it out.
In preparation for the robot parade at the end of the month, maybe we can set up a few mini-clinics around the meeting room. Each mini-clinic would focus on one aspect of creating a successful parade bot: getting it to move, getting it to follow a line, making it wait if it's too close to the bot ahead of it, adding some razzle-dazzle, and tying all aspects together. For the ultrasonic "wait" mini-clinic, I would be willing to do a slideshow with live demonstrations on a variety of controller platforms (BASIC Stamp, PICAXE, Arduino, Propeller QuickStart, and fischertechnik).
Gary Y.
user 38202422
Roanoke, VA
Post #: 45
great idea. Make it so #1. Probably need LegoBot, BoeBot, & Arduino. Need the other club members to respond if they have platform preferences so we provide proper coverage.
Tim B.
Tim_Brandsberg
Goode, VA
Post #: 20
At one time I had a sumo bot that used a single ping))) to find my opponent, but the bot had to spin around to find the opponent. If I lost the return signal because the opponent moved, my bot would not know whether to turn left or right. It takes at least two sensors to know how to find the opponent.

If one ping is used in the parade, it will be tricky to know that the bot in front has stopped after it has passed around a corner. If the ping is mounted on a servo, it could scan back and forth a small amount to track the robot in front.

Scanning the ping on a servo is too slow for a sumo bot, but OK for the parade.

Tim Brandsberg
Mark S.
user 140724882
Roanoke, VA
Post #: 5
Thanks for the great advice, Tim! I'll be sure to use it in my portion of the May 3 meeting presentation.

Powered by mvnForum

Our Sponsors

  • Files Page

    Not a sponsor - Link to our files page.

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy