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)
Bluetooth Controlled Servo Motor Using Arduino – A Smart ProjectServo motors are widely used in robotics, automation, and electronics projects due to their precision and controlled movement. In this project, we’ll explore how to control a servo motor wirelessly using Bluetooth and an Arduino board. This setup is perfect for beginners looking to learn about wireless communication, mobile control, and servo motor operation.
Project OverviewThe core idea of this project is to use a Bluetooth module (HC-05) to communicate between a smartphone and an Arduino UNO. The servo motor is connected to the Arduino and responds to commands sent from a smartphone app like Bluetooth Terminal or Arduino Bluetooth Controller. With this setup, you can rotate the servo to specific angles with simple keypresses or slider controls from your mobile device.
Components RequiredTo build this project, you’ll need:
Arduino UNO
- Arduino UNO
HC-05 Bluetooth module
- HC-05 Bluetooth module
Servo motor (SG90 or MG996R)
- Servo motor (SG90 or MG996R)
Jumper wires
- Jumper wires
Breadboard (optional)
- Breadboard (optional)
Power source (USB or battery pack)
- Power source (USB or battery pack)
Smartphone with a Bluetooth control app
- Smartphone with a Bluetooth control app
Here’s how to wire the components:
HC-05 Bluetooth Module
VCC → 5V on Arduino
- VCC → 5V on Arduino
GND → GND
- GND → GND
TX → RX (Pin 0)
- TX → RX (Pin 0)
RX → TX (Pin 1) (Use a voltage divider or 1K/2K resistors if needed to protect HC-05)
- RX → TX (Pin 1) (Use a voltage divider or 1K/2K resistors if needed to protect HC-05)
Servo Motor
Red wire → 5V
- Red wire → 5V
Brown/black wire → GND
- Brown/black wire → GND
Orange/yellow wire → Digital pin 9 (PWM pin)
- Orange/yellow wire → Digital pin 9 (PWM pin)
Make sure to disconnect the Bluetooth module before uploading code to avoid serial communication errors.
Working PrincipleThe Bluetooth module receives data from the mobile app and sends it to the Arduino via serial communication. The Arduino reads the incoming data and maps it to a particular angle or movement of the servo motor.
For example:
Sending "0" from the app sets the servo to 0°
- Sending "0" from the app sets the servo to 0°
Sending "90" rotates the servo to 90°
- Sending "90" rotates the servo to 90°
Sending "180" rotates it fully
- Sending "180" rotates it fully
You can customize the code to accept different commands or angles depending on your application.
Arduino Code SummaryThe Arduino code includes:
Initialization of the Servo library
- Initialization of the Servo library
Serial communication setup (Serial.begin(9600)
)
- Serial communication setup (
Serial.begin(9600)
)
Reading incoming Bluetooth data
- Reading incoming Bluetooth data
Moving the servo motor to the desired angle using servo.write()
- Moving the servo motor to the desired angle using
servo.write()
cpp
CopyEdit
if (Serial.available()) {
int angle = Serial.parseInt();
servo.write(angle);
}
cpp
CopyEdit
if (Serial.available()) {
int angle = Serial.parseInt();
servo.write(angle);
}
This snippet continuously checks if new data is available, converts it to an integer, and moves the servo accordingly.
ApplicationsThis project is a great foundation for more advanced automation and control systems, including:
Wireless robotic arms
- Wireless robotic arms
Home automation (e.g., opening locks or windows)
- Home automation (e.g., opening locks or windows)
Remote-controlled vehicles
- Remote-controlled vehicles
Educational demos and teaching tools
- Educational demos and teaching tools
Controlling a servo motor using Bluetooth and Arduino is a fun and practical way to understand wireless communication and motor control. This project is beginner-friendly, requires minimal hardware, and can be expanded easily into more complex systems. Whether you're creating a robotic arm or a smart home device, this basic setup offers a solid starting point.
Comments