Controlling
Servo Motor with SmartPhone:
Components
Required:
·
HC-05 or HC-06 Bluetooth Module
·
Arduino Nano or UNO
·
Solderless Breadboard
·
Micro Servo motor
·
Jumper Wires
Working:
·
Bluetooth Module (in my case it is HC-06)
is responsible for receiving instruction and send them to a servo.
·
Arduino Nano or UNO is the mainboard onto
which both components will be connected and we have to upload the code in it
using the Arduino IDE application.
· The breadboard will help us to make temporary connections.
This is optional as if you can solder wires on the Bluetooth module and the Arduino.
·
Micro Servo motor (in my case, it is 9g
micro servo) but you can use any servo which can operate under 5v. It is the
component that will receive instructions.
·
Jumper wires will be used for the connection.
But any type of thin wire can be used.
Connections:
The circuit diagram is as follows:
Code:
#include<SoftwareSerial.h>
#include <Servo.h>
Servo myservo;
SoftwareSerial mySerial(2, 3); // RX, TX
int Position ;
void setup()
{
myservo.attach(11);
mySerial.begin(9600);
Serial.begin(9600);
}
void loop()
{
if(mySerial.available()>0)
{
Position =
mySerial.read();
Position =
map(Position, 0, 180, 180, 0);
myservo.write(Position);
}
}
Application:
There are various applications on the play store. You can find a suitable one. If you are having a problem, contact me at :
rizwanmahad606@gmail.com
Uses:
This system is widely used for controlling robotic arms which use multiple servos.
Note:
This application works well for this. If you want to use another application, you may have to make some changes to the code. If you enjoyed this project, Don't forget to comment.
No comments:
Post a Comment