Open Cenedd opened 1 month ago
Managed to get a trace of a 'standard' HC-SR04
Scale is the same but there are two differences. Firstly the echo is at (nearly) 5V on the HC-SR04 whereas it is 3.3V on the M5Stack. The second is the delay between the trigger and the return. These are on the same scales, by the way. The delay before the response on an HC-SR04 is about 0.5ms - around a tenth of the M5Stack part. Not sure if this could be (clutching at straws here) a delay introduced by sending it via a level shifter to drop it to 3.3V? Anyway, this is the fundamental difference between the two otherwise identical looking parts.
Gareth
Thanks @Cenedd ! I'll give that a whirl when I can grab my IO model next week. Interesting findings, and thanks for sharing the images alongside too 🙏
I fell into the same trap as you seem to have with the I/O version of this sensor. Thought it was faulty until I found your comments that only the i2c version works (with modified code). I couldn't work out why it should be different given their code was very similar:
I managed to get a cheap oscilloscope on it and after much swearing (the software is awful) it looks like there's just a much longer delay (about 42ms) between the trigger pulse and the response pulse. Note the timescale is in milliseconds, not microseconds!
Setting a longer timeout for the default ultrasonic component seems to compensate for this. 8m gives a limited max range or about 0.88m and the occasional complaint about the component blocking. 9 or 10m will allow longer range (at least 1.8m....I ran out of space) but will constantly complain about the component blocking.
Hope that's of some use to someone. Gareth