I am using a MCU to detect a 12V signal and using the state to Switch on/off a MOSFET. This 12V Signal is first converted to 3.3V using an AMS1117 and then fed into a MCU input pin. The source of the 12V is a DC wall charger.
The issue I am facing is that when DC Charger is switched on, the MOSFET is switched on immediately by the MCU as the value on the input pin immediately goes to HIGH. But when power to DC Charger is cut off, it takes upto 5 seconds for the MCU to detect the LOW signal because of slow discharging of the capacitors inside the DC charger. What can I do to make this happen instantly?