Hi there,
I just received two HC-SR04 modules that I have been playing around with. I have since noticed that I get a very poor max range on both of these.
I have connected the sensor through a breadboard to my Arduino Nano and used the NewPingExample (from v 1.5). Even though there are no objects in front of the sensor, it shows the distance as between ~60 and ~70 cm for one module and ~55 cm for the other. I have tried another simpler library (Ultrasonic), different pins, and different positions in the breadboard, but nothing have helped.
I'm quite sure that I at some point during my tinkering have seen values higher than this, but I simply cannot reproduce that now.
The sensors were bought of eBay, is this issue simply because the sensors are of poor quality ?
I'm open to suggestions if anybody have an idea that can help me.
Regards,
Rasmus
Try using my
NewPing Library which uses direct port register calls to calculate distance. All other libraries out there use PulseIn to measure the distance. This is a terrible idea and gives results that are all over the place. Range can also be effected by using other libraries and/or using PulseIn. When first using NewPing, be sure to use the sample sketch which uses pins 11 and 12 to avoid complicating things. NewPing is very simple to use, as the example sketch shows.
Tim