Asked — Edited

Ping Sensor Help

I am having a problem with the ping sensor. I have the sensor hooked up to D8 and D9. I have servos and an H Bridge connected but not doing anything with them.

I am using the ping distance control to view the result and they seem very unstable. With a stationary target the reading are bounce between 16 to 18 (which is probably an accurate value and 255 with half of the reading or more being 255.

The other things that I notice is that it rarely reports a reading higher than 20 unless it is 255. There is fairly linear progression from ~1 to 20 but rarely anything beyond that.

My first question is - Are these values and instability normal? Next question - Are some ports better than others for this purpose? Third question - Can you offer any guidance?

Thanks,

Glen


ARC Pro

Upgrade to ARC Pro

ARC Pro is your passport to a world of endless possibilities in robot programming, waiting for you to explore.

United Kingdom
#1  

Quote:

My first question is - Are these values and instability normal?
No. Something isn't right. Check the wiring of the sensor to ensure there are no shorts and good connection has been made. Some cheaper cables can make the sensor give funny readings too as can low batteries.

Quote:

Next question - Are some ports better than others for this purpose?
No. Each port is pretty much the same. If you are having issues on one port you are likely to get them on another port too. However, ensure you have the echo and trig around the correct way.

Quote:

Third question - Can you offer any guidance?
As above. Check the wiring, check the connections, check the object you are testing with - ultra sonic does not always work. I had problems in my house so changed to IR, which has it's own pitfalls so ended up using both.

#2  

I checked the wiring- good connections and no shorts

I checked the power- 8.6 from the pack and 5.06 at the sensor

The sensor does not seem to sense anything beyond about 25 to 30cm with any predictability.

For a stationary target 13cm from the sensor face, The values range from 12 to 15. I am not sure if the is normal for static use.

I found an object that it could detect at 10cm 100% of the time and moved it to 24cm. If you look at 10 consecutive readings they vary between 23 and 26 and over half of them are 255.

I am not sure what else to do. I wouldn't mind ordering a new sensor but the website is quoting 5 to 7 weeks for delivery and I am still waiting for parts that I ordered in September.

What do you recommend for an ultrasonic sensor? For an IR sensor?

Thanks,

Glen

United Kingdom
#3  

You can pick up the hc-sr04 from ebay or many other online shops for quite cheap.

It may be the wire to the sensor, I've had problems with some of mine before now. The length of the wire made a difference as did the quality of the wire. I found the cheap extensions I got from ebay/china gave me problems. I rewired it with a better extension and the problems went away. I still get some fluctuation in the readings but never any 255s when they shouldn't be.

Sharp IR sensors are what I use, they do a lot of them depending on the range you want to check, but basically any of the IR sensors work well. You need to use scripts to use them though and connect to the ADC ports, unless you pick the exact same one DJ used in the tutorial (for which there is a control).

#4  

The wires are 6" 22AWG. I did change both trigger and echo with no change in result. The occasional 255 reading would be ok but the fact that once you get beyond 20, it rarely reads anything is really leading me to a defective sensor.