Basically, I want to pull-down the microcontroller pin if some analogue circuit is powered up. The analogue circuit power is 9V, 1.6A. The idea I have is to use something like IRLZ24N MOSFET, connect gate to the analogue circuit via resistor, connect microcontroller pin to drain and source to the ground. When analogue circuit is powered, it will trigger MOSFET and pull down the microcontroller pin, configured as pulled-up input (microcontroller itself is powered via USB). The question is whether there is a better or more correct solution than I suggest above.

  • 1
    \$\begingroup\$ Do the two supplies share a common ground? If not then instead of connecting the grounds (just for the detection purpose), you can use an optocoupler. \$\endgroup\$
    – alexan_e
    Commented Aug 2, 2014 at 16:51
  • \$\begingroup\$ I'm not going to post this response as an answer, as the solution violates your stated requirements, but if you have access to the MCU's source code, you could change the input trigger from active-low to active-high, and then just use a resistor divider on the 9V rail. For example, for a 5V logic MCU, using two 10k resistors in series across the 9V analog supply will produce 4.5V on the center pin that is safe to directly drive into an MCU pin. \$\endgroup\$ Commented Aug 2, 2014 at 18:08
  • \$\begingroup\$ Or use a voltage divider with an ADC input (maybe with protection against overvoltage). This is often done to check that a voltage is in the correct range. \$\endgroup\$
    – starblue
    Commented Aug 2, 2014 at 19:50

1 Answer 1


That's a decent way to do it, but I'd use a bipolar transistor such as a 2N3904 or 2N4401 (MMBT3904/MMBT4401 in SMT). Yes, you need one or two more resistors, but they're more immune to surges. The IRLZ24N can be damaged if you put more than 16V on the gate.

It's also gross overkill for the job, and is not guaranteed not to leak enough to overcome a typical weak pullup in an MCU, especially at elevated temperature. If you insist on using a MOSFET, a 2N7000 with a resistor and zener on the gate is more appropriate (2N7002 in SMT).

In many cases you could just use the 9V and pass it through a resistor + Schottky (BAT54) clamp to Vdd and read it directly (turn the pull-up off). The resistor could be relatively high value like 100K.


simulate this circuit – Schematic created using CircuitLab

This assumes you're only looking for a go/no-go indication of the presence of some voltage on the analog power supply. If you want to know when it is within spec, you'd need to use a comparator (maybe your MCU has one on-board- many PICs do). In such a case, and lets say the internal comparator reference is 1.024V, you could divide down the 9V so that it gives you 1.137V at 9V in, so that the comparator changes state at about 8.1V on the analog supply (when it is at nominal less 10%). Alternatively, you could use an on-board ADC channel and do the comparison digitally.


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.