Introduction: Arduino - Control DC Motor Via Bluetooth

Picture of Arduino - Control DC Motor Via Bluetooth
Hi guys,
In this project we will control a DC motor with a smartphone via bluetooth. This project is great to learn more about:
-DC motor
-Interfacing Arduino with your smartphone
-Bluetooth module
-L293D

you can visit my website for more electronic projects, interesting news and tips.
Check this video to see it working

Step 1: Parts Required

Picture of Parts Required

1x Arduino Uno
1x Bluetooth Module (for example: HC-05)
1x Smartphone (any Android will work)
BlueTerm application
1x L293D IC
1x DC motor
1x Breadboard
Jumper Cables

Step 2: Schematics and Common Mistakes

Picture of Schematics and Common Mistakes

Two common mistakes:
-You need to remove the RX and TX cables when you’re uploading the sketch to your Arduino.
-Sometimes people connect the TX from the bluetooth module to the TX of the Arduino… that’s wrong and it won’t work. Make sure you connect it properly, the TX into RX and the RX into the TX.

Note:
If the HC-05 Bluetooth Module asks for a password, It's '1234'.

Step 3: Arduino Code

Picture of Arduino Code
For the android communication with our bluetooth module I’ve used the BlueTerm app, It’s completely free, so you just need to go to “Play store” and download it. Then you just need to connect your smarthphone with the bluetooth module. Remember to remove the TX and RX cables. (you can see in youtube video below how that’s done).

Step 4: Final Product

Picture of Final Product
I’ve only set 3 commands to control the DC motor:

    ’0′ – Turns off the DC motor
    ’1′ – DC motor rotates to right
    ’2′ – DC motor rotates to left

Check this video to see the circuit in action!
you can visit my website for more electronic projects, interesting news and tips:

Comments

NaniB5 (author)2017-10-25

can you help me to control the speed of dc motor

danielferns (author)2017-07-22

Very helpful. Is there a way i can control the speed of the motor via bluethooth. Or serial com via pc? Thanks in andvance!

TorinA1 (author)danielferns2017-09-25

you would need either a stepper or servo motor for accurate speed control

bcboy1956 (author)2017-07-21

I am new to the electronic build is there more information regarding the electronic parts, detailed instruction of the schematics? like how to attach the wires to the dc motor etc.

prakhar_42 (author)2017-06-11

Nice Project

prakhar_42 (author)2017-06-08

Hey guys I am facing a problem in connecting my app with HC-05 its like there is no option for connect

grechy29 (author)2017-05-14

This circuit works amazing, however, i had to create a trick in the system so that i got my motor to run off 11.4v whilst the arduino worked off 11.4 through a 5v voltage regulator.

Hi I am mad (author)2017-01-08

hi this was a very good project

Clap clap

And I have a question can we make this voice controlled

desertwalker (author)2016-12-16

Hey Rui,

Thanks for a great tutorial, just wanted to point out a discrepancy with the code you kindly provided and the Fritzing diagram.

In the code

int motorPin1 = 3; // pin 2 on L293D IC
int motorPin2 = 4; // pin 7 on L293D IC

In the diagram

3 ---> pin 7 on L293D IC

4--> pin 2 on L293D IC

Regards,

desertwalker...

cyhalosrox (author)2016-07-16

is there a more detailed instruction of the schematics? like how to attach the wires to the dc motor etc.

Agent shah (author)2016-02-15

How should I connect more than one motors

DishantS6 (author)Agent shah2016-06-18

dude, you can, if you use l293d then basically pins 3 and 6 of the l293d can control one motor and pin 14 and 12 can connect to another motor on l293d.

SebastianC54 (author)Agent shah2016-02-19

I did my project with out the transistors and it worked fine, you will want to just directly wire two pins per motor, with one on high and the other on low, i can get you a code ill put in the comments tomorrow

MohammedM95 (author)2016-04-12

i cant connect to bluetooth !!why ?

its pair with the smart phone but no match !!

JomA2 (author)2016-04-03

The code and circuit I have run perfectly when connected up to my laptop or any computer. But when connected to an external power supply its not working

SamratD3 (author)2016-03-02

What is the power source for the motor...??? I mean don't we need a battery or something to power up the circuit???

SebastianC54 (author)2016-01-25

Im doing a school project and I want to do this with a third motor, and relays and lights. I am using the relays to give it 9.6v instead of 5v how would I change the code to help me set it up using the blueterm app

95basilk (author)2016-01-19

hello sir.... how can i control spees without using an arudino uno r3??
can i use anything other which çan be manufactured by ourselves insted of this arduino?

lpradhan1 (author)2016-01-11

