I'm controlling 8 N-channel MOSFETS with the following circuit diagram. I have 8 of them connected to IO pins 20 - 27 and all works fine apart from overheating the microcontroller.

When I set the following pins to OUTPUT and turn them HIGH or LOW, the more I set, the hotter the ATmega 2560 gets. When all 8 are set the microcontroller overheats and then malfunctions. What can be causing this issue and is there a way to fix it?

This happens when it is connected via USB without any external power supply and also with a power supply and also with a LOAD to the MOSFET and without a LOAD.

enter image description here

  • 2
    \$\begingroup\$ Imagine that there is a diode that allows the current to flow from the BJT base to GND (the BJT functions like that). Yes, that is a short circuit, directly on your beloved MCU's output pin. \$\endgroup\$
    – jiwopene
    Oct 31, 2022 at 14:04
  • 5
    \$\begingroup\$ You're lucky you didn't release the magic smoke. \$\endgroup\$ Oct 31, 2022 at 17:27

1 Answer 1


You have improper circuit design having the MCU pin drive directly into the NPN transistor base. You need a resistor in series with the NPN base to limit the amount of current flow.

As designed you are asking the poor MCU to source current into the the base which looks pretty much like a forward biased diode to GND. The MCU is for sure sourcing way more current than it is specified capable of providing. It is no wonder the poor part overheats.

You may also be overdriving the base current to a level that is more than allowed by the NPN transistor data sheet. Do check the specs to make sure you do not overdrive the transistor.

  • 1
    \$\begingroup\$ Wouldn't driving a IRLZ44N (note the L for "low V_GS") directly from the Arduino work, i.e. scrapping the BJT and replacing the FET with one that can be driven with such low voltage? I did a project once where I PWM-controlled a 14.4V motor via an IRLZ44N from a 3.3V GPIO on an ESP8266 (plus a flyback diode on the motor), and didn't notice any problems. (That's not to say I'm confident in saying that is the right way, which is why I ask here.) \$\endgroup\$
    – orithena
    Oct 31, 2022 at 12:02
  • 1
    \$\begingroup\$ @orithena providing instantenous current limits aren't exceeded when switching the mosfet on/off and you can live with the relatively slow switching (although this circuit has even slower switch on via a 10k resistor) and your pin can cope with driving a capacitative load, you're fine. You probably need a small series resistor to keep that current spike within specs, however. 3.3V is probably a bit low for this mosfet though: Rds is specced for 10V, 5V and 4V. \$\endgroup\$
    – 2e0byo
    Oct 31, 2022 at 14:02
  • 1
    \$\begingroup\$ @orithena low-gate-voltage MOSFETs come with other tradeoffs - there might be a good reason not to use one here \$\endgroup\$
    – user253751
    Oct 31, 2022 at 15:01

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.