I need to detect a Logic high / Low (at my MCU). This input will come from an external circuit (having common ground with my circuit). My MCU support max 2.8V at the GPIOs. I have designed the below schematic. Am I on the right direction? The Input can go upto 30V.

enter image description here

  • \$\begingroup\$ TL431 datasheet provides an example where you can use it as comparator \$\endgroup\$
    – Long Pham
    Commented Apr 7, 2018 at 8:39
  • \$\begingroup\$ I think this is overly complicated. There are many questions on this site about level shifting. Really just a couple of resistors and a diode should do the trick. \$\endgroup\$
    – JRE
    Commented Apr 7, 2018 at 8:44
  • \$\begingroup\$ The purpose of the required circuit is to have a fixed 2.5~2.8V from a wide range of input (9-40V). If there is any other simpler solution, please guide me with a schematic. I cannot use a regulator, as I need 5 of such inputs. \$\endgroup\$ Commented Apr 7, 2018 at 8:58
  • \$\begingroup\$ You have 2.8 V - it is powering the processor. All you need is a pull up on the processor pin, and a diode to your signal such that it can only pull down. \$\endgroup\$
    – JRE
    Commented Apr 7, 2018 at 9:00
  • \$\begingroup\$ Hi @JRE, can you guide me with a schematic please. \$\endgroup\$ Commented Apr 7, 2018 at 9:04

1 Answer 1


What you need is very simple:


simulate this circuit – Schematic created using CircuitLab

I've left out the ground since you say it is common for the signal and the processor.

When the signal is high, the diode blocks and the MCU input is pulled up to 2.8V through R1.

When the signal is low, it pulls the MCU input down through D1.

You must have 2.8V already at hand since you say the MCU runs on 2.8V.

Much simpler than you idea, and can be managed with parts from the junk box.

  • \$\begingroup\$ Thank you :) Actually I don't have 2.8V handy, as the MCU runs on 4V, but the GPIO's are at 2.8V. Sounds odd, but it is like that.. Its Quectel's MC60 OpenCPU. I have one VddExt Pin on the MCU that supplies 2.8V, but the current it can source is really low and more over I have used that to power up another portion in the circuit. But, no worries, I can use a cheap LDO to have the 2.8V rail.. Thank you again :) Much easier as you said.. \$\endgroup\$ Commented Apr 7, 2018 at 9:16
  • \$\begingroup\$ One resistor to +4V, and a second resistor to GND, can be the equivalent (Thevenin equivalent, if you look things up) to the R1 and 2.8V. \$\endgroup\$
    – Whit3rd
    Commented Apr 7, 2018 at 9:24
  • \$\begingroup\$ Don't use LDO, they can only source current, they're not made to keep the voltage for a negative current to as you want. Use only a small zenner diode on the 2.8 line without feeding resistor. \$\endgroup\$
    – Dorian
    Commented Apr 7, 2018 at 9:45
  • \$\begingroup\$ @Dorian: A small linear regulator is fine. The current it will have to "swallow" is only the reverse leakage current through the diode. And that is further limited by the resistor. So, no problem for any normal regulator. \$\endgroup\$
    – JRE
    Commented Apr 7, 2018 at 10:14
  • \$\begingroup\$ In fact, the needed current is so low (2.8V/10000 ohms= 0.28 mA) that it could easily be supplied by the MCU 2.8V source even though it is already being used for other things. \$\endgroup\$
    – JRE
    Commented Apr 7, 2018 at 10:16

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.