Why sometime i get error while connecting to bluetooth deivce ??

all4alex (author)2015-12-13

can someone help? Im a newbie in arduino . i want to make the same concept in your project but i want to use servo motor . what will i change in this project?

JuanG43 (author)2015-10-03

How many dc motors can i control with it?

matt_shungoh (author)JuanG432015-11-29

2 motors

Lintang_Wisesa made it! (author)2015-11-10

thx a lot bro, this is mine: https://www.youtube.com/watch?v=NeP0aTYB5qU

namrataqwer (author)2013-12-30

hey after instaliing blueterm app. do we need to do anythng in that app.. means for setting commands n all.. plz reply fast...

i had burn code in Arduino board
everything is done from my side
stilling confusing how to use it with application
data is not fetching

RuiSantos (author)namrataqwer2014-01-04

You don't need to configure anything... I think, but you can change if you like... for a better display. take a look at all the setting and change the way you prefer.
Sorry for taking so long to answer I've only saw you question today.

vedantchawla.info (author)2015-10-09

i made this
i check everything twice
sometimes getting error from blueterm application "device connection was lost"
motor not work and I'm not getting any response from device

laith mohamed (author)2015-09-26

Looks good work i like it .

kavish laxkar (author)2015-06-10

i made it..but the ic gets hotter. what is the reason..and can i control two motors with it.?

Sara Gupta (author)kavish laxkar2015-09-23

pls send the complete working code.

GauravK10 (author)kavish laxkar2015-07-11

ur ic is heated because of the high current u r drawing through the motor.... maybe instead of l293d , u should go for l298. and yes u can control two motors from a single l293d or l298.

tytower (author)2015-08-13

Get it up front that you are charging $20 for this book and you will get a few more takeups . I for one won't be .

PeymannP (author)2015-07-28

HELLO YOU CAN SEND SOREC COD FOR MACKING APP ANDROUID

:-))))

ahmedH22 made it! (author)2015-07-25

I Made it!!!!

DeepakT1 (author)2015-06-23

dc motor is unable to get power supply sir?

any suggetions?

shah dharmik (author)2015-06-07

Hey dear what is the range of bluetooth modulo?
How far can i operate motor?

BurakTutal (author)2015-06-02

Hey this is very useful, I will use the same one with much bigger DC motor.

Do you think L293D will burn because of the more current?

101072 (author)2015-04-22

great

bbava (author)2015-04-09

hi i need to control 4 dc geared motor using bluetooth how can i do that ?

youssefa (author)2015-04-06

Hello sir; I have a question concerning the video which allows to command(order) an engine has direct current and I shall want to know what is that I few to put a servomotor instead of the engine has direct current and is that I little to command(order) several engine in liver? And thank you in advanc

returner (author)2015-01-21

Hi, i have a question and i hope you guys can help me with this. how does the arduino actually know actually know which data it is going to send or receive? in which part of the code does it do that? i want to make two arduinos one having a HC05 as a master sending data over to a HC06 slave on two different laptops. I hope you can answer me.

Vamsi Srikanth (author)returner2015-01-27

Well in the given program, after the loop

there are if, else if, else if statements. In those it is clearly mentioned the below things

input = 0, then both input pins ( 2 & 7 ) should be LOW

input = 1, then 2 should be LOW & 7 should be HIGH

input = 2, then 2 should be HIGH & 7 should be LOW

I hope you got it !!

PratikM1 (author)Vamsi Srikanth2015-04-03

Can you send me thesis nd ppt of this perticular mini project. plz sir I am herbly request you send me this project related suff on my email. I am not able to make thesis of this project. pratikmankar1802@gmail.com this is my id plz send me

tendous (author)2015-03-16

can i use L298 in motor driver shield instead of teh single chip L293

liming.li.10 (author)2015-02-24

interesting!

JPUDAYAKUMAR made it! (author)2015-02-20

working wonderful

HalimA1 (author)2015-02-12

Could it be done with pic18f4550?

nisarg (author)2015-01-01

although i connected everything correctly n uploaded the code, it doesn't work is anything wrong wid the app or i m missing something?

FerH (author)2014-12-30

I'm new in all these so I had a question, what is the purpose of the variable "flag"?

About This Instructable

275,830views

672favorites

License:

Bio: Author, Blogger, Electronics Enthusiast and Entrepreneur. For complete Electronics Projects and Tutorials go to: http://randomnerdtutorials.com/start-here
More by RuiSantos:ESP8266 Web Server (Without Arduino)Arduino Simple Memory GameArduino – Datalogger with Temperature Sensor and Photoresistor
Add instructable to: