0
\$\begingroup\$

I am trying to modify a work light (1S3P 18650 3,6V) that is controlled by an 8 pin PADUK type micro.

An output from the micro goes through a 100 Ohm resistor straight to the MOSFET gate.

It has the usual 100%, 50%, SOS modes. One drawback is that at the 100% setting, after 2 min, it throttles down to 16% PWM, in order to meet the battery life claim on the box. LED heatsinking is to a massive block of aluminum and not a problem.

As in the picture, I would like to add a switch so I can feed the gate directly with battery voltage so I can get a mode with 100% light with no throttling.

In the setup I propose, will there be a problem with me backfeeding the micro output with battery voltage, while it is either off/0V or doing a 16% PWM duty cycle at 3,6V?

I thought that such outputs are protected by a diode/FET so that this wouldn't be a problem, am I correct?

(I connected the circuit as in the picture for a few seconds and no magic smoke. Also I measure no big voltage drop BAT+ to MCU gate, certainly not a 0.6V/0.3V (Shottky) diode drop, so if there were protection it would be a low Rdson FET not a diode.)

Is my solution reliable in the long term?

I considered putting in an SPDT switch so I could choose what 'source' powers the gate and could avoid any backfeed (gate connection on COM, either MCU pin or battery on the other two switch contacts) but due to size constraints of a smaller switch (only available as a SPST) I'd prefer to use the 'backfed' option if it is safe to use.

enter image description here

\$\endgroup\$
4
  • 1
    \$\begingroup\$ If the micro's output is low and your switch is on, the micro has to sink 36mA. That's a lot for a IO pin and will possibly damage it. \$\endgroup\$ Apr 16, 2021 at 15:38
  • \$\begingroup\$ Are you saying then that IO pins are wholly unprotected? Isn't there a blocking diode/FET behind the IO pin that would stop my 36mA backfeed? \$\endgroup\$
    – parkside
    Apr 16, 2021 at 18:10
  • \$\begingroup\$ If there was some kind of blocking mechanism, how would the IO pin ever be able to sink current and fullfill it's job as IO pin? \$\endgroup\$ Apr 16, 2021 at 21:43
  • \$\begingroup\$ I'd assume it would have to be programmed as an input forst, setting the FET on for use in that mode? \$\endgroup\$
    – parkside
    Apr 16, 2021 at 22:48

1 Answer 1

2
\$\begingroup\$

Is my solution reliable in the long term?

No. A typical microcontroller IO pin has what is called three state logic or tri state:

Microcontroller pin equivalent circuit

The pin can be in 3 states:

  • Input, with the output driver transistors disabled, the pin is high impedance.
  • Output low, the top output driver transistor is off and the bottom one is sinking current.
  • Output high, the bottom output driver transistor is off and the top one is sourcing current.

In your circuit, posted above, it is safe to assume the pin is always configured as an output, either low (MOSFET/LED off) or high (MOSFET/LED on). So it is always either sinking or sourcing current.

When you close the switch on your diagram when the microcontroller output is low, current will flow trough the 100 ohm resistor, trough the bottom output driver transistor to ground. The only thing limiting current is the 100 ohm resistor so that bottom transistor has to sink 36mA. This is much more then a typical microcontroller pin is rated for and can damage it.

\$\endgroup\$
2
  • \$\begingroup\$ Thanks for the great explanation, could you give me an idea of the ballpark that the output pin/micro is safe to sink? If I were to increase the resistor in series with the switch to make the current 'safe' (I get that I'm making a voltage divider and that the gate voltage will be wrong, but just to get an idea what such an output is safe to sink for some future situation?) Thanks! \$\endgroup\$
    – parkside
    Apr 17, 2021 at 10:08
  • 1
    \$\begingroup\$ @parkside You should check the datasheet of your specific microcontroller for exact numbers but most modern microcontroller IO pins can drive a LED directly so should be able to source/sink in the ballpark of 10mA. Increasing the resistor value won't solve your problem. It will reduce the current to a safe(r) level but the microcontroller output has a very low impedance so your modification will have no effect and the device will work as before. \$\endgroup\$ Apr 17, 2021 at 18:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.