You are on page 1of 11

3/13/2018 DC Motor Speed Control Using Arduino & PWM with program and circuit

Looking for Latest Electronics Project Kits? CLICK HERE (http://www.store.circuitstoday.com/)


(http://www.circuitstoday.com)

Ads by Google

PWM Motor Control Circuit Arduino Project DC Motor

Project and Program Arduino Servo Project Design

DC Motor Speed Control Using Arduino & PWM


(http://www.circuitstoday.com/dc-motor-speed-
control-arduino-pwm)
 john  February 17, 2018  1 Comment

Start Download - View PDF


Merge & Convert Files into PDFs w/ EasyPDFCombine - Free! easypdfcombine.com

DC Motor Speed Control Using Arduino & PWM


Speed control of DC motor with PC Interface is an easy DIY project. In this project DC motor’s speed is controlled by sending the command through PC. Arduino is
directly connected to PC through the USB cable and command is given to Arduino on serial monitor of the Arduino IDE.

Motor is connected to a transistor, and the base of transistor is connected to PWM pin of Arduino and motors speed is varied according to PWM signal coming from
Arduino.

Arduino DC Motor Control – Working

Arduino is connected to PC through the USB cable. We can send the command to PC on the serial monitor. We can change the speed of motor from 0 to 9. When 0 is
sent over the Serial Monitor, the motor runs at minimum speed (that is zero). When the speed is varied from 1 to 9, the speed increases, with the value 9 set as the
maximum speed of the motor.

A PWM DC motor controller technology is used to control the speed. In PWM, the Arduino sends a pulsating wave that is similar to astable mode of 555 timer IC.

PWM Speed Control (Pulse Width Modulation)

Microcontroller and Arduino are digital devices; they cannot give the analog output. Microcontroller gives Zero and ONE as output, where ZERO is logical LOW and
ONE is logical HIGH. In our case, we are using 5 volt version of the Arduino. So it’s logical ZERO is zero voltage, and logical HIGH is 5 voltage.

Digital output is good for digital devices but sometimes we need the analog output. In such a case the PWM is very useful. In the PWM, output signal switches
between zero and one, on high and xed frequency, as shown in the gure below.

http://www.circuitstoday.com/dc-motor-speed-control-arduino-pwm 1/11
3/13/2018 DC Motor Speed Control Using Arduino & PWM with program and circuit

(http://www.circuitstoday.com/wp-content/uploads/2017/11/Output-Signal-of-PWM.jpg)

Output Signal of PWM

As shown in the above gure the ON time is “Ton” and the OFF time is “Toff”. T is the sum of the “Ton” and “Toff” which is called the Time Period. In the concept of PWM
“T” is not varying and the “Ton” and the “Toff” can vary, in this way when “Ton” increase “Toff” will decrease and “Toff” increase when “Ton” decrease proportionally.

The duty cycle is the fraction of one Time period. Duty cycle is commonly expressed as a percentage or a ratio. A period is the time it takes for a signal to complete an
on-and-off cycle. As a formula, a duty cycle may be expressed as:

DUTY CYCLE = (Ton ÷ T) x100 %

Now the motor’s speed varies according to duty cycle. Suppose the duty is zero, motor does not run and when duty cycle is 100 % the motor moves on maximum RPM.
But this concept is not always right because motor starts running after giving some xed voltage that is called threshold voltage.

Transistor (2N2222)
Microcontroller and the Arduino can process signals and consumes almost 20 to 40mA current but motors need high current and voltage, so we are using the
transistor for driving the motor. Transistor is connected in series with motor and transistor’s base is connected to Arduino’s PWM pin through a resistance. PWM
signal is coming from Arduino and the transistor works as a switch and it short circuit the Emitter (E) and Collector (C) when PWM signal is in High state and normally
opens when PWM signal is in LOW state. This process works continuously and the motors runs at desired speed.

Components

Components Speci cation Quantity

Arduino Nano 1

DC Motor Low Power 1

Transistor 2N222 1

Power Adapter 12 Volts 1

Resistance 1K 1

Diode 1N4004 1

USB Cable For Arduino Nano 1

Arduino DC Motor Control – Circuit


Circuit diagram is shown in the gure below. If you are making this circuit on the general purpose PCB (ZERO PCB) or breadboard, this gure is useful.

http://www.circuitstoday.com/dc-motor-speed-control-arduino-pwm 2/11
3/13/2018 DC Motor Speed Control Using Arduino & PWM with program and circuit

(http://www.circuitstoday.com/wp-content/uploads/2017/11/Arduino-DC-Motor-Speed-Control.bmp)

Arduino DC Motor Speed Control

Moreover, if you are good in the PCB Etching, use the images provided below.

(http://www.circuitstoday.com/wp-content/uploads/2017/11/Arduino-PWM-DC-Motor-Control-PCB-
Design-.png)

Arduino-PWM DC Motor Control – PCB Design

(http://www.circuitstoday.com/wp-content/uploads/2017/11/Speed-Control-of-DC-Motor.png)

Speed Control of DC Motor

http://www.circuitstoday.com/dc-motor-speed-control-arduino-pwm 3/11
3/13/2018 DC Motor Speed Control Using Arduino & PWM with program and circuit

In the circuit an Arduino Nano (http://www.circuitstoday.com/arduino-nano-tutorial-pinout-schematics) is used, which is very small in size and Breadboard friendly.

A transistor’s (2n2222) BASE pin is connected to D9 pin of Arduino through a Resistance of 1k ohm, Resistance is used for current limitation. Motor is connected
between collector pin of transistor and Vcc. A diode (1n4004) is connected parallel to the motor in reverse bias; it is used for blocking the reverse current. Emitter pin
of the transistor is connected to the ground. This circuit is powered by a 12 volt adapter.

Arduino PWM Motor Control – Video

DC Motor Speed Control Using Arduino & PWM

(http://www.circuitstoday.com/wp-content/uploads/2017/11/Arduino-DC-Motor-Control.jpg)

Arduino DC Motor Control

http://www.circuitstoday.com/dc-motor-speed-control-arduino-pwm 4/11
3/13/2018 DC Motor Speed Control Using Arduino & PWM with program and circuit

(http://www.circuitstoday.com/wp-content/uploads/2017/11/Arduino-PWM-Motor-Control.jpg)

Arduino PWM Motor Control

DC Motor Speed Control – Download Program

Download Program/Code (http://www.circuitstoday.com/wp-content/uploads/ les/arduino/DC_Motor_Speed_Control_Arduino_PWM.rar)

In the beginning of the code two integers are declared by name “out1” and “val”, where out1 is equal to 9 which shown that pin D9 of Arduino is used as output pin (or
PWM pin). Moreover, data coming from the serial monitor saved in the second integer “val”.

In the void setup() serial communication is begin by using function “Serial.begin(9600)” where 9600 is the baud rate of serial monitor. After it “out1” is declared as
output because the motor is an output device.

In the void loop “serial.available” is used inside the “if” condition, it become true when any data is sent over the serial monitor. This data is saved in “val” integer using
“Serial.read” function.

After it many “if” conditions are used, in the rst “if condition”, when ‘0’ is sent through the serial monitor, it become true. In the bracket “analogWrite(out1 , 0)” is used
for running the motor at the zero PWM value. In the function “analogWrite (out1, 0)”, “out1” is used to indicate the pin which we want to use and “0” is the PWM value
 at this pin. After it “Speed is = 0” is shown on serial monitor using “Serial.println” function. After it the integer “val” is updated to 10, where 10 is the random value,
which is other than 0 to 9.

In the next line if condition is used for “val ==1”, at this time motor runs at PWM value of 175. Same conditions are used upto 9, at the 9 motor runs at 255 PWM value,
255 is the maximum PWM value.

Process

1. Connect the Arduino through USB and upload the code


2. Open the serial monitor and set the baud rate at 9600
3. Now type any number from 0 to 9.

After typing any value from zero to 9, speed of the motor varies, but we cannot see varying speed in video properly, but you can see it live.

Ads by Google

PWM Motor Control Circuit Project Design

Arduino Servo Project and Program

Categories: Arduino (http://www.circuitstoday.com/category/arduino)

 Previous post (( Next post 


hh

tt
http://www.circuitstoday.com/dc-motor-speed-control-arduino-pwm 5/11
3/13/2018 DC Motor Speed Control Using Arduino & PWM with program and circuit

Yangon Port Modernisation tt


Find out how Hitachi is helping to improve ports' e ciency social-innovation.hitachi
pp

::

//
You may also like:
//

ww
8 Best Arduino Starter Kit for Beginners (http://www.circuitstoday.com/best-arduino-starter-kit-beginner)
w
w
Arduino Nano Tutorial – Pinout & Schematics (http://www.circuitstoday.com/arduino-nano-tutorial-pinout-
schematics) w
w

..
Arduino Mega Tutorial – Pinout & Schematics (http://www.circuitstoday.com/arduino-mega-pinout-schematics)
cc
Project: Home Automation Using IR Remote Control (http://www.circuitstoday.com/home-automation-ir-remote-
control) ii

rr
Project: Auto Intensity Control Of Street Light Using Arduino (http://www.circuitstoday.com/auto-intensity-control-
street-light-arduino) cc

uu

ii

tt

We recommend: ss

tt
Mains operated LED lamp (http://www.circuitstoday.com/mains-operated-led-lamp)
oo
Buck boost converter circuit (http://www.circuitstoday.com/buck-boost-converter-circuit)
dd
Voltage Controlled Oscillator (http://www.circuitstoday.com/voltage-controlled-oscillator)
aa
SCR Control circuits (http://www.circuitstoday.com/scr-control-circuits)
yy

Burglar Alarm Circuit and Projects (http://www.circuitstoday.com/burglar-alarm-circuit-and-projects)


..

cc

oo

m
m
COMMENTS
//

asish joseph cm
February 9, 2018 aa

rg

-n
can you give the circuit diagram and program code of ph value detecter using aurdino??
se
 pt

eo

e-
LEAVE A REPLY dr

-e
Your email address will not be published. Required elds are marked *
ds

ei
Comment
ts

et

co

tr

o)

Name * d

http://www.circuitstoday.com/dc-motor-speed-control-arduino-pwm 6/11
3/13/2018 DC Motor Speed Control Using Arduino & PWM with program and circuit
Email * o

Website

POST COMMENT

SORT BY TYPE

101-Announcements (http://www.circuitstoday.com/category/announcements) (28)

555 Timer IC (http://www.circuitstoday.com/category/555-timer-ic) (16)

8051 (http://www.circuitstoday.com/category/8051) (26)

8051 projects (http://www.circuitstoday.com/category/8051-projects) (21)

Ampli er Circuits (http://www.circuitstoday.com/category/ampli er-circuits) (39)

Arduino (http://www.circuitstoday.com/category/arduino) (70)

ARM (http://www.circuitstoday.com/category/arm) (3)

Audio Circuits (http://www.circuitstoday.com/category/audio-circuits) (104)

Automotive Circuits (http://www.circuitstoday.com/category/automotive-circuits) (28)

AVR (http://www.circuitstoday.com/category/avr) (23)

Basic Electricity (http://www.circuitstoday.com/category/basic-electricity) (1)

Basic Electronics (http://www.circuitstoday.com/category/basic-electronics) (17)

Battery Circuits (http://www.circuitstoday.com/category/battery-related) (23)

C plus plus (http://www.circuitstoday.com/category/cpluplus) (7)

C Programming (http://www.circuitstoday.com/category/c-programming) (14)

Cable TV Circuits (http://www.circuitstoday.com/category/cable-tv) (1)

Camera Technology (http://www.circuitstoday.com/category/camera) (5)

Clipping and Clamping Circuits (http://www.circuitstoday.com/category/clipping-and-clamping-circuits) (7)

Clocking & Timer Circuits (http://www.circuitstoday.com/category/clocking-timer-circuits) (2)

Conversion Circuits (http://www.circuitstoday.com/category/conversion-circuits) (10)

Counter Circuits (http://www.circuitstoday.com/category/counter-circuits) (2)

Counters (http://www.circuitstoday.com/category/counters) (2)

Digital Electronics (http://www.circuitstoday.com/category/digital-electronics) (11)

Drones (http://www.circuitstoday.com/category/drones) (1)

Education & Training (http://www.circuitstoday.com/category/education-training) (7)

Electronic Components (http://www.circuitstoday.com/category/components) (31)

Electronic Keys & Locks (http://www.circuitstoday.com/category/electronic-keys-locks) (3)

Electronics Books (http://www.circuitstoday.com/category/electronics-books) (10)

Electronics Jobs (http://www.circuitstoday.com/category/electronics-jobs) (4)

http://www.circuitstoday.com/dc-motor-speed-control-arduino-pwm 7/11
3/13/2018 DC Motor Speed Control Using Arduino & PWM with program and circuit

Embedded Systems (http://www.circuitstoday.com/category/embedded-systems) (7)

Equipment Reviews (http://www.circuitstoday.com/category/equipment-reviews) (1)

Events (http://www.circuitstoday.com/category/events) (3)

Fan Circuits (http://www.circuitstoday.com/category/fan-circuits) (1)

Filter Circuits (http://www.circuitstoday.com/category/ lter-circuits) (16)

Fire Alarm (http://www.circuitstoday.com/category/ re-alarm) (3)

Fun & Game Circuits (http://www.circuitstoday.com/category/fun-game) (14)

Gadget Reviews (http://www.circuitstoday.com/category/gadget-reviews) (6)

Guides (http://www.circuitstoday.com/category/guides) (3)

Ham Radio Circuits (http://www.circuitstoday.com/category/ham-radio-circuits) (2)

High Voltage Circuits (http://www.circuitstoday.com/category/high-voltage-circuits) (1)

History (http://www.circuitstoday.com/category/history) (26)

Home Circuits (http://www.circuitstoday.com/category/home-circuits) (35)

Industrial Circuits (http://www.circuitstoday.com/category/industrial-circuits) (15)

Infographics (http://www.circuitstoday.com/category/infographics) (1)

Instruments (http://www.circuitstoday.com/category/instruments) (13)

Integrated Circuits (http://www.circuitstoday.com/category/integrated-circuits) (20)

Inverters (http://www.circuitstoday.com/category/inverter) (5)

Lab Manuals (http://www.circuitstoday.com/category/lab-manual) (20)

LED related (http://www.circuitstoday.com/category/led-related) (3)

Light Related (http://www.circuitstoday.com/category/light-related) (14)

Lighting Circuits (http://www.circuitstoday.com/category/lighting-circuits) (44)

MATLAB (http://www.circuitstoday.com/category/matlab) (3)

Microcontrollers (http://www.circuitstoday.com/category/microcontrollers) (12)

Mobile Phone Related (http://www.circuitstoday.com/category/mobile-phone-related) (3)

Motor Related (http://www.circuitstoday.com/category/motor-related) (14)

Nanotechnology (http://www.circuitstoday.com/category/nanotechnology) (14)

Oscillators (http://www.circuitstoday.com/category/oscillators) (25)

PCB (http://www.circuitstoday.com/category/pcb) (2)

Peripheral Interface Controller (PIC) (http://www.circuitstoday.com/category/peripheral-interface-controller-pic) (29)

Power Controller Circuits (http://www.circuitstoday.com/category/power-controller-circuits) (8)

Power Electronics (http://www.circuitstoday.com/category/power-electronics) (3)

Power Supplies (http://www.circuitstoday.com/category/power-supplies) (72)

Product Reviews (http://www.circuitstoday.com/category/product-reviews) (12)

Project Ideas (http://www.circuitstoday.com/category/project-ideas) (1)

Projects (http://www.circuitstoday.com/category/projects) (7)

Proteus (http://www.circuitstoday.com/category/proteus) (16)

Proximity Detectors (http://www.circuitstoday.com/category/proximity-detectors) (3)

Radio Circuits (http://www.circuitstoday.com/category/radio-circuits) (30)

Radio Transmitters (http://www.circuitstoday.com/category/radio-transmitters) (19)

Raspberry Pi (http://www.circuitstoday.com/category/raspberry-pi) (3)

Relays (http://www.circuitstoday.com/category/relays) (3)

Remote Circuits (http://www.circuitstoday.com/category/remote-circuits) (12)

Reviews (http://www.circuitstoday.com/category/reviews) (5)

Robotics (http://www.circuitstoday.com/category/robotics) (6)

RTOS (http://www.circuitstoday.com/category/rtos) (2)

Security & Saftey (http://www.circuitstoday.com/category/security-saftey) (17)

Sensor Circuits (http://www.circuitstoday.com/category/sensor-circuits) (16)

Signal Conditioners (http://www.circuitstoday.com/category/signal-conditioners) (11)

Signal Generators (http://www.circuitstoday.com/category/signal-generators) (13)

Speed Controller Circuits (http://www.circuitstoday.com/category/speed-controller-circuits) (1)

State space analysis (http://www.circuitstoday.com/category/state-space-analysis) (2)

http://www.circuitstoday.com/dc-motor-speed-control-arduino-pwm 8/11
3/13/2018 DC Motor Speed Control Using Arduino & PWM with program and circuit

Switching Circuits (http://www.circuitstoday.com/category/switching-circuits) (6)

Tech News (http://www.circuitstoday.com/category/tech-news) (87)

Telephone Related (http://www.circuitstoday.com/category/telephone-related) (9)

Television Related (http://www.circuitstoday.com/category/television-related) (4)

Temperature Related (http://www.circuitstoday.com/category/temperature-related) (3)

Test & Measurement Circuits (http://www.circuitstoday.com/category/test-measurement-gadgets) (38)

Testing Components (http://www.circuitstoday.com/category/testing-components) (9)

Three phase circuits (http://www.circuitstoday.com/category/three-phase-circuits) (1)

Timer Circuits (http://www.circuitstoday.com/category/timer-circuits) (3)

Tone generator circuits (http://www.circuitstoday.com/category/tone-generator-circuits) (20)

Tools and Softwares (http://www.circuitstoday.com/category/tools-and-softwares) (6)

Transmitters (http://www.circuitstoday.com/category/transmitters) (7)

Tutorials (http://www.circuitstoday.com/category/tutorials) (163)

UPS (http://www.circuitstoday.com/category/ups) (2)

USB Circuits (http://www.circuitstoday.com/category/usb-circuits) (3)

Videos (http://www.circuitstoday.com/category/videos) (5)

VLSI (http://www.circuitstoday.com/category/vlsi) (36)

Voltage Regulators (http://www.circuitstoday.com/category/voltage-regulators) (15)

Instant Quote

Dimensions
Length x Width mm

Quantity

Choose Num (pcs)

Layers
2 Layers

Thickness

1.6mm

Get a $5.00 coupons Bonus

Quote Now

(https://www.wellpcb.com/)

OTHER LINKS

About (http://www.circuitstoday.com/about)

Advertise With Us (http://www.circuitstoday.com/advertise-with-us)

http://www.circuitstoday.com/dc-motor-speed-control-arduino-pwm 9/11
3/13/2018 DC Motor Speed Control Using Arduino & PWM with program and circuit

Authors (http://www.circuitstoday.com/authors)

Datasheets (http://www.circuitstoday.com/datasheets)

Disclaimer (http://www.circuitstoday.com/disclaimer)

Electronic Circuit Symbols (http://www.circuitstoday.com/electronic-circuit-symbols)

Electronic Project Kits (http://www.circuitstoday.com/project-kits)

Lab Manuals (http://www.circuitstoday.com/lab-manuals)

Electronic Circuits Lab (http://www.circuitstoday.com/lab-manuals/electronic-circuits-lab)

Microcontroller lab (http://www.circuitstoday.com/lab-manuals/microcontroller-lab)

Microprocessor Lab (http://www.circuitstoday.com/lab-manuals/microprocessor-lab)

Privacy Policy (http://www.circuitstoday.com/privacy-policy)

Resistor Color Code Calculator (http://www.circuitstoday.com/resistor-color-code-calculator)

Testing Components (http://www.circuitstoday.com/testing-components)

Write For Us (http://www.circuitstoday.com/write-for-us)

PCBFOX

PCB Manufacturers (http://pcbfox.com/)

© 2015 CircuitsToday. All rights reserved.

About (http://www.circuitstoday.com/about) | Privacy Policy (http://www.circuitstoday.com/privacy-policy) |


Write For Us|Earn Money (http://www.circuitstoday.com/write-for-us)

Latest Electronic Circuits

acebook.com/sharer.php)

http://www.circuitstoday.com/dc-motor-speed-control-arduino-pwm 10/11
3/13/2018 DC Motor Speed Control Using Arduino & PWM with program and circuit

http://www.circuitstoday.com/dc-motor-speed-control-arduino-pwm 11/11

You might also like