0
\$\begingroup\$

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?

enter image description here

enter image description here

\$\endgroup\$
4
  • \$\begingroup\$ It depens how exactly you want it to work and what is the function of the power supply. Is the 12V supply powering something else, and why do you need to detect the supply voltage to begin with? The obvious solution is to either add an useless load to waste power so 12V drops faster, but you might be looking for a more efficient solution, which may mean you need to change the way you are currently detecting the supply with a regulator. Is the detect going in to an analog pin already? \$\endgroup\$
    – Justme
    Commented May 4 at 9:47
  • \$\begingroup\$ Detect is going in as a digital input low or high. \$\endgroup\$
    – JSNerd01
    Commented May 4 at 12:48
  • \$\begingroup\$ I see that, and that is the problem, and I did not ask that. Now, at what voltage level you want to stop detecting 12V, instead of the about 3V it now is? 11.5V? 11? 10? \$\endgroup\$
    – Justme
    Commented May 4 at 13:05
  • \$\begingroup\$ The moment it goes below 10 V. When it goes below 10V, the MCU switches on the MOSFET through which battery power comes in. The 12V powers a device with around 1.2-1.3 A load. \$\endgroup\$
    – JSNerd01
    Commented May 4 at 13:29

1 Answer 1

0
\$\begingroup\$

The detection pin already goes in to analog input.

Replace the regulator with voltage divider that divides the 12V down by about 4 to end up with voltage about 3V, and read the analog value with ADC. Determine from the value if the voltage is below or above 10V.

\$\endgroup\$
1

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.