Ingo Lohs
Published © GPL3+

First Test: Super StarterKit from Elegoo - Motor 3-6V DC

This is a project controlling a motor.

BeginnerProtip1 hour43,869
First Test: Super StarterKit from Elegoo - Motor 3-6V DC

Things used in this project

Hardware components

Elegoo Motor 3-6V DC
its a part from this set
×1
Arduino UNO
Arduino UNO
×1
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (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

Arduino Web Editor
Arduino Web Editor

Story

Read more

Schematics

dcmotor_schematic_2REo3wiTMJ.JPG

Code

Original Example Code from Elegoo

C/C++
int motorPin = 3;
 
void setup() 
{ 
  pinMode(motorPin, OUTPUT);
  Serial.begin(9600);
  while (! Serial);
  Serial.println("Speed 0 to 255");
  Serial.println("But the advice 50 to 255. Because the minimum voltage required to start the motor is 50.");
} 
 
 
void loop() 
{ 
  if (Serial.available())
  {
    int speed = Serial.parseInt();
    if (speed >= 50 && speed <= 255)
    {
      analogWrite(motorPin, speed);
    }
  }
} 

Credits

Ingo Lohs

Ingo Lohs

182 projects • 194 followers
I am well over 50 years and come from the middle of Germany.

Comments