Ultrasonic sensor SR04 attached to a cable..??

Hi all,

I have an ultrasonic sensor attached to the Arduino with a sketch that calibrates the distance and after that, it triggers a signal when something crosses the detector.

When the detector is attached to the breadboard everything is fine. I've put the sensor into a case with a cable (aprox 1,2 meters). When the cable is extended, everything is fine, however if I leave some cable still rolled on itself, it detects no motion.

The sad thing is I read about somthing like that but at that point I wasn't interested in US sensors so I didn't pay much attention and now I seem unable to find the article/blog/post about it. I would really much like to know why does it happen and whether or not can I do something to improve the design.

Thanks in advance.

When the cable is extended, everything is fine, however if I leave some cable still rolled on itself, it detects no motion.

My gut feeling is that the coiled cable has an inductive/capacitive effect and is affecting the signal from the sensor, as in attenuating it. Did you move only the transducer or the tranducer and driver electronics on the small board? Assuming it looks like http://www.ebay.com/itm/like/150779439558?lpid=82 If the entire board is extended, the issue is Triggerr/Echo (or both) attenuation.

You "may" be able to utilize 2-pair twisted low-cap cable. The device was really never intended to be far from the uC and T & E are non-balanced inputs/outputs. If you can find a length of 600 Ohm cable, use Vcc & trigger as one twisted pair and Echo & ground as the other. Put a 10 uF capacitor AND a 0.01 ceramic capacitor across Vcc-Ground at the HC-SR04, observing polarity for the electrolytic.

Good luck on this. A dual trace scope would be really useful to "see" the pulses when the cable was extended and coiled.

Ray

wow, thanks for your explanation.

The cable I'm using is like this one: http://www.conrad.de/ce/de/product/607968/Mikrofonkabel-2-x-014-mm-Schwarz-Meterware-LappKabel

I will try to wire it up as you suggested and, if it doesn't work, I will have to live with it. The cable is supposed to be extended anyway.

Do you know of any similar US detector that would be more suited to be on a cable? That would be the easiest solution of all, I guess.

The cable in the link is shielded microphone cable, medium quality. How it is compounded with conductor twists is not noted.

Just for grins, take an Ethernet cable and sacrifice it. Then wire it as I suggested earlier, with the two pulse signals in separate twists.

Ray

marcalcc: Do you know of any similar US detector that would be more suited to be on a cable? That would be the easiest solution of all, I guess.

Are you prepared to spend some money?

http://www.maxbotix.com/

They sell a variety of sensors that can be connected via usb, RS-232 serial, and i2c - of those, for the Arduino, I'd go with RS-232.

I have the same problem with a HC-SR04 on about 4 feet of twisted cat5 cable. There would be erratic distance read errors with the cable but none without the cable.

mrburnette's suggestion to wire the two pulse signals in different twists along with decoupling the power at the HC-SR04 with a 10 uF capacitor AND a 0.01 ceramic capacitor across Vcc-Ground worked magically.

The two capacitors alone very slightly decreased the number of erratic readings.

Wiring the two pulse signals in different twists is what made all the difference. Just the twists alone, without using the capacitors, appears to work just as well as with the capacitors.

I’m surprised that the HC-SR04 has issues like that - IIRC neither the trigger nor echo are particularly weak signals - you’ve ruled out a loose connection?

For clarity, are you saying you have the complete HC-SR04 module on the end of a cable? Or do you have only the ultrasonic sensors?

If you have a complete HC-SR04 module misbehaving I would be surprised. The signals are not that fast, the impedances are low and the signal level is high.

I would agree with mrburnette, start by adding a pair of capacitors at the HC-SR04 power inputs. A 10µf in parallel with a 0.1µf would be a good test.

Also what duration is your trigger pulse? Is it the full 10µSec?