Controlling Servo via Android Smartphone

INTRODUCTION:

In this project you are going to learn controlling a servo using the Android Smart Phone App from 0 to 180 degree precisely. Servo is known for precise angle rotation and is widely used in robotic applications. So, this tutorial is a great project to start with.

SOFTWARE REQUIRED

1. Arduino IDE

THEORY & FUNDAMENTAL

In the App, there is a slider controller that has a minimum value of “0” and maximum value of “180”. The Android App sends packet data to CT UNO through serial communication of Bluetooth. Please note that the data is in ASCII  string.

The slider is the servo controller. For example if the slider is at “90”, the servo pointer will be at angle 90 degree as well.

When the packet data is received, CT UNO converts the ASCII string into integer. Based on the integer, it generates pulse PWM or duty cycle to the servo.

In this tutorial the min pulse is 620 ms while the maximum is 2500 ms.

Servo working principle – credit to www.14core.com

PROCEDURES

1. Plug and connect all electronics as shown in the circuit diagram.

2. Take note the signal is at Pin 8, jumper Tx at D1 and jumper Rx is at D0.

3. Open up Arduino IDE and compile or upload the program to the CT UNO.

4. Set up the App in the Smartphone. (Watch the video)

Programming Part

The code, with the help of comment at each lines is pretty easy to be understood. If you don’t get the library “Servo.h” and “SoftwareSerial.h” in orange color, that’s mean you don’t have it. Go download and import it into Arduino IDE.

A few highlights of the code:
1. Calibrate the Duty Cycle range of your servo to get precise servo rotation.
2. Don’t change the Baudrate of 9600 because it is standard Baudrate for Bluetooth.
3. SoftwareSerial library allows you to transfer and receive data through serial communication.
4. Speed of servo is fixed. Use this library instead of “Servo.h” library if you want the speed varies
5. parseInt() returns the first valid (long) integer number from the serial buffer. Characters that are not integers (or the minus sign) are skipped. For Example, if you send data “90K”, it captures as “90” not as “9” “0” “K” or “90K”.

Android App Setting and Video Example

TROUBLESHOOTING

1. The password to pair the Bluetooth is 1234
2. Please power up the servo through different power source if the servo shows jittery performance

Welcome to our technical forum if you have further inquiry

Buy

, , , , , ,

Written by Dinbot

Related Post

How to Make your Line Following Robot Faster?

Control Mobile Robot through WiFi with ESP-WiFi Shield (Arduino + Andriod)

Raspberry Pi: Control DC Motor using MDDS10

Getting Started? Let’s Try EZMP3 Shield :D

One thought on “Controlling Servo via Android Smartphone

Leave a Reply

Your email address will not be published. Required fields are marked *