0
\$\begingroup\$

I have a micro controller (uC) with 1.8V supply and no integrated ADC. This uC must monitor one signal, and check if it is currently 5V or below 4.2V.

I then need to be able to trigger interrupts based on the value, by sensing HIGH and LOW:

LOW for <4.2V
HIGH for 5V

Is using the a voltage divider + uC evaluation hysteresis too risky?

Thanks

\$\endgroup\$
  • 2
    \$\begingroup\$ @JackCreasey ;) well.. I know that.. and YOU know that.... but .... \$\endgroup\$ – Trevor_G Apr 9 '18 at 18:32
  • 1
    \$\begingroup\$ You would have to do the math with the voltage threshold limits for your particular micro.. but since logic signals typically have a wide hysteresis percentage I would doubt you will be able to get it to work the way you imagine. \$\endgroup\$ – Trevor_G Apr 9 '18 at 18:36
  • 1
    \$\begingroup\$ Many modern 1.8V µC have an analog comperator peripherial, which is simpler than adc. I'd use that when available. \$\endgroup\$ – Turbo J Apr 9 '18 at 18:36
  • 1
    \$\begingroup\$ WHat does "LOW for >4.2V HIGH for 5V" MEAN!... those are not mutually exclusive. and plus or minus WHAT? \$\endgroup\$ – Trevor_G Apr 9 '18 at 18:48
  • 1
    \$\begingroup\$ @Trevor_G That was a typo. Typed the wrong signal. Fixed it. Below 4.3V has absolutely to be LOW. \$\endgroup\$ – AmiguelS Apr 9 '18 at 20:12
0
\$\begingroup\$

You could use a simple RC network.

  1. Short the capacitor using the GPIO pin
  2. Turn the GPIO to input
  3. Measure the time for the input to reach a '1'
  4. Use the RC time constant to calculate the input voltage

Temperature variation of the GPIO pin threshold is up to you to discover, but hysteresis does not enter into it. You are only using the positive threshold value.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
  • \$\begingroup\$ Thank you for your answer, but I need to be able to trigger interrupts from this signal. Polling does not fit my use case. \$\endgroup\$ – AmiguelS Apr 9 '18 at 18:40
  • 2
    \$\begingroup\$ @AmiguelS you need to edit and put that in the question. Creeping requirement question are really frowned on here. \$\endgroup\$ – Trevor_G Apr 9 '18 at 18:41
  • \$\begingroup\$ If you run a regular timer tick then you don't need to spin waiting for the threshold to be crossed. In any case you could have interrupt enabled on the GPIO pin and simply service that as the threshold ....either will work but you need a timer tick. \$\endgroup\$ – Jack Creasey Apr 9 '18 at 18:42
  • \$\begingroup\$ @Trevor_G I just added that, sorry. Thanks for the warning. \$\endgroup\$ – AmiguelS Apr 9 '18 at 18:47
  • \$\begingroup\$ This will work, though the threshold level tolerance itself may be too high. However, at 1.8V it can't be THAT bad. It depends on how accurate the OP needs the 4.2V to be. \$\endgroup\$ – Trevor_G Apr 9 '18 at 18:47
0
\$\begingroup\$

Use a voltage supervisor chip with open collector output + pull-up reststor to be compatible with the uC 1.8 supply. See some sugestions from Texas Instruments

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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