HC-SR04 gives max range of ~60 cm

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

I bought some of the same sensors from Ebay for cheap and found that they do not see past about 65cm. It has been said by another user, that some of the sensors are somewhat "blind" compared to others. I think it is a quality issue with the China seller. I have considered cutting the grill out of a sensor to see it if helps.

Look at the thread below for user name Teckel, he is the most experienced with these sensors.

If all you need is 60cm the sensors seem to work fine.

rasmuslp:
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

I have already tested with the simple sketch from the NewPing library, and it didn't help. I guess the sensors are of a too low quality..

rasmuslp:
I have already tested with the simple sketch from the NewPing library, and it didn't help. I guess the sensors are of a too low quality..

Try this, in the NewPing.h file, change the MAX_SENSOR_DELAY to 60000 and any delay between pings to at least 100ms. Some ultrasonic sensors that I've found are adding a huge delay when they don't hear a ping back. If it still doesn't work and the sensor is of no use to you, I'd love to have it to make NewPing as compatible as possible. If I get it working, I'll also send it back. PM me if interested.

Tim

Hi, Rasmus.

I just had the same issue here. Fortunatelly I had the same code and HC-SR04 sensor working on a Arduino Uno board.

After some tests I found out the problem is the Arduino Nano built it power supply does not have enough power to sustain the HC-SR04 sensor when connected to an USB port.

It was at only 4.6V and this was causing the distance measure error.

I powered the Arduino Nano board with a 9v external battery (pin 30) and it started to work perfectly!

I hope this helps you out.

Barbado.