Prevent back EMF with a 1N4004 Rectifier Diode connected to a Fan Motor

Description: A 1N4004 Rectifer Diode (a.k.a flyback diode, snubber diode, kickback diode) is used to prevent back EMF from a fan motor connected to an Arduino Nano.

1N4004 Diode with Fan Motor and Arduino Nano

Notes: The grey band represents the negative side. A forward voltage drop of around .7V can be expected for the 1N4004 diode. A back EMF (reverse voltage spike) gets created when the magnetic field of a coil (like in a motor) collapses. Therefore, in order to avoid damage to electrical components, a rectifier diode which only let’s voltage flow in one direction and not in the other is used to protect from reverse voltage spikes.

Supplies:

1 – Breadboard 400 Points
1 – Arduino Nano
1 – Metal Push-Button 12mm   >> Link <<
1 – 1N4004 Rectifier Diode   >> Link <<
1 – 10k Resistor
1 – 5V Brushless DC Fan   >> Link <<

Arduino Code:

#define fan 6
#define button 16

int fanState = LOW;
int lastSwitchVal = LOW;

void setup() {

  pinMode(fan, OUTPUT);
  pinMode(button, OUTPUT);

}

void loop() {

  int switchVal = digitalRead(button);

  if (switchVal != lastSwitchVal && switchVal == HIGH) {
  fanState = !fanState;
  
}

  digitalWrite(fan, fanState);

  lastSwitchVal = switchVal;

}

Leave a Comment

2 + 7 =