Bluetooth Controlled Servo

This project shows how to control a servo motor with a smartphone via Bluetooth.

Dec 1, 2018

103059 views

46 respects

Components and supplies

1

Jumper wires (generic)

1

SG90 Micro-servo motor

1

Breadboard (generic)

1

Arduino UNO

1

HC-05 Bluetooth Module

Apps and platforms

1

Arduino IDE

Project description

Code

Bluetooth controlled servo

c_cpp

this code id to uploaded on to the Arduino uno.

Bluetooth controlled servo

c_cpp

this code id to uploaded on to the Arduino uno.

Downloadable files

Circuit

This is how the circuit has to be made.

Circuit

Comments

Only logged in users can leave comments

mattia11_2008

a year ago

Hi, when i try to send an angle to the servo, the servo don’t move, in fact when i see the serial monitor the values that recive is wrong. For example if i send 1 arduino recive 49 and the servo don’t move, can anyone help me?

isimsiz300

2 years ago

Do you know what program should i use for controlling it? Dont have an android and iphones dont support hc05s, so i have to use pc

utr

2 years ago

i can't Download the app.

Anonymous user

2 years ago

Dear Sir: thank you for your precise and logical explanation of how to incorporate Bluetooth into the use of servo control. I need help because i am a novice (lol), and i am the only one in charge in designing an endzone cam system for my local soccer team. The pan and tilt system will need two moderate torque servos,(5.5v like hitec or futabas) and i would rather control the servos by Bluetooth on the same Android tablet that will control the nikon camera by Bluetooth also. That way I won't need a bulky radio transmitter for the servos. I would love any ideas and input on what parts to buy to make the servos work. Its my last obstacle before i can complete this gift to the soccer team. I would be happy to pay you for your consultation. Thank you so much.

JANAK13

2 years ago

Hey sorry for late response. I was bussy with my placement and stuff. I hope you built the system you needed. If not then you can do this: 1. If you want to controll the servo with the Nikon app, you first need you get the values the app sends to the camera for different actions. 2. Try connecting the app to the HC05 and then write the values recieved on the console. Then give command for various actions from the app. In this way you will get values corresponding to the action. 3. Now to simply need to map these values to desired action for your project. I.e. servo moments. As far as I understood your need, i think this will do the job.

jreilly

2 years ago

I am new to teaching and using arduino. I like the project you shared and hope to use with my students next semester. With projects like this on Arduino's "project hub" is there a way to download the document/instructions? I was printing to study at home but it doesn't format very well with all the web info intermixed... Thanks for any help and suggestions.

JANAK13

2 years ago

@56Triker Were you able to get this working? I would happy to know about the same and if you have any suggestions on what should I build next please let me know. Thanx!

JANAK13

2 years ago

If you are new to Arduino then don't directly jump on to these projects. First, try uploading and understanding the basic code and its wiring. It will be very helpful to get things clear. Once you are done with this then write your own code. I learned in this way and trust me it's not complicated as it looks.

JANAK13

2 years ago

You can ask questions over here anytime. It may take a while but I will respond ;)

JANAK13

2 years ago

You can download the code and schematics from the project directly. If you want to teach this to your students then I recommend you to create your own explanation of the same as that would be the best to get interactive with your students else ctrl+c and ctrl+v will work fine :p If you got any doubt regarding the project or any other topic just leave a comment. I would try my level best to help. Best of luck!!

56Triker

2 years ago

Not yet, am dumber than a rock, plus you were finishing you schooling so left you alone. I have a few projects that I cannot wire up. Tons of arduino's and raspberry pies no knowledge. Will lay the greenhouse one out if you want, maybe get it to work.

56Triker

2 years ago

I downloaded as a PDF file, the web addresses don't work. the rest is just edit until you get what you want! Good luck!

Anonymous user

2 years ago

Software Serial should not be used on the USART pins. With Software Serial you should use other pins.

JANAK13

2 years ago

Hey! I made the changes in the code. Thank you for pointing out. Hope now it works fine!

56Triker

2 years ago

So new I don't know the difference, would like to get this up and running to operate two 110VAC switch behind a model train layout. Thank You.

