Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino Controlled Solenoid Activation with MOSFET Switching

View and Edit Project In Cirkit DesignerImage of Arduino Controlled Solenoid Activation with MOSFET Switching

Circuit Documentation

Summary

This circuit is designed to control a solenoid using a MOSFET as a switch, with an Arduino UNO microcontroller managing the activation and deactivation of the solenoid. The solenoid is powered by a 12V DC power supply. The circuit includes resistors for current limiting and a diode for flyback protection to prevent voltage spikes when the solenoid is turned off.


Component List

1. Arduino UNO

2. 12V DC Power Supply

3. MOSFET

4. Resistor (230 Ohms)

5. Diode

6. Solenoid

7. Resistor (100k Ohms)


Wiring Details

Arduino UNO


12V DC Power Supply


MOSFET


Resistor (230 Ohms)


Resistor (100k Ohms)


Diode


Solenoid


Documented Code

/*
 * Arduino Sketch to test a solenoid using a MOSFET as a switch.
 * The MOSFET gate is controlled by pin D9 of the Arduino UNO.
 * The solenoid is powered by a 12V DC power supply.
 * This code will activate the solenoid for 1 second and then deactivate it
 * for 1 second, repeatedly.
 */

const int mosfetGatePin = 9; // Pin connected to the MOSFET gate

void setup() {
  // Initialize the MOSFET gate pin as an output
  pinMode(mosfetGatePin, OUTPUT);
  digitalWrite(mosfetGatePin, LOW);
}

void loop() {
  // Activate the solenoid
  digitalWrite(mosfetGatePin, HIGH);
  delay(1000); // Wait for 1 second

  // Deactivate the solenoid
  digitalWrite(mosfetGatePin, LOW);
  delay(1000); // Wait for 1 second
}

This documentation provides a comprehensive overview of the circuit, detailing each component, its purpose, and the wiring connections, along with the Arduino code used to control the solenoid.