Have any of you tried out your new Ultrasonic sensors?
I ordered ten of them. Nine were "HC-SR04" units and one was a "HC-SR05" unit.
Both the '04 and '05 units need a low trigger signal with the echo line being pulled high by the unit to indicate the distance. Pings use a high pulse as a trigger.
Three of my '04 units don't work.
I'm using these with a Propeller. Since these are 5V devices, I initally used a 10K ohm series resistor on both the trigger and echo line. I had to reduce the resistor value to 1K ohms on the trigger line (it didn't work with a 10K).
I'm attaching the code I used to test these. The code assumes you're using one of these little displays. Just change the TX pin, in the FullDuplexSerial start call, to 30, if you want to use it with a terminal program.
Edit: I'm attaching updated code to use these sensors with a Propeller. The new version of code uses a terminal window for output.
Tonight I got brave and tied the mystery out pin right to ground and tried to use the trigger pin as a combination trigger and echo. No luck, so I tried the echo pin as the combination, and again no luck. I went back to four pin mode and all was well.
But a question dawned on me. What if you used a pair of diodes to connect a single pin to trigger and echo. Would it now work with a single pin? I have had enough experimenting for one night, but I may try this soon.
Gordon, there was a hackaday article recently about reverse engineering those parking sensors. Turns out they use custom chips that go straight to the vehicle CAN bus, and it takes a fair amount of work to fool them into thinking they're in a car and in the right mode to make them function.
What if you used a pair of diodes to connect a single pin to trigger and echo. Would it now work with a single pin?
Curiosity got the better of me and I tried it. The return echo signal through a diode works fine, but not the trigger signal. I suspect the voltage drop across the diode prevents the sensor from seeing the trigger pulse.
Curiosity got the better of me and I tried it. The return echo signal through a diode works fine, but not the trigger signal. I suspect the voltage drop across the diode prevents the sensor from seeing the trigger pulse.
Didja use a regular diode (0.7V drop) or a Schottky diode (0.3V drop)? Might make a difference. Schottkys are cheap and worth having a few in your drawer.
Didja use a regular diode (0.7V drop) or a Schottky diode (0.3V drop)? Might make a difference. Schottkys are cheap and worth having a few in your drawer.
I'm going to order 8. At ~$3.50, that's 8 for the price of 1 PING. Of course, the quality is not near as good, but if you want your robot to have 360 degree vision, it's perfect.
Except, apparently.... this one is not suitable for use with electricity or the "normal work" will not be obtained.
"Note : This module is not suitable to connect with electric power, if you need to connect this
module with electronic power,then let the GND terminal of this module to be connected
first,otherwise, it will affect the normal work of the module"
ok so i just got some of these and im tryin to figure out exactly how these work i would think there would be a pdf or something. are they exactly like a ping with a send and recive pin?
i just wanna know how to pulse the thing what pins need to be hi low etc, and how to read the feedback, not looking for any specific code really
Comments
I ordered ten of them. Nine were "HC-SR04" units and one was a "HC-SR05" unit.
Both the '04 and '05 units need a low trigger signal with the echo line being pulled high by the unit to indicate the distance. Pings use a high pulse as a trigger.
Three of my '04 units don't work.
I'm using these with a Propeller. Since these are 5V devices, I initally used a 10K ohm series resistor on both the trigger and echo line. I had to reduce the resistor value to 1K ohms on the trigger line (it didn't work with a 10K).
I'm attaching the code I used to test these. The code assumes you're using one of these little displays. Just change the TX pin, in the FullDuplexSerial start call, to 30, if you want to use it with a terminal program.
Edit: I'm attaching updated code to use these sensors with a Propeller. The new version of code uses a terminal window for output.
But a question dawned on me. What if you used a pair of diodes to connect a single pin to trigger and echo. Would it now work with a single pin? I have had enough experimenting for one night, but I may try this soon.
Curiosity got the better of me and I tried it. The return echo signal through a diode works fine, but not the trigger signal. I suspect the voltage drop across the diode prevents the sensor from seeing the trigger pulse.
Didja use a regular diode (0.7V drop) or a Schottky diode (0.3V drop)? Might make a difference. Schottkys are cheap and worth having a few in your drawer.
http://www.ebay.com/itm/10-x-1N5817-Diode-Schottky-1A-20V-Free-Shipping-/320855210051?pt=LH_DefaultDomain_0&hash=item4ab475f843
I used a regular diode. You're right a Schottky may be worth a try. I don't have any on hand, but I will fix this shortly.
http://letsmakerobots.com/node/20331
Interesting way to multiplex an output with two different devices that use an output in different ways.
http://www.ebay.com/itm/250973476855
http://www.ebay.com/itm/ws/eBayISAPI.dll?ViewItem&item=280864218549&ssPageName=ADME:B:EOIBSA:US:3160
At that price, it's cheaper to mount several sensors pointed in different fixed directions than one sensor mounted on a servo...
I can see a very paranoid robot in the making!!
Moore's law applies to sensors now.
I guess I'd rather have 5 sensors than some crummy old lunch today anyway!
It's the erco Ebay Diet - lose inches and dollars gain parts! Do it for the children!!
erco,
Do you still have the code you used?
tomchaps is looking for some code to use these with a BS2.
He asked about it in the Propeller forum.
Except, apparently.... this one is not suitable for use with electricity or the "normal work" will not be obtained.
"Note : This module is not suitable to connect with electric power, if you need to connect this
module with electronic power,then let the GND terminal of this module to be connected
first,otherwise, it will affect the normal work of the module"
http://www.ebay.com/itm/1pcs-Ultrasonic-Module-HC-SR04-Distance-Measuring-Transducer-Sensor-for-Arduino-/261009210866?pt=LH_DefaultDomain_0&hash=item3cc55c7df2
@
$1.98 or less (make offer) free ship!
http://www.ebay.com/itm/HC-SR04-ultrasonic-sensor-distance-measuring-module-NEW-/270961553818?pt=LH_DefaultDomain_0&hash=item3f1691319a
Arrrr. The race isn't over yet erco! $1.94 ea for a 5-pack...
http://www.ebay.com/itm/5Pcs-Ultrasonic-Module-HC-SR04-Distance-Measuring-Transducer-Sensor-for-Arduino-/140763883586?pt=LH_DefaultDomain_0&hash=item20c62e6842
@
Your sellers's ten-pack is TWICE as good as his five pack, especially since the sensors are only $1.91 each!
http://www.ebay.com/itm/10-x-Ultrasonic-Module-HC-SR04-Distance-Measuring-Transducer-Sensor-for-Arduino-/130705106799?pt=LH_DefaultDomain_0&hash=item1e6ea1a76f
i just wanna know how to pulse the thing what pins need to be hi low etc, and how to read the feedback, not looking for any specific code really