Вы находитесь на странице: 1из 4

INSTITUTE OF BUSINESS MANAGEMENT

COLLAGE OF ENGINEERING SCIENCES

Electrical Machines
Fall 2019

Project Topic: Speed and


Direction Control of DC
Motor using Arduino

Group Members:
Ali Gohar (23320)
Aamir Rasool (23313)
Syed Ebad-ul-Hassan (23404)

Submitted to: Sir Osama Mehfooz


ABSTRACT:
In this project, I will show you how to achieve Speed and Direction Control of DC Motor
using Arduino UNO. It is a simple project using Arduino UNO and a few easily available
components to control the speed of rotation of a DC Motor and also it direction of rotation.

INTRODUCTION:
DC Motors are found everywhere electronics, toys, fans, tools, discs, pumps etc. DC
Motor is an actuator that converts the DC supply to rotation or movement. There are different
types of DC motors: Brushed DC motor, Brushless DC motor, Geared DC motor, Servo motor,
Stepper motor and DC Linear Actuator. Different types of motors are used in different
applications like Robotics, precision positioning, industrial automation etc. Generally, when a
DC motor is associated with any microcontroller based system, it is often connected using a
Motor Driver IC. A Motor Driver IC provides the necessary current for the motor to run. It can
also control the direction of the rotation. In this project, an Arduino based speed and direction
control of DC motor without using Motor Driver IC is designed. A DC Motor can’t be connected
to a Microcontroller as the output current of the Microcontroller is very small and it cannot drive
the motor. Hence, we use transistors to form an H-bridge to drive the motor. The circuit diagram,
description and its working are mentioned below.

CIRCUIT DIAGRAM:

Figure 01: Basic Circuit diagram.

COMPONENTS:
 Arduino UNO.
 USB Cable.
 Resistors (R1, R2, R3, R4 = 1KΩ)| .
 Diodes (D1, D2, D3, D4 = 1N4007).
 Transistors (Q1, Q2, Q3, Q4 = 2N2222).
 DC Motor.
 Push Button.
 Potentiometer (10KΩ).
 Connecting Wires.
 Breadboard.
 9V Battery.
 Battery Connector.

WORKING:
The aim of this project is to control the speed and direction of a DC Motor without using
a
Motor Driver IC. Hence, we need to form an H-bridge using transistors in order to drive the
motor. The working of the project is explained here assuming all the connections are made as per
the circuit diagram.
The POT is connected to the analog pin A0 of the Arduino. This is used to adjust the
speed of the motor. The normal operation of the motor is to rotate in forward direction.
When a button, which is connected to the Pin 7 of the Arduino, is activated or pressed, the
direction of the rotation is reversed and continue to rotate in that direction until the button is
pressed once again.
For forward rotation of the motor, transistors Q2 and Q3 must be turned on. Hence, the
outputs 5 and 4 of the Arduino are high.
The Arduino is programmed to detect a logic low on the Pin 7 when the button is pressed. When
the button is pressed once, the transistors Q1 and Q4 must be turned on. Hence, the pins 3 and 2
of Arduino are made high. The motor rotates in reverse direction if the button is pressed once
again.
NOTE: Instead of directly turning ON the transistors Q1 and Q3 whenever necessary, I am
providing a PWM signal based on the value of the POT so that you can control the speed of
rotation.

CODE:
const int
potPin = A0;
const int buttonPin = 7;
const int forward1 = 5;
const int forward2 = 4;
const int backward1 = 3;
const int backward2 = 2;
int potValue = 0;
int motorValue = 0;
int buttonState = 0;
boolean a;
void setup()
{pinMode(buttonPin, INPUT_PULLUP);
pinMode (forward1, OUTPUT);
pinMode (forward2, OUTPUT);
pinMode (backward1, OUTPUT);
pinMode (backward2, OUTPUT);
}
void loop()
{potValue = analogRead(potPin);
motorValue = map(potValue, 0, 1023, 0, 255);
buttonState = digitalRead(buttonPin);
if (buttonState == LOW)
{a=!a;
}
if(a)
{analogWrite(backward1, motorValue);
digitalWrite (backward2, HIGH);
digitalWrite (forward1, LOW);
digitalWrite (forward2, LOW);
}
else
{analogWrite(forward1, motorValue);
digitalWrite (forward2, HIGH);
digitalWrite (backward1, LOW);
digitalWrite (backward2, LOW);
}
}

APPLICATIONS:

 The circuit can be used to drive a single DC motor without Motor Driver IC.
 The circuit can be extended to 2 motors by implementing dual H-bridge connections.
 Can be used in simple robotic applications to control direction and speed of single motor.

CONCLUSION:
In this project we have try to control the speed and the direction of the motor. By using
the Arduino. This simple project can be used in toys (children car), fans, tools, discs, pumps or
everywhere we want to control the speed and the rotation of the motor. This project is for only
one motor but we can extend it up to two motor some implementations will be requaied.

REFERENCE:
 DC Motor Direction and Speed Control by Arduino through RF Wireless Technique
[http://www.ijircce.com/upload/2016/spl2/8_06___Boaz2__DC%20Motor%20Direction.
pdf].
 ELECTRONICS HUB [https://www.electronicshub.org/speed-and-direction-control-of-
dc-motor-using-arduino/].

Вам также может понравиться