BTS_is_Lifeu

2 years ago

Will it still work if I use Bluetooth 4.0 instead?

Anonymous user

2 years ago

Can this same code be uploaded on Arduino uno r3 ??

Anonymous user

2 years ago

What are the keywords(c code) to control Servo Motor by voice commands using Bluetooth.

PanPMS

2 years ago

Can this program work with the Hm-10 Blu module? Thanks

Anonymous user

2 years ago

Looks like download link is not working

jt_enliten

2 years ago

Line 17: int pos=bluetooth.read(); // store the data in pos variable the read() function reads in char type of variables. If you assign pos to be int, you will get ASCII code for the number you send to arduino via BT. Here's what I suggest: int pos = (bluetooth.readString()).toInt(); // store the data in pos variable Cheers, Jay Tan

jt_enliten

2 years ago

The HC06 RX pin is 3.3V logic while arduino digital pins are 5V logic. Did you use a voltage divider for the HC06 RX pin? How did you get away with that?

Anonymous user

2 years ago

You could also download this app to help you to control any stuff using a bluetooth module easily, called Blue's Tooth https://play.google.com/store/apps/details?id=com.mrbluestooth

Anonymous user

2 years ago

hello, I'm looking for a sketch that I can start the engine and turn it off through the voice... in the figure you see one, but what would be the phrase that allows you to turn the engine on and off?

56Triker

2 years ago

Got this hooked up as instructed, newbie so not sure what to find on my samsung phone. please advise, anyone who knows more than me! Merry Christmas!

JANAK13

2 years ago

Connect tx of Bluetooth module to pin 10 of Arduino and rx of Bluetooth module to pin 11. I had mentioned this in the code. I'm little busy with my university exams but I will update it very soon. Sorry for the inconvenience!

56Triker

2 years ago

Thank You, am old and use visual aides a lot!! So the fritzing diagram is also incorrect? Please excuse my ignorance on this project. I just know you are the only programmer that has a solution for my application.

JANAK13

2 years ago

I made some changes in the code. Try this with the new code. I hope it will work. Best of luck and Merry Christmas to you too!!

Anonymous user

2 years ago

Would this work with the hc-06 bluetooth module?

JANAK13

2 years ago

Yes, it will work. The difference between HC05 and HC06 is that HC05 can be used in both master and slave mode whereas HC06 can be used only as a slave. In this project, we are using just 1 module so it won't matter if you use HC05 or HC06.

Anonymous user

2 years ago

Can you help me with the code to run three servos at a time with bluetooth using arduino.

Anonymous user

3 years ago

Looks like download link is not working

utr

3 years ago

i can't Download the app.

jt_enliten

3 years ago

Line 17: int pos=bluetooth.read(); // store the data in pos variable the read() function reads in char type of variables. If you assign pos to be int, you will get ASCII code for the number you send to arduino via BT. Here's what I suggest: int pos = (bluetooth.readString()).toInt(); // store the data in pos variable Cheers, Jay Tan

jt_enliten

3 years ago

The HC06 RX pin is 3.3V logic while arduino digital pins are 5V logic. Did you use a voltage divider for the HC06 RX pin? How did you get away with that?

Anonymous user

4 years ago

hello, I'm looking for a sketch that I can start the engine and turn it off through the voice... in the figure you see one, but what would be the phrase that allows you to turn the engine on and off?

Anonymous user

4 years ago

Can this same code be uploaded on Arduino uno r3 ??

Anonymous user

5 years ago

What are the keywords(c code) to control Servo Motor by voice commands using Bluetooth.

Anonymous user

5 years ago

Can you help me with the code to run three servos at a time with bluetooth using arduino.

BTS_is_Lifeu

5 years ago

Will it still work if I use Bluetooth 4.0 instead?

PanPMS

5 years ago

Can this program work with the Hm-10 Blu module? Thanks

Anonymous user

5 years ago

You could also download this app to help you to control any stuff using a bluetooth module easily, called Blue's Tooth https://play.google.com/store/apps/details?id=com.mrbluestooth

Anonymous user

5 years ago

What app did you use to control it?

JANAK13

2 years ago

