Instructables
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
 
Remove these adsRemove these ads by Signing Up

Step 1: Parts required

Picture of Parts required
L293D.gif
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:

1-40 of 92Next »

interesting!

jp2kumar made it!6 days ago
working wonderful
temp_-2106129787.jpg
HalimA114 days ago

Could it be done with pic18f4550?

returner1 month ago

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.

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 !!

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

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

RichardR32 months ago

Sir Rui Santos, I have a question. May I know if it is possible to get sensor value and command an Arduino (e.g. motors using L293D) at the same time? If yes, i hope you'll give me some ref, Thanks.

RichardR32 months ago

Sir Rui Santos, I have a question. May I know if it is possible to get sensor value and command an Arduino (e.g. motors using L293D) at the same time? If yes, i hope you'll give me some ref, Thanks.

RichardR32 months ago

Sir Rui Santos, I have a question. May I know if it is possible to get sensor value and command an Arduino (e.g. motors using L293D) at the same time? If yes, i hope you'll give me some ref, Thanks.

mustafaa62 months ago

Hi

Thanks for your tutorial. I am trying to contrrol arduino by android. I have done coding for arduino but I want to make prosecc when its is pushed android on button so can you sahere ardoino source code.

minsujeong9862 months ago

Is it available to use by I-phone?

I don't have any Android device.

Also, can you recommend a bluetooth control App?

HenleyMcCoy3 months ago

can I use any kind of bluetooth module?

HenleyMcCoy3 months ago

can I use any kind of bluetooth module?

i had to change by tx,rx becoz it was not working,

TahirJ5 months ago

How could I modify the code to add in voice commands and connect a bluetooth headset to verbally command arduino/bluetooth module?

there is no need to modiy ur code ,just use a voice enabled blueetooth app from playstore.

HELP NEEDED

hi,i wrote a program to control to 12v dc motor x 2,motors are moving forward and reverse ,but there is an issue,when i press 1 ,output fwd,but when i press o,output is fwd,but when i press 0 and 1 simultaneously it may give output :rwd

using blueterm app .

ur code is nor uploading to mcu:arduino,showing some error.

code:below

#include <SoftwareSerial.h>//import library

SoftwareSerial Blueterm (10, 11);// rx ,tx

int motoroutput1=3;

int motoroutput2=4;

int motoroutput3=6;

int motoroutput4=7;

int motorenableA=5;

int motorenableB=8;

int BluetoothData; //data from blueterm app

void setup() {

Blueterm .begin(9600);

Blueterm .println(" press 0:FWD");

Blueterm .println(" press 1:RWD");

pinMode(motoroutput1,OUTPUT);

pinMode(motoroutput2,OUTPUT);

pinMode(motoroutput3,OUTPUT);

pinMode(motoroutput4,OUTPUT);

pinMode(motorenableA,OUTPUT);

pinMode(motorenableB,OUTPUT);

digitalWrite(motorenableA,HIGH);

digitalWrite(motorenableB,HIGH);// put your setup code here, to run once:

}

void loop() {

if (Blueterm .available()){

BluetoothData=Blueterm .read();

if(BluetoothData='0'){

digitalWrite(motoroutput1, HIGH);

digitalWrite(motoroutput2, LOW);

digitalWrite(motoroutput3, HIGH);

digitalWrite(motoroutput4, LOW);

Blueterm .println("Motoroutput fwd");

}}

if (Blueterm .available()){

BluetoothData=Blueterm.read();

if(BluetoothData='1'){

digitalWrite(motoroutput1, LOW);

digitalWrite(motoroutput2, HIGH);

digitalWrite(motoroutput3, LOW);

digitalWrite(motoroutput4, HIGH);

Genetronex.println("motoroutput rwd");

}}

//if (blueterm.available()){

// BluetoothData=blueterm.read();

//if(BluetoothData='2'){

// digitalWrite(motoroutput1,HIGH);

// digitalWrite(motoroutput3,LOW);

// digitalWrite(motoroutput2,LOW);

//digitalWrite(motoroutput4,HIGH);

//blueterm.println("motoroutput left");

//}

//if (blueterm.available()){

//BluetoothData=blueterm.read();

//if(BluetoothData='3'){

//digitalWrite(motoroutput1,HIGH);

//digitalWrite(motoroutput3,LOW);

//digitalWrite(motoroutput2,LOW);

//digitalWrite(motoroutput4,HIGH);

//blueterm.println("motoroutput right");

//}

//if (blueterm.available()){

// BluetoothData=blueterm.read();

//if(BluetoothData='4'){

//digitalWrite(motoroutput1,LOW);

//digitalWrite(motoroutput3,LOW);

//digitalWrite(motoroutput2,LOW);

//digitalWrite(motoroutput4,LOW);

//blueterm.println("motoroutput STOP");

//}

}//}} //}}}

