Go Down

Topic: Ultrasonic distance sensor HC-SR04 lack of timeout problem (Read 43559 times) previous topic - next topic


I ran into this today while putting together a blog video for how to daisy-chain my little octosonar board to drive 12 of these little buggers with my sonari2c library (apologies for the plug).

I prototyped all this using SR04s I bought last year from somewhere in China (not banggood - it's not in my purchase history there) and it all works just dandy. Those units don't look like either of the ones pictured above.

The new ones I *did* get from Bangood recently and look like the "bad" ones above (same circuit, narrow silk screen) and my tests/demos were locking up occasionall (I was blaming it on wiring). I finally got to the bottom of this today (reproduce 100% by putting thumb over sensor) and google found this thread.

The most obvious difference between my "good" ones and the "bad" ones is the "bad' ones have 10K pullup resistors on Trig and Echo. My "good" ones do not - very high resistance between Trig, Echo and Vcc,Gnd.

The "good" and "bad" ones above both seem to have the pullups (R1/R2) so they are clones. Sometimes clones have different component values due to the cloners not being as good as the dudes on Kamino.

I tried tying the Echo to ground - seemed to clear it, but I can't do that through my board, nor can I flap the power.

While debugging I connected echo to the LED on my protoshield so I'd have a visual indicator. Bingo. Problem cleared right up. The protoshield has an inline resistor with the LED, but I figured these pulses are short, so how about just connecting a LED directly across Trig and GND. Seems to work....

Can someone else try this and verify?

Also can the guy with the good and bad clones check the resistance on r1/r2 on the "good" ones? I suspect they may be more than 10k i.e. weaker.

Update: I tried a variety of LEDs direct connect and they did not all work. The little red ones with 1.6V forward voltage did not lock up my board, but did not give a signal back from the rogue sensor either - probably pulling the voltage too low for the logic gate.

The rest seem to be 2V forward voltage and work direct without a resistor. All the LEDs fix the issues with a 220 ohm series resistor.

I was thinking of putting blinky activity LEDs on the next version of my board anyway, I think this clinches it.

Why does this work? No idea.


I take it back about the clone thing and cheaper components. A closer squint at the picture DaveEvans posted on Oct 10 tells me these are a clone with fewer components. The overall circuit layout looks almost identical, but there are a lot less capacitors.


Is that an LED and resistor on each sensor?


yes, attached between the sensor echo and ground. I just tried a 1k resistor (no LED) and that worked too.


It occurs to me that those 10K pullups may be supposed to be 10k pull-downs. I got some protoshields last month that had one of the tracks mis-designed and connected Vcc direct to Groun, so dumbassity like this definitely happens in the knock-off world.

If someone could check that on the "good" ones it might explain a lot.


How to solder diode to prevent locking problem. Almost any diode will go (no need such big one, i just didn't have other in my inventory).

Go Up