It's a n app named Arduino BlueControl

Anonymous user

6 years ago

Dear Sir: thank you for your precise and logical explanation of how to incorporate Bluetooth into the use of servo control. I need help because i am a novice (lol), and i am the only one in charge in designing an endzone cam system for my local soccer team. The pan and tilt system will need two moderate torque servos,(5.5v like hitec or futabas) and i would rather control the servos by Bluetooth on the same Android tablet that will control the nikon camera by Bluetooth also. That way I won't need a bulky radio transmitter for the servos. I would love any ideas and input on what parts to buy to make the servos work. Its my last obstacle before i can complete this gift to the soccer team. I would be happy to pay you for your consultation. Thank you so much.

JANAK13

2 years ago

Hey sorry for late response. I was bussy with my placement and stuff. I hope you built the system you needed. If not then you can do this: 1. If you want to controll the servo with the Nikon app, you first need you get the values the app sends to the camera for different actions. 2. Try connecting the app to the HC05 and then write the values recieved on the console. Then give command for various actions from the app. In this way you will get values corresponding to the action. 3. Now to simply need to map these values to desired action for your project. I.e. servo moments. As far as I understood your need, i think this will do the job.

jreilly

6 years ago

I am new to teaching and using arduino. I like the project you shared and hope to use with my students next semester. With projects like this on Arduino's "project hub" is there a way to download the document/instructions? I was printing to study at home but it doesn't format very well with all the web info intermixed... Thanks for any help and suggestions.

56Triker

2 years ago

Not yet, am dumber than a rock, plus you were finishing you schooling so left you alone. I have a few projects that I cannot wire up. Tons of arduino's and raspberry pies no knowledge. Will lay the greenhouse one out if you want, maybe get it to work.

56Triker

2 years ago

I downloaded as a PDF file, the web addresses don't work. the rest is just edit until you get what you want! Good luck!

JANAK13

2 years ago

If you are new to Arduino then don't directly jump on to these projects. First, try uploading and understanding the basic code and its wiring. It will be very helpful to get things clear. Once you are done with this then write your own code. I learned in this way and trust me it's not complicated as it looks.

JANAK13

2 years ago

@56Triker Were you able to get this working? I would happy to know about the same and if you have any suggestions on what should I build next please let me know. Thanx!

JANAK13

2 years ago

You can ask questions over here anytime. It may take a while but I will respond ;)

JANAK13

2 years ago

You can download the code and schematics from the project directly. If you want to teach this to your students then I recommend you to create your own explanation of the same as that would be the best to get interactive with your students else ctrl+c and ctrl+v will work fine :p If you got any doubt regarding the project or any other topic just leave a comment. I would try my level best to help. Best of luck!!

56Triker

6 years ago

Got this hooked up as instructed, newbie so not sure what to find on my samsung phone. please advise, anyone who knows more than me! Merry Christmas!

JANAK13

2 years ago

Connect tx of Bluetooth module to pin 10 of Arduino and rx of Bluetooth module to pin 11. I had mentioned this in the code. I'm little busy with my university exams but I will update it very soon. Sorry for the inconvenience!

JANAK13

2 years ago

I made some changes in the code. Try this with the new code. I hope it will work. Best of luck and Merry Christmas to you too!!

56Triker

2 years ago

Thank You, am old and use visual aides a lot!! So the fritzing diagram is also incorrect? Please excuse my ignorance on this project. I just know you are the only programmer that has a solution for my application.

Anonymous user

6 years ago

Software Serial should not be used on the USART pins. With Software Serial you should use other pins.

56Triker

2 years ago

So new I don't know the difference, would like to get this up and running to operate two 110VAC switch behind a model train layout. Thank You.

JANAK13

2 years ago

Hey! I made the changes in the code. Thank you for pointing out. Hope now it works fine!

Anonymous user

6 years ago

Would this work with the hc-06 bluetooth module?

JANAK13

2 years ago

Yes, it will work. The difference between HC05 and HC06 is that HC05 can be used in both master and slave mode whereas HC06 can be used only as a slave. In this project, we are using just 1 module so it won't matter if you use HC05 or HC06.