Bluetooth Controlled Servo motor project | Arduino servo motor project

Introduction

Hey guys, we are back with another new project on Arduino. In this article, we are going to make a Bluetooth-controlled servo motor project using the HC05 Bluetooth module and Arduino UNO.

HTML Image as link
Qries

For controlling the position of the servo motor remotely using Bluetooth we use the MIT app inventor to make a wireless remote. In our app, we can set the position of the shaft of the servo using a slider and also with three buttons (0, 90, and 180).

Just make the proper connections and then upload the given code. You can read more articles on IoT and basic electronics published by us. For your convenience, we are also sharing screenshots of the work.

Serv motor project

Description

  • Do you know how the HC 05 module works with Arduino, if not then go through with our article on it?
  • Search for the MIT app inventor and login into it.
  • Then make your own GUI and virtual connections using different widgets in Arduino servo motor project.
bluetooth controlled servo
  • You can see that there are many options like buttons, sliders, etc.
  • When you successfully develop the design then generate the QR code.
bluetooth controlled servo
  • Download the MIT inventor android application and scan the QR code.
bluetooth controlled servo
  • Turn on the Bluetooth of your mobile phone so that it can connect with the Arduino.
  • Then you can give commands i.e. set the position of the servo motor from 0 to 180 using your mobile phone.
bluetooth controlled servo

Servo Motor project Components

  • Arduino UNO
  • HC 05 Bluetooth module
  • Servo motor
  • Jumper wires and a breadboard
  • USB cable for uploading the code
Servo motor project component

Circuit Diagram of Servo motor project

bluetooth control servo motor circuit diagram

Bluetooth Controlled Arduino Servo project Connection

Arduino UNOServo Motor
GPIO 14D0 Pin
+5 VoltVCC
GNDGND
Arduino UNOHC-05 Bluetooth
11 PinRX Pin
10 PinTX Pin
( +5V ) VCCVCC
GND ( Ground )GND ( Ground )
  • Take a servo motor and connect its positive power supply wire with the 5 volts pin of the Arduino and the negative supply wire with the GND pin of the Arduino.
  • Connect the signal wire of the servo motor with the digital-9 pin of the Arduino.
  • Then take the Bluetooth module (HC 05) and join its VCC pin with the 5 volts pin of the Arduino and GND pin with the GND pin of the Arduino.
  • Attach the Tx pin of the Bluetooth module with the digital-10 pin of the Arduino.
  • Connect the Rx pin of the Bluetooth module with the digital-11 pin of the Arduino.
  • You can use a breadboard for making common connections.
  • We have also made a home automation project using Bluetooth and Arduino.
  • Now upload the code and test your circuit.
hc-05 bluetooth

Bluetooth control Arduino servo motor code

NOTE: Please upload this code to the Arduino IDE but first you need to install <SoftwareSerial.h> library to the IDE software. Check here how to add a zip library to the Arduino IDE. if you don’t know how to upload the code you can refer it from our website.

//Techatronic.com
#include <SoftwareSerial.h> // TX RX software library for bluetooth

#include <Servo.h> // servo library 
Servo myservo; // servo name

int bluetoothTx = 10; // bluetooth tx to 10 pin
int bluetoothRx = 11; // bluetooth rx to 11 pin

SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);

void setup()
{
  myservo.attach(9); // attach servo signal wire to pin 9
  //Setup usb serial connection to computer
  Serial.begin(9600);

  //Setup Bluetooth serial connection to android
  bluetooth.begin(9600);
}

void loop()
{
  //Read from bluetooth and write to usb serial
  if(bluetooth.available()> 0 ) // receive number from bluetooth
  {
    int servopos = bluetooth.read(); // save the received number to servopos
    Serial.println(servopos); // serial print servopos current number received from bluetooth
    myservo.write(servopos); // roate the servo the angle received from the android app
  }


}
Servo motor project

We hope that you liked this project and now try to make it on your own. If you have any doubts regarding this post then feel free to ask them in the comments section which is given below. Also, do check out more projects on Arduino and Raspberry Pi made by us.
Thanks for reading.

Leave a Comment