// put your main code here, to run repeatedly:

i am wworking on a project to control a robot using bluetooth .help in interfacing bluetooth module working on pic 16f

gsandhu28 months ago

I’m working on a project which is about making a rescue
robot . I have struggling with it for 4 months and now all the mechanical works
had been done . but I’m facing difficulty in make the robot to work with rf
module can u plzz help me…

I want make transmitter and receiver that can control the
motion…I mean that receiver should have control 8 dc gear motor and each dc
motor should have a forward and backward botton to control the motion ……can u
kindly help me with this project ….if u can make the circuit board diagram for
the PCB ….or any other suggestion plz reply……mail me at “sunny1995gagan@gmail.com”

Sheikh Zabi8 months ago

I have a project - Bluetooth data acquisition system using arduino , I will be receiving data on my android phone, so if I could know the android coding part it really would be helpful.

hustlervanz11 months ago

can i use L293NE IC than L293D IC?

kag432 hustlervanz10 months ago

The NE is just the package so there is a L293NE and a L293DNE, but the difference is that the L293DNE has flyback diodes built in while the L293NE does not and they need to be added externally as on page 2 of the datasheet:

http://www.ti.com/lit/ds/symlink/l293d.pdf

jacpac11 months ago

can i use 2 motors? and how?

jacpac11 months ago

can i use my nano to create this project

i need ur .aia file for android

ongara_0112 months ago
can help me bot ths dc motor; minebea 17PM-J. m need the spect
famsinyi1 year ago

Hi, the hc 05 (slave module) I purchased cannot be detected by my android. I think the connection is straight forward, I suspect the module I bought doesn't work, can u point me to any store to buy one that you used?

Hi!

Thanks for the code and all the instructions! Good sharing.

I have a problem as the bluetooth module I am using is a different one, in my case it is LCBTCY6, but unfortunately it is not working. Do you have any clue about why might it be? Through the serial monitor works perfectly.

Thanks in advance!

RuiSantos (author)  áde marcos serrano1 year ago

Thanks Áde.

If it's working via serial monitor means your circuit is correct!

About your bluetooth module... I'm not sure how it works...as I've never used one. Try to take a look at both datasheets.

See If my bluetooth works like yours.. as I don't have the time do that myself.

Your module might need some kind of configuration before you use it. because I'm sure both modules can communicate via serial port with the Arduino.

hey after instaliing blueterm app. do we need to do anythng in that app.. means for setting commands n all.. plz reply fast...
RuiSantos (author)  namrataqwer1 year ago
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.

cgoh11 year ago
Hi, we have used the given code above. However, the motor only seems to turn left but not turn right. do you know what is the problem occuring?
nileshs cgoh11 year ago
In which software this code i have to write please sir tell me.
RuiSantos (author)  nileshs1 year ago
The code is to be upload through the Arduino IDE into the Arduino board :)
prana31 year ago
Hey brother ...The Blue term app is not available on play store //....
So can anyone plz suggest any other app to control bluetooth
RuiSantos (author)  prana31 year ago
I didn't knew... Instead of using blueterm, please take a look at my new tutorial here:
http://randomnerdtutorials.com/arduino-control-2-dc-motors-via-bluetooth/

I've developed this app with Mit App inventor... so you can control your arduino via bluetooth. Take a look it's much better then blueterm and it looks nicer.

I hope this helps, leave a comment on my website if you have any questions.
All the best,
Rui Santos
Hi!
i found an app for my iPhone 5, "nBlueTerm"
it will work? or i need an android phone?
Thanks! :D
nc0881 year ago
Why do you need to connect the bluetooth module after you connect with bluetooth. is there any way this can work without having to make the connection after you connet by bluetooth?
1234rcadj1 year ago
how could i download the android apps so that i can continue my study? please help
1-40 of 92Next »