I'm a beginner working on a small project with a PIC12F675 microcontroller, aiming to activate a water pump when the water level exceeds a certain threshold. However, I'm encountering an issue when connecting the MOSFET and load to the microcontroller, it starts to overheat.

enter image description here

On its own, the microcontroller functions properly. I tested it by artificially increasing the voltage on a specific GP pin that monitors the water level, and it promptly set the output on GP1 to zero. However, upon connecting the MOSFET as illustrated in the provided diagram, the microcontroller begins to overheat. I'm unsure about what I might be doing incorrectly.

Any guidance on this issue would be greatly appreciated.

  • \$\begingroup\$ What is the part number of the MOSFET you are using? \$\endgroup\$ Commented May 18, 2023 at 6:58
  • 2
    \$\begingroup\$ (Consider using series resistors on logic pins driving "anything external".) \$\endgroup\$
    – greybeard
    Commented May 18, 2023 at 7:36
  • \$\begingroup\$ @BruceAbbott It's on the picture above (IRF9630 P-Channel MOSFET) \$\endgroup\$
    – Samuel
    Commented May 18, 2023 at 7:51

2 Answers 2


If the PIC12F675 uC overheats only when driving a switched load, the likely cause is CMOS latch-up.

The path for a transient that triggers latch-up is not apparent from OP's schematic, especially since the schematic is a fragment with missing circuitry. In general, a transient on any pin can trigger latch-up if it exceeds Vdd voltage (+5V here) or extends below Vss. The transient causing latch-up need only be momentary, such as the instant when motor switches on or switches off.
A transient that momentarily exceeds PIC12F675 max Vdd of +6.5V (using Vss as a zero-volt reference point) might cause latch-up.

Some possible transient paths:

  • Motor current flowing along the +5V return line (connected to PIC12F675 Vss).
  • Motor current flowing along the +5V line, (connected to PIC12F675 Vdd).
  • Switching transient coupled through MOSfet drain-to-gate capacitance, glitching GP1 output pin.

Other paths may be suspect, since schematic water-level sensing circuit is missing...this must involve at least one more GPIO pin.

What to do?

  • Use a N-channel MOSfet instead of P-channel MOSfet.
  • Add a diode across the motor to direct the switch-off transient back to the +5V supply - it is important that significant capacitance appear across the +5V supply to absorb this energy.
  • Add a bypass capacitor right at PIC12F675 from Vdd to Vss. 0.1uF is a common choice, to absorb fast transients. Even more capacitance is required to absorb the motor's switching transients, but this larger capacitance might best be placed closer to the motor.
  • Rearrange wiring path so high pump currents have a separate path to the +5V power source (these current paths should not be common with +5v supply lines to PIC12F675 Vdd, Vss).
  • Add a series resistor between GP1 output pin and MOSFET gate, as others have suggested.


simulate this circuit – Schematic created using CircuitLab

  • \$\begingroup\$ I greatly appreciate your detailed response. As a beginner, this information is incredibly beneficial to me. I'll let you know about whether or not it it worked. \$\endgroup\$
    – Samuel
    Commented May 18, 2023 at 15:57

I suspect that you have made a mistake in the MOSFET's connections because as per the schematic, I do not see any reason why the uC will get heated. Re-check your MOSFET connections.

The other point that is important but not related to your heating problem is, the PMOS is better used on the high side and be careful to always ensure that source is at a higher potential than the drain otherwise, the bulk diode gets forward biased.

Edit: You also missed a reverse biased diode across the motor.

  • \$\begingroup\$ Thank you for your reply. I have an additional question regarding the circuit. Should I incorporate any filters to safeguard the microcontroller (uC) during its operation? Alternatively, would it be necessary to use different components if the motor's current draw is approximately 1A? \$\endgroup\$
    – Samuel
    Commented May 18, 2023 at 7:54
  • \$\begingroup\$ A series resistor as suggested by greybeard in the comments should be sufficient. Check the MOSFET datasheet and see the current rating. You missed a reverse biased diode across the motor. \$\endgroup\$
    – sai
    Commented May 18, 2023 at 8:20

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.