“It’s only software!” A sentence that strikes terror in the heart of an embedded systems software developer. That sentence is often uttered when the software person finds a bug in the hardware and others assume it’s going to be easier for fix in software rather than spin a new hardware revision. No wonder software is always late.
[Clint Stevenson] is his own hardware and software guy, as are most of us. He wanted to use the less expensive HC-SR04 ultrasonic rangefinder in a prototype. Longer term he wanted to have the choice of either a Parallax PING or MaxBotix ultrasonic sensor for their better performance outdoors. His hardware hack of the SR04 made this a software problem which he also managed to solve!
[Clint] was working with the Arduino library, based on the Parallax PING, which uses a single pin for trigger and echo. The HC-SR04 uses separate pins. Originally he modified the Arduino library to accept the two pin approach. But with his long term goal in mind, he also modified the HC-SR04 sensor by removing the on-board pull-up resistor and adding a new one on the connector side to combine the signals. That gave him an SR04 that worked with the single-pin based library.
We’ve seen Parallax PING projects for sensing water depth and to generate music. These could be hacked to use the HC-SR04 using [Clint’s] techniques.
[Arduino and HC-SR04 photo from Blax Lab]
there’s a typo in your post: http://www.blaxlab.com/%5D
Arduino and HC-SR04 photo from http://www.blaxlab.com/2015/06/connecting-and-programming-hc-sr04.html
Weird formatting issue. Thanks, fixed.
You can choose between the one or two pin approach with the HY-SRF05 Ultrasonic sensors which cost roughly the same as the HC-SR04, so it seems a little odd to hack the SR04 instead of picking up the SRF05. I’m going to guess this was someone who already had a stack of SR04’s laying around.
From my last data mining session HC-SR04 are 0.70€ while HY-SRF05 are 1.50€ , so the choice is more like 2 hc-sr04 or one hy-srf05?
You are correct. Been a while since I picked up any and the prices were closer to the same at that time.
Last time I used an HC-SR04 with a Teensy, I just wired the TRIG and ECHO pins together and told the NewPing Arduino library to use the same pin for both functions. I’m not sure where I read about that trick, but it worked for me.
You can also use a 1k and not have to modify the module at all.