Asked — Edited
Resolved Resolved by Rich!

Sonar Distance Sensor

Does anyone else have issues with their sonar sensors fluctuating to read 255? The sensors work and they do provide distance values as I move an object in front of them, but every few seconds the readings jump to 255. It does this on my hc-sr04 sensors and Parallax PING sensors. Is this normal?

I'm not using the radar scan. I'm using either the distance or the collision avoidance controls with the sensor and not both at the same time.


Upgrade to ARC Pro

ARC Pro is more than a tool; it's a creative playground for robot enthusiasts, where you can turn your wildest ideas into reality.

United Kingdom

Yep. That was my one gripe with the ping sensors.

I believe it may be down to one or more of a few things;

  1. Sonar sensors struggle to detect some materials. Sound absorbing materials are no good in this case.
  2. Lost echoes and ghost echoes...

    User-inserted image

  3. I read somewhere that the voltage supplying the sensor needs to be dead on for it to work correctly.
  4. Poor quality wires - there are reports of some people using cheap Chinese cables to wire these and having problems, re-wiring with better quality solved the problem.

This is why I use IR and Ping. IR has it's pros and cons too but combine both and overall it's the best of both worlds.


I use (albeit pricey) devantech srf05 pings... they seem to be stable as I can't say I have seen the random 255 readings....


yes i have had same issue , my solution was to take 6 pings . drop the the 2 most of of range of the others. Use a mean of the remainder to plot object.


Hc sr04 ultrasonic sensors are notorious for easily being damaged if you accidentally connect a ping to a power and power to ping pin. Then they read a minimal amount or max 255 at that point. Based on public reputations maxbotics has the nicest ultrasonic sensors. A single sender and receiver and built in filter to reduce false readings from echos between triggered pings.

I do use the hcsr04 myself though because I can buy 5 sets and two are pretty good while the others are off.

There are intelligent ways to wait a few milliseconds between pings , pause then trigger and read echo. Once that first echo is read it waits a few milliseconds before triggering another ping.

Rich is absolutely right about the echo issue in a corner or on a edge. A SHARP I distance module uses angle of light transmission and receive angle to measure the distance. It's the most accurate but doesn't work against black very well or outdoors. Using a sharp module directly above the ultrasonic ping gives the best of both worlds. You can have script average the readings between the two I believe for better accuracy. That's something I have seen other hobbiest play with. Ezb combined with a pc has plenty of power to make the basic calculations.quickly.


That is why one should have PING and IR. And a Laser or Xtion would not hurt if you are serious about navigation.