tech guy
Published

DC Motor Control

A DC motor control for Arduino Uno.

BeginnerFull instructions provided18 minutes6,814
DC Motor Control

Things used in this project

Hardware components

DC motor (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×7
Arduino UNO
Arduino UNO
×1
Breadboard (generic)
Breadboard (generic)
×1
General Purpose Transistor NPN
General Purpose Transistor NPN
×1
1N4007 – High Voltage, High Current Rated Diode
1N4007 – High Voltage, High Current Rated Diode
×1
Resistor 221 ohm
Resistor 221 ohm
×1

Software apps and online services

fritzing
you may not need this, but if the file will not open then you will need to download this.
Arduino IDE
Arduino IDE

Story

Read more

Schematics

fritzing

Code

hackster.io

Arduino
int m = 5;
 
void setup() 
{ 
  pinMode(m, OUTPUT);
  Serial.begin(9600);
  while (! Serial);
} 
 
 
void loop() 
{ 
  if (Serial.available())
  {
    int speed = Serial.parseInt();
    if (speed >= 0 && speed <= 255)
    {
      analogWrite(m, speed);
    }
  }
}

Credits

tech guy

tech guy

7 projects • 9 followers

Comments