Inform microcontroller that the analogue circuit is powered up

atmegamicrocontrollermosfetpower

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.

Best Answer

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.

schematic

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.