Need quiet(er) servo to use with PING Sonar, any recommendations?

Hi, I've run into an issue with my PING sonar scanning on my Arduino robotics project. The Parallax standard servo I mounted it to tends to get noisy, and it appears that the noise is causing the PING sonar sensor to report back back reads. I've tried two different Parallax standard servos (same kind, just different units) and found each to have it's own unique noise characteristics, but in both cases, was too noisy and caused problems with the PING sensor readings (sometimes after moving the servo to the next scan position, there remains a humm even after servo has stopped at target position, and that's throwing off the sonar; in the cases where the servo stops and is silent, PING sonar works as expected). Does anyone have a suggestion on a quieter servo to use for this application? It's a personal robotics project, so I'm not looking to get into the expensive servos if possible. I need a servo that rotates a minimum of 180 degrees. I'm not married to the idea that it has to be mounted to a servo if someone has a better idea, but the servo replacement needs to be in about the same size form factor. Thanks in advance for your thoughts, -- Nick

It probably is not the servo using pulseIn() and the standard servo library can cause problems just as you are describing. try using the servo detach function when your done using the servo and see if that fixes it.

Thanks much for the suggestion. That did appear to be the problem as it does solve the issue, the servo does go quiet. Problem with this workaround is that I have to delay 700mS between the acquire and detach or it stops the servo before it reaches it's final position (since I now have to attach and detach between each target rotation angle/position).

sonarServo.attach(9); theServo->write(pos); // tell servo to go to position in variable 'pos' delay(700); // give time to get to position or detach will stop rotation early sonarServo.detach(); // detach servo to keep it quiet for next PING scan :(

This is extremely painful when scanning a 180 degree area (even if it scans at 5 degree intervals, that ends up being more than 25 seconds to scan 180 degrees, not including actual PING scan time at each stop along the way). Can you give me anymore detail as to the bug this is working around, or any other possible ways to address or work around this without sacrificing so much scan time? I'm using Arduino 1.0.1 on a Mac and it's using a Servo.cpp file that's "Version 2" from 2009. Is there a newer library out there? Poking around on this site, I found code for a Servo.cpp that had a "servo::refresh()" call in it that my version doesn't seem to have, although the version with the "refresh()" looked much less complicated, but contained no versioning information. Thanks, -- Nick

even if it scans at 5 degree intervals,

What is the beam angle of a Ping?
(Remember the angle between two minute marks on a clock face is six degrees)

That's a good point and gave me an idea on saving some time (which is where you were going with this I'm guessing). Comments I've seen says 40 degrees (PING says "narrow beam angle" in their spec, but I found a number in another question in this forum). I can break up the initial 180 degrees into 5 sectors as a quick first-pass to narrow the search range to a 40 degree quadrant. Then I could disect that 40 degree quadrant into 5 degree chunks (or whatever the MIN_ANGLE_DELTA ends up being). That would cut the number of scans down to 13 scans instead of 36. Thanks for that idea :) Unfortunately, that's still a 9+ second scan cycle :(

Have you considered putting the ping sensor on a small gear reduction stepper motor?

Something like this: http://www.ebay.ca/itm/170781372685?ssPageName=STRK:MEWAX:IT&_trksid=p3984.m1423.l2649

if you use a servo driver and take the servo processing off the Arduino it will work with out the detach.

What are your power supply and grounding arrangements?

Stepper motor is an idea, haven't played with one yet but will order a couple to experiment with.

Power supply is 4 AA batteries, but also run it at times with an additional solar shield with 1000mAH 3.7v battery added to the mix. Grounding uses Arduino ground, power for servo uses +5v Arduino pin (all mounted on a mobile tank chassis - see avatar).

I was looking at the servo code, and had a thought. Can I connect the supply power for the servo to a digital out pin on the Arduino instead of the 5v out pin, and then simply drive that low instead of detach(), and drive it high instead of attach() (I'd do an initial attach() in setup(), like you normally would, but not before each and every rotate; instead, I'd just power on the servo before rotating, rotate it, and power it off, leaving servo "attach()"ed the entire time) ? There doesn't appear to be any "reading" from the servo part, only output to the servo, so I'm thinking I can just power the servo off, but leave the code believing it's on and attached under assumption that without reads, the code wouldn't hang waiting on any responses, but instead would just drive a signal line connected to a non-powered device. Would this work without damaging the servo? I'm tempted just to try this, but figured I'd ask and may save myself the cost of a fried servo.

Can I connect the supply power for the servo to a digital out pin on the Arduino instead of the 5v out pin, and then simply drive that low instead of detach(), and drive it high inst

Some here on the forum would say yes, go ahead, you won't damage your AVR in any way, powering your servo through an I/O pin.

The sensible ones would say don't even think about it. What happens when you simply detach?

I'm tempted just to try this, but figured I'd ask and may save myself the cost of a fried servo.

You'll be happy to know your servo would survive. Not so your Arduino.

Phew, glad I asked ! When I detach, it works fine. But as noted above, it leaves for a very time consuming 180 degree scan cycle.

It used to work much better (servo did not make as much noise) earlier on in my project, but seems to have gotten worse. I have added other circuits since then that draws a little more power, but wouldn’t think it to be that much (the only active power draw is a Parallax sound impact sensor, which is a 5v part but spec doesn’t list mA draw); other circuitry a push button and led, neither drawing power in this scenario).

If I can figure out why I have to delay 700mS before detaching and figure out how to get around that, the detach() solution would work very nicely.

If I can figure out why I have to delay 700mS before detaching and figure out how to get around that, the detach() solution would work very nicely.

If you, who can see the code, can't figure it out, how can we, who can't see the code, be expected to help?