I have several HC-SR04 sonars attached to a NVIDIA Jetson TX1 and they all work well with one exception. If I just have them mounted in their brackets, I get no or false readings most of the time. The minute I touch or hold one in my hand, the sonar runs perfectly. I am assuming this is some type of grounding issue but not sure how to resolve. I have tried several of the ground pins on the TX1 J21 GPIO connector as well as swapping the 5v pins, etc = always the same problem. The minute I touch/hold the sonar, it runs prefect? Any ideas? Thank you ahead of time.
One thought is to differentiate between whether capacitance is fixing it or if it is physical pressure. In the case of physical pressure you could apply pressure with something non-conductive (such as an ordinary wooden stick) and see if pressure changes anything…if so you have a physical defect in the device or a cold solder joint.
If you touch the unit and the fix is because of capacitive coupling, then you are looking at an AC line being at fault and can ignore DC/power coupling. Suppose for example you have a surface mount capacitor with a cold joint on one side…holding the part near the cold joint might momentarily fix the problem with the AC signal passing through the hand holding the device.
Thank you for the suggestions. It is not a pressure issue and I think I may have a clue but any ideas are welcome. I used the same circuit that I had to my Raspberry Pi (https://www.modmypi.com/blog/hc-sr04-ultrasonic-range-sensor-on-the-raspberry-pi). I setup the HC-SR04 straight to the TX1 (no resistors) and it performed like it should. Touching it did not make any difference.
However, my ignorance here is great so according to the RPi doc, the reason for the resistors is “the signal it outputs needs to be converted from 5V to 3.3V so as not to damage our Raspberry Pi”. Is this any concern for the TX1?
Yes, this matters. 3.3V would be correct for several of the I/O lines. There is a jumper for some I/O to be 1.8V, but by default 3.3V is correct…direct 5V could cause damage on the TX1 (if the ability of the sonar to deliver current is low enough it wouldn’t destroy anything, but it would be risky). Incorrect resistor values with too low of a voltage could cause a lack of function fixed by holding on to the part (increased capacitive coupling would essentially increase voltages for the AC component). Using no resistors is bad if this is 5V.
Any idea how that circuit should look between the HC-SR04 ad the TX1?
Do you have an oscilloscope where you can verify the actual exact output of the pulse from the sonar as truly 5V? Sometimes levels are generalized and can be off slightly (e.g., perhaps the 5V is 4.8V or 5.1V). If we take things literally though, using that URL’s information and R2 as 2k:
(3.3/5.0) = (2000/(2000+R1)
R1 = (2000 / (3.3/5.0)) - 2000
R1 = 1030
(the values in the URL probably will work, but you also don’t know if the 3k ohm total load will drop the output somewhat from the incoming pulses)
I suspect those resistances are low enough the Jetson should work with that provided the incoming pulses really are 5V.