Capacitor shorting switch using n-channel MOSFET STP55NF0L and Arduino Nano.

1 minute, 55 seconds Read

Creating a capacitor shorting switch using an N-channel MOSFET like the STP55NF0L and an Arduino Nano involves using the MOSFET as a switch controlled by the Arduino’s digital output. This configuration allows you to discharge a capacitor by connecting its terminals together through the MOSFET when needed. Here’s a step-by-step guide:

Components Needed:

  • N-channel MOSFET (STP55NF0L or similar)
  • Arduino Nano (or compatible)
  • Capacitor to be discharged
  • Resistor (optional, for pull-down)
  • Breadboard and jumper wires

Circuit Setup:

  1. Connect the MOSFET:
    • Connect the MOSFET’s Drain pin to one terminal of the capacitor.
    • Connect the MOSFET’s Source pin to the other terminal of the capacitor.
    • Connect the MOSFET’s Gate pin to one of the digital pins (e.g., D2) of the Arduino Nano.
  2. Add a Pull-Down Resistor (Optional):
    • Connect a resistor (e.g., 10kΩ) between the MOSFET’s Gate pin and ground (GND) to ensure the MOSFET is off during initialization.
  3. Connect Power and Ground:
    • Connect the Arduino Nano’s 5V and GND pins to the corresponding rails on the breadboard.
    • Connect the capacitor’s negative terminal to the ground rail.

Arduino Code:

const int mosfetGatePin = 2; // Connect to MOSFET's Gate pin void setup() {pinMode(mosfetGatePin, OUTPUT); // Set MOSFET's Gate pin as outputdigitalWrite(mosfetGatePin, LOW); // Turn off the MOSFET initially } void loop() { // Your main code here // When you want to discharge the capacitor, turn on the MOSFETdischargeCapacitor(); // Your other code here } void dischargeCapacitor() {digitalWrite(mosfetGatePin, HIGH); // Turn on the MOSFET delay(1000); // Adjust the delay as needed to discharge the capacitor digitalWrite(mosfetGatePin, LOW); // Turn off the MOSFET }


  1. During the setup() function, the MOSFET’s Gate pin is set as an output and driven low to ensure the MOSFET is initially off.
  2. In the dischargeCapacitor() function, the MOSFET’s Gate pin is driven high to turn on the MOSFET. This shorts the terminals of the capacitor, allowing it to discharge.
  3. After a delay (adjustable using delay()), the MOSFET’s Gate pin is set low again to turn off the MOSFET and stop discharging the capacitor.

Note: Make sure you choose the appropriate resistor value for the pull-down resistor based on your circuit requirements. Also, consider the power dissipation capability of the MOSFET and ensure that it can handle the current flowing through it during the capacitor discharge process. Always refer to the datasheet for detailed specifications of the MOSFET.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *