0
\$\begingroup\$

I need to monitor the status of a wire in an automotive application that can have 10-40VDC on it at any time. What is a good approach to limit the voltage to a microcontroller input across such a wide range? I plan to use a 10nF cap and TVS for ESD and other transients but I'm not sure the best approach to limit the expected voltage. If I can reliably detect 10V, 40V may burn up the input resistors (or resistor and zener?) or I can limit for 40V and not sense 10V.

The signal is a simple on off status line that I'm tapping into. It won't be carrying any data or change state very often. I will be sampling it occasionally in the micro to determine if it's high (1V to 40V) or low (GND to under 1V).

Thanks.

Edited to add that my microcontroller will be running at 3.3V and a logic low needs to be under 1V. Any solution I use must include a low value cap between the input and GND and either diode clamps to Vdd and GND or a Transil.

\$\endgroup\$
5
  • \$\begingroup\$ You probably should define some hysteresis. A simple threshold might be noisy, though I suppose if you aren't sampling all that often... But still... Probably should have some. \$\endgroup\$
    – jonk
    Commented Feb 27, 2018 at 6:00
  • \$\begingroup\$ Can you confirm that the signal is really 1-40V and not 10-40V? That is, do you need to guarantee that 1V will give you logic high? \$\endgroup\$
    – Selvek
    Commented Feb 27, 2018 at 6:09
  • \$\begingroup\$ @Selvek See mrJand's new post: Dimming And Driving LED Bar With Internal 10-40VDC Driver. May be an XY thing, again. \$\endgroup\$
    – jonk
    Commented Feb 27, 2018 at 6:21
  • \$\begingroup\$ The signal is 10-40V but my microcontroller sees anything above 1V as a logic high. \$\endgroup\$
    – mrJand
    Commented Feb 27, 2018 at 8:06
  • \$\begingroup\$ Divide / 12 is ok? \$\endgroup\$
    – D.A.S.
    Commented Feb 27, 2018 at 8:30

3 Answers 3

1
\$\begingroup\$

Using a resistor and Zener diode will work fine. The simulation below shows what you get with a 4.7V zener.

You can use a very large resistor, because the microcontroller I/O pin draws virtually no current. With a 100kOhm resistor and approximately 5V output voltage, the power dissipation is (40-5)^2 / (100,000) = 12mW, well within what the resistor can handle.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
7
  • \$\begingroup\$ You have no definition of what a logic 0 or 1 is, and 100k Ohm as a pulldown may not work. You need to define the pullup or pulldown resistor for the GPIO. Here for any voltage close to the Zener voltage the GPIO pin is not well defined. \$\endgroup\$ Commented Feb 27, 2018 at 5:33
  • \$\begingroup\$ For any voltage less than the zener voltage, the uC pin will see roughly the same input voltage - IE, if the voltage is 1V, the uC pin will see 1V, and the uC logic thresholds will apply. For any voltage above the uC logic threshold, you will get logic 1 - I'm not sure why you say a voltage close to the zener voltage is undefined, since you will just get a voltage up to, but not exceeding, the zener voltage. \$\endgroup\$
    – Selvek
    Commented Feb 27, 2018 at 5:38
  • \$\begingroup\$ I would avoid enabling the pull up or down within the uC, to avoid having it fight with the 100k resistor. You don't need an additional pull-up/down resistor because the status line is always driven either high or low. \$\endgroup\$
    – Selvek
    Commented Feb 27, 2018 at 5:40
  • \$\begingroup\$ With 100k Ohm series resistor and no pullup or pulldown you have a very noise prone input. Not an advisable configuration. The OP defines 1 as 1-40 VDC so 0 is < 1 VDC ....your circuit does not provide that. \$\endgroup\$ Commented Feb 27, 2018 at 6:05
  • \$\begingroup\$ Not sure how a pull up or down would have any impact on noise - they are typically around 100k themselves. Noise will of course depend on how long/where the connected wires are running. He's already stated he'll include a cap which will help, and he is also sampling slowly, so if it's really, REALLY noisy, enough to induce multiple volts of noise, you could still resolve the right answer by oversampling. But we can take the resistor down to 5K and still be within a 1/4W resistor. \$\endgroup\$
    – Selvek
    Commented Feb 27, 2018 at 6:07
1
\$\begingroup\$

I'd be inclined to use something simple and dirty like this

schematic

simulate this circuit – Schematic created using CircuitLab

Vary the value of R3, or omit it, depending on what you want the lower threshold to be.

Note that base emitter junctions are pretty tough, and tend to fail short circuit when they do. If it dies, it will save the protected circuit, and can be easily replaced.

D1 is to protect from negative voltage. Car electrics are supposed to be able to tolerate the reverse connection of a jump start battery without damage, as well as 160v load dumps and 24v truck battery jump starts, pretty harsh!

\$\endgroup\$
0
\$\begingroup\$

Selvek's answer should work. I would add that another simple alternative to the zener is to clamp the voltage to VDD using a diode.

schematic

simulate this circuit – Schematic created using CircuitLab

In fact, most ICs already include such a diode internally so if you get the resistor right you don't even need to add a diode.

One thing you need to be careful of when you use this method is that the minimum power draw of your circuit must always be greater than the current through D1 at 40v. In this case, the current is 0.7ma. R2 in this case creates a minimum load of 1ma, which will protect the supply from being raised over 5v.

\$\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.