Author Topic: 0-5V or 0-12V digital input to 3.3V logic levels  (Read 16420 times)

0 Members and 6 Guests are viewing this topic.

Offline max_torque

  • Super Contributor
  • ***
  • Posts: 1307
  • Country: gb
    • bitdynamics
Re: 0-5V or 0-12V digital input to 3.3V logic levels
« Reply #25 on: February 11, 2018, 09:39:36 pm »
I typically use a 47k input resistor, with another resistor to ground, forming a voltage divider that produces a valid "high" state on the micro pin (if you want to go for the full automotive temp range (-45 to +125 degC!) then you need to ensure you get a "High" under all temperature conditions) at around 60% of the known voltage input value.  I also then often use a zener to limit the voltage so i can have a voltage divider that uses the zener in normal operation, but should that zener fail, the increase in voltage is small enough.  I include a small cap as a noise canceller / low pass filter. then i use something like a 10k resistor in series with the micro pin (to limit current into the micro's clamp diodes)

ie say you have a nominal 12 Vin input, and you micro goes "high" at 2v (with a 3.3Vcc)

i'd have a voltage divider (using the 47k input R) that exceeds 2v at around 8v (meaning the input stays high under most cold cranking conditions), which would in this case be a 15k to ground after the 47k inputR.  i'd fit say a 3v zener (or use a diode clamp to Vcc), which would start conducting at around 12.5 Vin.  With a typical automotive system voltage of 13.7v, without that zener, you'd still only get 3.31V after your divider which is still ok (won't start using the micro's internal diodes yet)

 Under typical surge voltage, lets say 48v, you'd get 11.6v after your divider (with the zener failed), so across the subsiquent 10k resistor you get 11.6 - 4 = 7.6v across the 10k and ~0.7mA flows into the internal protection diodes. which is ok.  Normally of course, the upstream clamp zener or diode will prevent any significant current flow, but this way you have a 1 failure safe system. (i've assumed the internal diodes clamp about 0.7v above Vcc, hence the 4v value)



 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf