DC Motor Speed Control Using

by TECHATRONIC in Circuits > Arduino

28 Views, 0 Favorites, 0 Comments

DC Motor Speed Control Using

dc motor speed control.jpg

Hello Folks, I'm back with another interesting project based on Arduino. Today we're going to demonstrate most control, using Arduino. This is much more require for making Robots like line follower and obstacle avoiding, as controlling motor speed using motor drivers along with precise timing is a bit difficult. So today I'm going to ease this problem by demonstrating it.

Generally, DC motors rotate at a constant speed(RPM) in clockwise or anticlockwise directions, depending upon the polarity of the current that is supplied through it. In this project, we are trying to slow down or boost the speed of the motor with the help of an Arduino board. The potentiometer that we are using is responsible for the speed of the motor. You can rotate the potentiometer to vary the speed of the motor proportionally. The Arduino generates PWM control signals based on the input from the variable resistor, but the motor can not process them directly, so we are using an L298N motor driver. The drives use 12v input and that we have given and in accordance to the 5v PWM signal received from Arduino it directs the same waveform with exact duty cycle to 12V supply which is used to drive the motors actually.

Material Required

dc motor1.jpg

  • Arduino UNO
  • DC motor
  • Jumper wires
  • Breadboard
  • 9 volt battery
  • 10K potentiometer
  • L298N motor driver
  • USB cable for uploading the code

Circuit Diagram

7-n-1024x651.jpg

Code

1-1.png
// TECHATRONIC.COM  
 void setup()   
  {   
  Serial.begin(9600);   
   pinMode(3,OUTPUT); // Motor pin 1   
   pinMode(4,OUTPUT); // Motor pin 2   
   digitalWrite(4,LOW); // Normally LOW inthis pin   
   pinMode(A0,INPUT);  // 10k Potentiometer   
  }   
  void loop()   
  {   
  int s=analogRead(A0); // 10k Potentiometer   
  int z=map(s,0,1024,0,255);   
  Serial.println(z);   
  analogWrite(3,z);   
  } 

For more information about how code works and for more interesting articles like this, visit my original post. Also bookmark TECHATRONIC.COM for more future updates related to such articles, as they will be first uploaded on this before Instructables.