Hello there buccaneers! I’m in need of some assistance from some electronics-wizards and Explorer pHat experts (I’m looking at you @Gadgetoid).
I’ve been attempting to hook up my HC-SR04 ultrasonic distance sensor to the Explorer pHat for a little bit of robotics, but I’ve been hitting a few walls (mainly my head against them).
With the sensor wired up on a breadboard, I can get the Explorer pHat to take a distance measurement using this code, but it has a very strange requirement. The input reads low constantly on the Envirophat until I plug another jumper cable into the ground slot on the breadboard and smack my finger against it repeatedly. Doing so seems to erratically allow the input to come back to a high value and take a (correct, mind you) distance reading!
I originally thought that my sensor was broken or that my connections were faulty in my breadboard, however, upon further testing using solely the GPIO on both an RPI 3 and the Zero W, I find that the sensor works impeccably!
Consulting with some engineers (namely my farther), I hear that something called “Impedance” may be causing a problem due to a mismatch between the sensor and the pHat, though being a software man myself, I get a headache from diagnosing these kinds of problems.
So, tl;dr: since it works now-and-then when I touch my finger to the ground connection, is the problem something to do with mismatched impedance between the sensor and the pHat, and if so, any ideas on how to measure these impedances and/or fix it entirely?
I thank you for your help! Any necessary pictures etc. I shall be happy to provide as soon as I find a working light!