I have a new prototype board undergoing testing and it comes with new code
I really don't like not being able to handle the sensors that lock up (see previous log) nor do I like that even the "good" ones make you wait 200ms when they get no echo. So I reworked the echo circuitry replacing the 8-way OR gate with 8 tri-state buffers. The trick is to ignore the spec sheet where it says the trigger pulse must be 10us and assume that that is a minimum - we're already doing 240us with the I2C flap. Instead we assume that the important thing to the HC-SR04 is the falling edge, and then hold the pin down for the duration. We then use that signal to enable the tri-state buffer attached to the matching Echo signal.
So far, it seems to work - both the "good" and "bad" sensors can by cycled through on a 50ms rotation - with or without echo returns.
The really good news is that the "bad" sensors come back to life after they get a good trig-echo cycle.
Bonus feature: it *should* work with 3.3V controllers e.g. Raspberry PI, with a 3.3V VCC and separate 5V feed to power the sensors. Untested as yet, but soon....
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.