1
\$\begingroup\$

I am using an Arduino on a breadboard setup with an ATMEGA328p MCU. The whole circuit is designed to work in a low-power state and is powered using a 3 V (nominal) Coin Cell.

The HC-SR04 is getting a stable power supply of 5 V from another source (grounds are already common).

However, the issue is that triggering the sensor from the MCU gives no output reading and the distance is returned as 0. I checked the voltage level on the trigger pin and found it to be 2.5-2.6 V

Since the battery I am using is a coin cell I suspect that the voltage is dropping from the nominal value of 3 V to 2.5 V and the HC-SR04 demands a TTL pulse on the trigger pin. Is it not working because it's not being properly triggered by the 2.5 V pulse? I checked some resources and they mentioned that 2.5 V is within the High Level Margin of the TTL signal, so a 2.5 V level pulse should be able to trigger the sensor. Or is my assumption wrong?

\$\endgroup\$
1

2 Answers 2

0
\$\begingroup\$

Like most CMOS except 74HCTxx series the input threshold is Vdd/2 +/- 40% over entire temp on some units.

This requires a level shifter.

You can choose many options :

  • an IC to levelshift inverting or not
  • an RC:R pullup network to shift from 1V to 4 V with some T=RC > pulse width using R’s between 100k and 10M to choose ratio for the “0” output level and C to boost the pulse by 3V thus shifted.
  • it depends on you power consumption specs

Added to prove my assumptions

Often many poor Chinese specs and others say TTL input to mean 5V TTL logic compatible, because the null current static CMOS load will increase the signal swing of TTL rated VOh,Vol limits. But 5V CMOS is what they actually have so the input bias threshold is Vdd/2 +/-6.7% nom 25'C upto 40% for -40 to 85'C (NXP)

So I looked for the schematic to confirm my assumptions and found they were valid. enter image description here

\$\endgroup\$
4
  • \$\begingroup\$ So you believe that the 2.5V voltage signal is not the correct High level for TTL. \$\endgroup\$
    – Marry35
    Commented Jun 13, 2018 at 20:30
  • \$\begingroup\$ The spec says 5V so I infer it is std CMOS logic \$\endgroup\$ Commented Jun 13, 2018 at 20:35
  • \$\begingroup\$ No, the sensor actually works on TTL Logic. \$\endgroup\$
    – Marry35
    Commented Jun 13, 2018 at 20:37
  • \$\begingroup\$ @Mary35 no, it is definitely not actual TTL, you are reading too much into a bad specification of a hobby product. Under normal circumstances it would be TTL compatible but your circumstances are abnormal \$\endgroup\$ Commented Oct 19, 2020 at 10:52
0
\$\begingroup\$

You seem to be sending the pulse signal to the HC-SR04 at acceptable levels for "high" at 2.5V, assuming you have measured that correctly, the range being 2 to 5V. That should have triggered the sensor as desired. Have you tried using a different HC-SR04. I have used this sensor with an ESP8266 running off 3V and it has been working fine. I see that the trigger pulse in my case is about 2.65 or 2.7V. If you haven't checked if this is a problem with the sensor, I would suggest you try checking it out with an HC-SR04 from a different source.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.