In this project we will control a DC motor with a smartphone via bluetooth.
This project is great to learn more about:
- DC motors
- Interfacing Arduino with your smartphone
- Bluetooth
- L293D IC
If you don’t have the L293 IC you can make the same circuit using the H bridge, anyway I really recommend you to read more about that and the IC datasheet. There’s plenty of tutorials about that. Also If you don’t have a bluetooth module yet you can see my review about this bluetooth module and where to buy one. So Let’s start…
Parts required
- Arduino UNO – read Best Arduino Starter Kits
- 1x Bluetooth Module (for example: HC-05 or 06)
- 1x Smartphone (any Android will work)
- BlueTerm application
- 1x L293D IC
- 1x DC motor
- 1x Breadboard
- Jumper Cables
You can use the preceding links or go directly to MakerAdvisor.com/tools to find all the parts for your projects at the best price!
Schematics
I can only TX and RX cables after you upload the Arduino code.
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’.
Upload this code below
Make sure you remove the wires from RX and TX otherwise the code won’t upload properly!
/*
* Control DC motor with Smartphone via bluetooth
* created by Rui Santos, https://randomnerdtutorials.com
*/
int motorPin1 = 3; // pin 2 on L293D IC
int motorPin2 = 4; // pin 7 on L293D IC
int enablePin = 5; // pin 1 on L293D IC
int state;
int flag=0; //makes sure that the serial only prints once the state
void setup() {
// sets the pins as outputs:
pinMode(motorPin1, OUTPUT);
pinMode(motorPin2, OUTPUT);
pinMode(enablePin, OUTPUT);
// sets enablePin high so that motor can turn on:
digitalWrite(enablePin, HIGH);
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
void loop() {
//if some date is sent, reads it and saves in state
if(Serial.available() > 0){
state = Serial.read();
flag=0;
}
// if the state is '0' the DC motor will turn off
if (state == '0') {
digitalWrite(motorPin1, LOW); // set pin 2 on L293D low
digitalWrite(motorPin2, LOW); // set pin 7 on L293D low
if(flag == 0){
Serial.println("Motor: off");
flag=1;
}
}
// if the state is '1' the motor will turn right
else if (state == '1') {
digitalWrite(motorPin1, LOW); // set pin 2 on L293D low
digitalWrite(motorPin2, HIGH); // set pin 7 on L293D high
if(flag == 0){
Serial.println("Motor: right");
flag=1;
}
}
// if the state is '2' the motor will turn left
else if (state == '2') {
digitalWrite(motorPin1, HIGH); // set pin 2 on L293D high
digitalWrite(motorPin2, LOW); // set pin 7 on L293D low
if(flag == 0){
Serial.println("Motor: left");
flag=1;
}
}
}
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).
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
Watch the video demonstration
Thanks for reading, you can contact me by leaving a comment. If you like this post probably you might like my next ones, so please support me by subscribing my blog and my Facebook Page.
Good stuff. Great Tutorial.
How can I make my robot, be controlled through bluetooth?
Here’s my robot, youtube.com/watch?v=LrypabTSKuc
I want just 5 commands right, left , forward, back and stop
Yes you can do that by using two L293D ICs…you just need to change the code a bit… And it will work just fine 🙂 i will make a full tutorial about that soon… Im just waiting for a few parts that will arrive in one or two weeks… So make sure you subscribed to receive the updates about my robot. By the way nice robot you have! I’ve subscribed to you
Just Subscribed!
Yes, I’m using 2 SNY motor drivers equivalent to the l293D… The only thing I’m having trouble is choosing an affordable bluetooth Module, and writing the android App(never did before) but I guess I will download yours when you do the new one?
Also, I’m trying to find a way to make my ping sensor ping wirelessly so I wont need wires like my video shows.
Hi sir, I am doing a project in which i want to turn on and off a 9v waterpump using mit app inventor. I am able to turn on the pump but i cant off it.Can u tell some fix’s for it
Hi.
How are you controlling the pump?
Regards,
Sara
mit app inventor and I solved that problem and can u tell how to add an external power source for the motor i have a 9 volt one
Thank you
Hi.
You can connect the external power source (+) to pin 8 of the L293D IC.
Connect the external power source (-) to one of the GND pins, for example pin 4.
Search for the LD293D IC pinout before making any connections.
Regards,
Sara
This is probably the most affordable bluetooth module out there Hc-05 the one Im using. you can buy one for 8$ on ebay. You can use my code but you need to add a new motor to the code and define the forward and reverse button . I will post the robot in 1/2weeks Im waiting for one IC and some others parts i need. You just need to change my code a bit. For the android you will need the blueterm app or any app similar to do that , so you can connect your arduino to the bluetooth module.. I can write the code for you… Its pretty quick
I just purchased the Hc-05 on ebay, takes 10 days delivery. I have all the code written for both of my motors already, all I need to do is some simple tweeks, I can do that pretty simply.
But I never used the Blueterm app before(I have an iphone, but can get an android), I was wondering instead of sending “0” “1” “2”, there would be actual buttons (Arrows) for the directions.
Nice 🙂 btw usually the HC-05 requires a pass and its ‘1234’.
you can use an iphone you just need to find a similar app…
If you’re familiar with the Arduino IDE, what the blueterm app actually does it connects your smartphone to your arduino via Bluetooth, and it does a serial communication between the devices. So you don’t need to type anything in the serial monitor with your computer, but instead you type on your smartphone
there are some apps with the 4 buttons that do the exact same job but I’ve never used any… but usually someone made that app just for one particular robot, the easy way is to use an app as blueterm.
http://www.dougwoods.co.uk/curation/idevices-controlling-robots-in-the-classroom/
there are some examples in that website, lot’s of those apps work with an accelerometer which I thinks its really good
My idea for my robot is to control a robot with 2 DC motors through bluetooth with my ipad (with the 4 buttons)
But as I said before it will require some time as I don’t have the parts yet and I need to learn more about the control with the 4 buttons ….
Me too i have an Ipad, I will also look into it. That even sounds like a better idea, thanks for all your help, I will be checking back constantly for updates!
and when I get my bluetooth, and get it working with my robot, ill check back for help, if i need any, and I will let u know how it goes!
Thank you
No problem 🙂 i have your email and i soon as i have this done I’ll send you an email , i wont forget 🙂
Just last question.
from the android bluetooth perspective.
how do you:
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
Do you do it on the android phone in the app or how?
The commands are set in the arduino code… In the arduino code its where you define the keys that will trigger the movement you want. If you read my code. In the if statements its where i define which keys i want to be pressed and read. You can define whatever key you want (numbers… Letters) the android app just sends the key.
Hi, I’m Thomson
i have a project to make a robot. maybe like huss project.
but i use arduino leonardo. i use dual motor controller. but i wanna it run on my iPad. i don’t know how to make it work on my ipad. i need your help. and how to make ipad app to control the robot.
may you give me best solution.
which the best one, Arduino leonardo or arduino uno?
thanks for your article it’s very useful for me
send me by email.
Hi Thomson!
You can use the Arduino uno or the Arduino Leonardo they both are capable to do that project, you can read this post for more information and see the advantages between the 2 boards
http://www.doctormonk.com/2012/10/arduino-leonardo-vs-arduino-uno.html
But in conclusion for that project it doesn’t make much difference they’ll both work just fine 🙂
I didn’t made the app I’m running on my smartphone… And I don’t know much about iOS programming, I was thinking in making one but actually I’ll only be able to do that If I’ve buy a Mac or something otherwise would be really hard to create one app. with just my ipad… or with my linux computer with a virtual machine…
I didn’t found any similar app for my iphone/ipad that’s why I used my android…
Actually I don’t know any free app that does the same as Blueterm..
Hi Rui !
Great project. I am new to the Arduino community and I am getting started on a personnal porject in whitch I would like to control a :
– a small speaker that display a sound
– a small fan
via bluetooth.
I would like that device to be as small as possible and powerd by a battery.
Witch hardware Arduino would you advise me ta base it on ?
Thanks so much for your answers !
Vlad
Hi Vladimir! Thanks for your support, I’m really glad you enjoyed it!
You can buy any Arduino to control the fan and the speaker, I would recommend you to buy the Arduino Uno or the Arduino Duemilanove. You can buy an original or a clone, It’s easy to find on ebay.
I don’t know what you want to do when you said control a small speaker, I don’t know what’s your project about.
But with the Bluetooth module, a smartphone and an Arduino You can control the fan and the speaker for sure!
And the Arduino Can run with a 9V battery !
If you have more questions just let me know or just talk about your project!
🙂
Thanks for those elements. It helps a lot.
The idea it to have the sound go thru the running fan to study how disformed it souds like while the beat frequence is modified and the fan speed is as well. (listen to music thru a fan, you’ll understand what I am talking about).
On the hardware configuration, I have been looking further, and there is still a challenge :
1. The bluetooth needs to be able to transfer data and music which will be stored on the smartphone that commands it
2. I need to make sure that the arduino is “smart” enough to understand a music signal AND data signals that controls teh fan speed. And it has to transfer the music part to the autoamplified speaker.
So, still not sure what hardware configuation to use (especially, which bluetooth receiver between the large choice), but if you have any ideas, tey are more than welcomed 😉 !!!
Thanks !
To be honest I don’t know exactly how you can do that, but If I understood the real goal of your project, I must tell you that probably the Arduino It’s not the best platform to do that.
You can’t send music like a mp3 file or something to your Arduino trough bluetooth, I don’t know if there’s any shield that allows that… but with the Arduino itself you can’t.
The most similar project I can think about It’s to create the song you want to analyse in the Arduino IDE using the Tone function and control the PC fan with that sound (Basically the voltage could be connected to a buzzer/speaker and you could hear the tones of the music, or simply connected to a Fan controlled by the voltage )
I don’t think I’ve helped you much, I’m sorry…
Well, thanks, that’s a lot allready !
Onde posso comprar o modulo bluetooth?
Eu comprei no ebay por cerca de 8 dolares.. já com portes incluidos e tudo.
Por isso aconselho a comprar lá, porque fica mesmo barato
I got to the last step but when I enter the values (0,1,2) nothing happens. All I see is a number on my phone. On the video the commands show up as “Motor:right” for 1. All I get is 1 on my phone.
try to insert the numbers in the serial monitor with your computer, if nothing happens probably it’s a problem with your IC, motor or wiring…
Hey that worked but I cannot control the motor with my phone. When I use the serial monitor I am able to control the motor and the inputs (the number 0,1,2) appear on the screen of my phone. It seems like the circuit is connected correctly and the bluetooth module is working as well, but when I try to control the motor with my phone nothing happens, I just get a number as I told you before.
Thanks
thats really weird… if it’s working with your computer should be working with your android, i don’t know what can be done then…
but it says something like this: ‘connected to linvor’?
No it says:
“connected:HC-05”
I don’t know what can be wrong because it seems that everything is correct… and a lot of people actually tried this and worked…
and if it works with the arduino serial monitor the circuit is correct. it can be a problem with the bluetooth module I guess
the last thing that it can be a mistake (the TX from the bluetooth module goes into the RX from your arduino and the RX from the bluetooth goes into the TX from the arduino).
This is the bluetooth module that I’m using:
http://www.ebay.com/itm/HC-05-Bluetooth-Transceiver-Host-Slave-Master-Module-Wireless-Serial-6pin-/221158958927?pt=LH_DefaultDomain_0&hash=item337e19e74f
Actually I’m not sure if you can use that bluetooth module or you need to change my code/wiring a bit, I’ve never used that bluetooth module and I don’t have much time to search how it works… Sorry
Hey man I got it to work. I actually had to connect rx to rx and tx to tx.
Thanks dude!
I’m glad you got it working 🙂
I hope you enjoy my other projects!
Can we do programming Arduino over Bluetoooth??
Yeah I think you can at least I think It’s possible, but probably will never be very good for debugging a new program for example
can you please provide schematic of ur circuit??
What is your “compiler” for codes?
what you mean by that?
I’m using the Arduino IDE… to write, test and upload the program
Hi rui ganesh here i m doin mtechmrj named model based design of parellel park asssist system using simulink but now i m planned do hardware implementaion i want to use remote control car i hav to control both speed and steeering of motor i hav finished with simulink if you dont mind suggest me which arduino board i hav to use for my project since i heard that board support simulink please do suggest or email me please
I think arduino uno and arduino mega 2560 are both capable to use simulink,
but i’m not completely sure I’ve never did anything with simulink and the arduino together.
if you read this post it might help you:
http://www.mathworks.com/academia/arduino-software/arduino-simulink.html
Hi Rui,
Im having trouble uploading the code to Arduino, when i verify it, i get an error message saying: expected constructor, destructor or type conversion before ‘void’. and its highlighting the ‘int state;’ line of coding which is the problem. Many thanks for you help.
did you copy exactly all the code(all the “{ }”)? which Operative system you’re working on? you’re arduino IDE is updated? which arduino board you’re uploading too?
I’m just asking that because it’s really weird because a lot of people already tried this project and it worked…
where i can find the code for arduino..? i cannot find it on your website..please help..
Hi thanks for commenting.
you can download all my code for free just click the (facebook/tweet/google+) one of thoses buttons and the code will unlock
It would be nnice if you show wich AT commands you used to configure the BT module.
I’m sorry but I didn’t used any AT commands, my Bluetooth module was running by default!
My bluetooth Module HC-05 Receives Data from Arduino , and Forward it to PC/Mobile , but does not Transmit Data from PC/Mobile to Arduino ? Any Advice?
what do you want to do exactly? can you try to explain a bit better your project?
Thanks in advance your material is so helpful 🙂
Thanks, I’m glad you found them useful! make sure you subscribe to any of my news sources like youtube or websites newsletter so you can be notified when I release new projects!
Hi..Mr.Rui,
just I want to know about how can I get the bluetooth application that you use it in the video for controlling on the Android mobile?
Thanks
Hi,
you can find the app , in the google play store for free!
just search: BlueTerm
Hi!
Hey man i’ve got a problem with the bt module….the thing is if i write on the monitor serial, the led turns on (i modified your original code for just a led…you know, i’m trying to keep it simple just to test it) but the thing is, when i try to use my android phone (running the blueterm app and after connecting to the module (it says: conected: linvor) the led just won’t work :/ any ideas?
Firstable sorry for the late delay replyng to your comment, I’ve missed it, just found it today.
Please check the wire from your bluetooth module, the most common mistake is this:
bluetooth module: TX pin -> RX pin from the arduino
bluetooth module: RX pin -> TX pin from the arduino
Then I also recommend to open your Arduino IDE and your serial monitor and send the commands for example “0” and “1”. Whataver you defined and see if the circuit is working. If it working then try via bluetooth
Good Luck!
Rui Santos
I’ve seen other versions where people use resistors to drop the voltage coming from the arduino. This isn’t necessary? I don’t want to ruin my HC-05. Thanks!
If you’re using a power supply you can use one resistor.
but if you’re using the USB to power your arduino, don’t worry .
the HC-05 can handles 3.6V to 6V
Thanks for commenting!
Hi Rui Santos, thank you for your sharing how to do arduino project here firstly. I had tried to use of your arduino uno codes in virtual simulation of Proteus for controlling 2 DC motor using L293D and Atmega328p. However, the simulation program prompted me error message and I don’t understand why the error occurred since I had sorted out all possible problems before. Could I send you the proteus simulation file for your reference and then can you point out how I can slove the simulation problem please? I would like to complete the simulation firstly before launching the hardware circuit development processes. Many thanks.
Hi Peter.
Thanks for trying my projects!
I’ve never used Proteus… my circuit is working with the Arduino IDE.
I’m sorry I don’t have the time to do that.
This next weeks I’ll be on exams and finishing some projects.
Good luck with that,
and I’m sorry not being much helpful.
Rui Santos
Hai Rui,
i have a problem with this arduino. My dc motor can run if i connect with my laptop (usb) but with 9v battery cannot run. Blueterm not response if i enter numbers with 9v battery, but with usb, the blueterm is completely response and my dc motor run (left, right, off). Why?
Hi, thanks for trying my projects..
The problem is simple.
The 9V battery don’t have enough current for your circuit, you will need another type of battery that can handle more current.
The bluetooth module and DC motors takes to much current from the 9V battery
Can you email me the code for running two motors using bluetooth?
That project that you’re looking for was already done, but with a different app.
Please take a look at my project here: https://randomnerdtutorials.com/arduino-control-2-dc-motors-via-bluetooth/
TNX
IF U HAVE MADE ANY MOR ROBOTICS PROJECTS PLEASE LET ME KNOW.
Right now. I’m not planning in create any project related to robotics.
I’m working towards home automation projects!
Greetings from Greece!
I make arduino projects as a hobby for my own. I found interesting the BT communication. Is there any recommended tutorial about makind android apps with BT, developing using Eclipse?
Thank you.
Hi George.
I don’t know any tutorial for that at the moment.
I also never made any Android apps using Eclipse.
Sorry, maybe on youtube you can find what you’re looking for.
Thanks for stopping by,
Rui
Hii rui…
first upon I m a diploma student …so I don’t have too much knowledge about electronics so I wanted to ask u that is the project compatible with atmega 328 chip…and which Bluetooth. Module should I use
Hi Sank,
yes this project is compatible with the atmega328 chip.
That’s the one I’m using in my Arduino UNO board.
The bluetooth module is describer in the part list. you can use the HC-05 or HC-06 bluetooth modules
Thanks for asking,
Rui
hi rui
can’i use Module Bluetooth 2.0 for this project -Arduino – Control DC Motor via Bluetooth
I think so, which smartphone are you using? and bluetooth module?
i use SAMSUN GALAXY S2 and bluetooth module 2.0
That should work just fine.
Can you give me more details of what’s the problem it’s happening?
that this project is powered by an external power supply or through USB cable
This project was powered with USB for demonstration purpose
But you can add a battery for example
HI,
WHAT IS THE OPERATING VOLTAGE IF HC-05 BECAUSE IN SOME WEBSITES IT SAW THAT THE OPERATING VOLTAGE IS 3.3V.AT THE BACK OF MY BLUETOOTH MODULE JYU-MCU IS NOT PRINTED
the operating voltage is from 3.3V to 6V but make sure you read the datasheet of your bluetooth module.
Thanks for asking and please don’t use caps lock next time.
Have a nice day,
Rui
will Hc 06 work in place of hc 05? Thanks in anticipation
yeah it will work just fine Najam!
thanks for asking,
Rui
hi Rui Santos,
i’m new to Arduino..
just want to ask you..
1) if I’m using HC-06 bluetooth, do i need to change any code from the arduino?
2) what is the voltage required to make the dc motor works?
1) It will work with any bluetooth module that works with serial communication, so the HC-06 works just fine
2) It depends on your DC motors those DC motor work great with 3.3V or 5V.
Hi rui…could you provide the presentation report or project report on this project …which can include project’s application,construction ,working,cost…etc…
you may also provide a ppt also…
please do my work it is very essential…we have to submit a project report just in 7 dayd…
please rui…
please rui…
please rui…
Sorry sank,
I can’t make the project for you…
I’m already working on my own stuff.
Good luck with your project,
Rui
Kkk.thanx rui
you’re welcome!
hi rui, one quick question.
can u control the speed of the motor’s rotation. if can, how?
i’m just wondering if it can be made into a mini fan or something.
thanks.
yes you can definitely control the fan speed.
you can use a digital pin from the Arduino and control the speed with PWM.
Here’s a great tutorial for that:
http://arduino-for-beginners.blogspot.pt/2011/04/controlling-12v-fan-speed-with-pwm.html
Why I am new to Arduino. Why we need to remove TX and RX of BT module while Uploading code. What will happen if we don’t do tat.
Hi Deepak,
you need to remove the TX and RX because when you’re uploading a new code the arduino needs to receive the data from your computer.
and if you have something connected to those pins the arduino can receive the information from your computer.
I hope this helps.
Rui
Hi Rui,
I am new to Arduino world and I am doing a project very similar with this one. But it says ‘programmer is not responding’ when I tried to upload the code. Do you know how to fix this?
Hi Xuyi,
Do you have the bluetooth device connected to the arduino during the uploading process?
You need to disconnect the bluetooth (TX and RX cables) while you’re uploading
hi Rui Santos.. im now doing for a project.we want to control the speed of the motor by using bluetooth apps.any suggestion from you?type of motor we need to use? Dc motor or fan from laptop cooler?can you help me to show the coding if you can.thank you
Hi Zul,
you can use the same setup of my project.
The L293D works fine for controlling the speed.
Then you can change the arduino code so it increases the speed of the Dc motor…
Hi Rui
This project was great! I saw a video in youtube about controlling d speed of d motor using android application. I searched a lot for d code or way to do it bt could not find it. Can u hwlp me out in any way of how to do it???
Plz reply asap.
Thanks in advance! 🙂
Hi, please can you give me the code of your project.
Thank you
Thanks Alaa!
you can download the app by clicking “Like” or “tweet”.
Or go to this page: https://randomnerdtutorials.com/
thanks again!
great work rui…im very much impressed by ur projects..guidelines ,videos u provide r really awesome…keep rocking buddy.
Thanks so much for your feedback rahul!
Have a nice day,
Rui
Hi Rui,
Im working on a project and i was wondering what bluetooth module i would use with an 11.1V lipo battery powering my Mega2560 board
Thanks.
Hi Kallum,
how many current does that lipo battery provides?
That’s usually the problem, not enough current to power up the bluetooth module.
But that’s easy just choose any bluetooth module that works with serial communication and works at a lower current than your lipo battery
The lipo is 2.2A, so what bluetooth module would you suggest I use?
1.3A, my mistake
Hi Rui very cool project u got there but i was wondering if instead of a motor can we use a LED
Hi Nihit,
Yes you can control an LED.
Basically after you establish a serial communication between your bluetooth module and android device, Send some characters that the arduino will receive and with a if statement, simply control an LED with a digitalWrite().
Hello,
Can you provide me simple source code how to connect android to micro-controller and to send a simple data like a byte.
Thank you.
Hi Ziad,
This project already does exactly that…
thank you rui but i have a problem
i couldn’t find an HC-05 bluetooth module
near my place but i have got an HC-06 module.
Will it work??
Hi Nihit,
Don’t worry the HC-05/HC-06 are exactly the same… 🙂
So it should work just fine!
Thanks for asking
Hello Rui Santos,
Your project is certainly fantastic. But I have question for you, how to control DC motor without any commands, just detect the bluetooth device and automatically the dc motor will turn ON.
Hope to get your positive feedback ASAP! Thank you in advance:)
You need to change the android app.
In the block where it shows that the android is connected to the bluetooth module simply send a byte that the arduino will receive and turn on the DC motor
Hey Rui! These are some great tutorials. Do you know how I can send a command and have it run the motor for about 5 seconds and then stop? I’ve been trying out ways with no luck. Any help will be appreciated!
Hi Sam,
simply make a delay of 5 seconds – for example delay(5000); – inside the if statements. and then turn off the DC motor
I hope this helps
Hey! Someone in my Facebook group shared this site with us so I came to take a
look. I’m definitely loving the information. I’m book-marking and will be tweeting this
to my followers! Excellent blog and superb style and design.
Hey!
That’s great.
Thank you for your feedback!
Hey Rui, can i know what if i wanted to do angle controlling dc motor? Like i press a button then the motor will rotate to a certain angle and stops. Btw can i where you do your simulations ?
Hi Eden,
I don’t like to use any software to simulate. And I don’t think there’s a good solution out there yet.
The Arduino can control the angle of the dc motor, but you’ll need a shaft encoder that will allow the Arduino to know what position the motor shaft is in. If you use an encoder it will indicate the current position that gives pulses to let the Arduino know that the shaft has turned one step and in which direction.
I hope this helps,
Rui
good day sir . .is it possible for a 12v DC motor ?????….
What is the header file do i need to write at the starting of the arduino source code.
You don’t need to write anything else.
All the code you need is already done for you
Thanks Rui. One more question. Will this code work for Atmega328 alone by changing the pin numbers. I mean by programming the ATmega328 with Arduino Uno.
Hey rui, can you help me pls, i follow your schematics but my bluetooth module didn’t blink or can’t connect to my android.
Hi Vorg,
Sorry for taking so long to answer. I have been working for long hours for the past weeks…
Have you re-checked all the troubleshooting tips?
Are you connecting the wires properly?
Upload again the arduino code and before you attach the bluetooth module,
open the arduino IDE serial monitor and send the commands (0, 1, etc)
to see if the motor is moving properly..
i tried mine but, it didn’t 🙁
Have you re-checked all the wiring? and follow the troubleshooting tips?
Hi sir Rui Santos, I was trying to make one like yours and we copy the flow on your schematic but me and my girl tried to tested it and upload the codes to arduino without connecting the TX and RX, but the bluetooth didn’t detect or connected, we try it several’s and reset the device but it did not work :(.
Hi sir Rui Santos, I was trying to make one like yours and we copy the flow on your schematic but me and my girl tried to tested it and upload the codes to arduino without connecting the TX and RX, but the bluetooth didn’t detect or connected, we try it several’s and reset the device but it did not work :(.
bye the way im using arduino uno rev3, Bluetooth Module HC-06 (Slave) and L293D IC.
Hi,
Very nice project. I’m new to Arduino.
I’d like to use Bluetooth with a serial as you used, Plus a serial for debugging to the built-in monitor. Can you show me how to add such a serial for monitoring ?
thanks in advance
Shlomo
Hi Shlomo,
If you’re using an Arduino UNO you can’t establish two serial communications at once.
With an Arduino Mega2560 for example you’ll have four hardware UARTs,
I hope this helps,
Rui
Hello Rui Santos,
I have built the similar project and I was wondering to add the feature of controlling the speed of the dc motor as well rather than just the direction or the 1/0 input.
How can we control the speed of the motor with serial input so that we have a good range of rpm. And, I tried it with the potentiometer by varying input voltage to the dc motor, it works fine. But then I want to control it via my bluetooth app with a slider function. Suggest something.
Thanks! 🙂
Hi Akhil,
You can do that easily. Instead of sending a 0 or a 1.
You make a slider in MIT app builder that sends a value from 0 to 255 the arduino receives that value via bluetooth (serial) and it controls your motor with PWM.
I hope this helps,
Rui
okay, thanks! But I’m also using a couple of 230V AC bulbs via two 6v relays and the relays are already drawing enough current out of my arduino. Can the motor and the bulbs be in running mode at the same given the current condition…?
Thanks!
what extra coding lines i have to include in this source code if i want to control the motor’s speed in addition to direction using android app?
hi
what kind of arduino borad is used here???
give specfication pls??
I’m using an Arduino UNO.
I want to change design of android application. why?
What do you mean?
Thiѕ is my first time visit at your website. Thank you for sharing this information.
You’re welcome,
Rui
Hi, i want to know what is your arduino board connecting to? And why can’t i find the signal of my arduino board by blueterm?
Hey Rui I just recently made this but I’m having trouble connecting my phone to the HC-05. I did not have the RX and TX cables in whenever I uploaded the code but when I scan for the module on my phone I can’t find it what should I do?
But is your module powered on?
I have the exact same problem, I’m pretty sure my module is turned on, do you know of any other reason as to why Blueterm cannot detect it?
Where can I download the android app?
You can download the Android app in this blog post.
Download the .zip folder and extract it. IT contains a .apk file (that’s the Android app) simply copy that file to your Android phone and install it.
I hope this helps!
i want to control of a big motor by this method ..how ??!
You might need to use an external power supply (more powerful batteries) and control the motor with a mosfet.
Thanks for asking,
Rui
Sir please help me because according to schematic s it is not working
Be careful with the TX and RX connections
TX -> RX
RX <- TX
can you please share circuit diagram of this project???
I don’t have these files anymore…
Thanks.
Rui
Where the connectios of H-bridge module please send me links
Hi.
You can find how to wire the motors to the L293D on the schematics section in this post.
If you can’t see the image, try this link: https://i2.wp.com/randomnerdtutorials.com/wp-content/uploads/2013/02/schematics.png
I hope this helps 🙂
Great tutorial! Truly love it! Can you give me some heading on how to add another DC motor to it?? Thank you!!
Hi Mathias.
Take a look at the following tutorial with 2 DC motors:
https://randomnerdtutorials.com/arduino-control-2-dc-motors-via-bluetooth/
Regards,
Sara
Thank you very much!! 🙂
Hi, I would like to know how I can apply this in an electric garage door motor. And if there is a way to stop it without crashing
Hi.
I don’t think this is the most appropriate tutorial to build a garage door opener.
Regards,
Sara
I have project almost same as the above one, additionally I’ll be using 9V battery to power. I wanted to ask how should make the right connections and is it possible that I work this out with RemoteXY so that I can have dedicated interface and buttons to make it more user friendly in place of Blueterm. Please guide.
Thank you.
Hi.
Unfortunately, we don’t have any guide about RemoteXY.
You can read the introduction of this tutorial: https://randomnerdtutorials.com/esp32-dc-motor-l298n-motor-driver-control-speed-direction/ to learn how to wire the motors using the L298N motor driver and 9V power source.
Hi, I just wanted to know what should i do if i want to turn off the motor even though i have already given it a command?
Hi there, whenever I do the motor off command through the bluetooth it prints properly, but when I input 1 or 2, it only prints M or Mot, and nothing happens to the motor itself, what should I do?