Reed Switch Controls Motor Rotation

by Lisleapex Blog in Circuits > Arduino

95 Views, 1 Favorites, 0 Comments

Reed Switch Controls Motor Rotation

11.png

How does the reed switch control the rotation of the motor? In fact, the principle is very simple. Use the Arduino controller to judge the opening and closing status of the reed switch contacts. If the reed switch is closed, the motor will be controlled to rotate. If the reed switch is open, the motor will be stopped.

Supplies

2.png
  1. N4007 Diode
  2. 10K Resistor
  3. Reed Switch
  4. IRF520 MOSFET Transistor
  5. LM35 Temperature Sensor
  6. Magnet
  7. Plastic Fan
  8. Electric Motor
  9. Arduino Controller
  10. USB Connection Cable
  11. Breadboard
  12. Breadboard Wires (several)

Assemble the Fan and Motor

3.png

Assemble the fan and motor, and connect the leads to both ends of the motor.

Insert All Components

Insert various components on the breadboard according to the positions shown in the connection diagram. Let me explain here: driving the motor to rotate requires tens to hundreds of milliamperes of current, and the interface of the Arduino controller can only provide a maximum current of about 20mA. Such a small current cannot drive the motor to rotate. Therefore, we need to use indirect driving to expand the driving current through an IRF520 field effect transistor, so that the motor can work normally.

In addition, a 1N4007 diode is connected at both ends of the motor in order to protect the IRF520, because a relatively high reverse electromotive force will be generated when the motor stops. In order to prevent this electromotive force from breaking down the IRF520, a 1N4007 diode is connected at both ends of the motor in reverse. A diode serves as protection.

Plug-in Breadboard

4.png

Plug in the breadboard according to the connection diagram shown above, use the red breadboard wire to connect all 5V circuits, and use the black breadboard wire to connect all GND circuits. The signal line can be connected with an orange or yellow line

Arduino IDE

#define FAN_pin 9 //Motor interface

#define Magnetic_pin 5 //Reed switch interface

void setup() { //This function only runs once after power-on

  pinMode(Magnetic_pin,INPUT); //Set the reed switch interface to input state

}

void loop() { //This function runs in a loop

  if(digitalRead(Magnetic_pin) == LOW) { //When a magnet is close to the reed switch

  digitalWrite(FAN_pin,HIGH); //Motor rotation

  }

  else { //otherwise

  digitalWrite(FAN_pin,LOW); //Motor stops

  }

}

Experimental Results

5.png