Speed Control of DC Motor Using Arduino and Potentiometer

by hIOTron IoT in Circuits > Arduino

25 Views, 0 Favorites, 0 Comments

Speed Control of DC Motor Using Arduino and Potentiometer

Dc motor with potentiometer.PNG

In this project, we have described how the speed can be handled by rotating the knob of the potentiometer.

Supplies

Hardware Components

Arduino UNO

DC motor (generic)

Transistor 2N2222

Single Turn Potentiometer- 100k ohms

Ceramic Disc Capacitor, 0.1 µF

Breadboard (generic)

Software Components

Arduino IDE

About Project

dc motor speed.PNG

DC motor is the usually utilized motor in Robotics and in various electronics projects. For handling the speed of DC motor we have several methods, like with relays, etc. In this circuit, for handling the speed of the DC motor, we utilize a 100K ohm potentiometer to modify the duty cycle of the PWM signal.

For Instance, if we sustain 256 values to the analog input, then the HIGH time will be (1024-256)ms and LOW time will be 256ms. Hence, it means the duty cycle is 75%. So that’s how we can execute the DC Motor Speed Control using Arduino and potentiometer.

IoT Course will help you to build such projects as well as IoT Solutions.

Run a Program

int pwmPin = 12; // assigns pin 12 to variable pwm int pot = A0; // assigns analog input A0 to variable pot int c1 = 0; // declares variable c1 int c2 = 0; // declares variable c2 void setup() // setup loop { pinMode(pwmPin, OUTPUT); pinMode(pot, INPUT); } void loop() { c2= analogRead(pot); c1= 1024-c2; // subtracts c2 from 1000 ans saves the result in c1 digitalWrite(pwmPin, HIGH); delayMicroseconds(c1); digitalWrite(pwmPin, LOW); delayMicroseconds(c2); }