Introduction: Arduino Bluetooth Servo Motor Control for Pet Feeding and More
I used this in a school project as a wireless small pet feeder i did this by filling a bottel with food for my guinea pigs. Under it i placed a modified servo that held it in the bottel. With only a touch of the button the servo moved and the food came down in the bowl for my pets to eat. With a second touch and it all came back in place.
In this project i will show you how i control my arduino servo motor wireless with the Bluetooth on my phone.
Besides Arduino equipment you will need an Android device with a Bluetooth connection and the HC-06 Bluetooth module.
First we will go through the requirements.
We will cover how to connect the HC-06 with the Arduino.
Then it is only the matter of feeding the code and the AT command mode to the HC-06 module.
And as the final step, we will learn how to use our phone to control and program the Arduino to move the servo motor with our touchscreen.
Step 1: Meeting the Requirements
If you remember, you need to have 1x Android phone with Bluetooth connection. For the Arduino you will be needing the following;
1x Arduino UNO-
The Bluetooth module will work with most Arduino models, but in this project we will focus on the Arduino UNO.
This is a Bluetooth module that is fairly easy to use on the Arduino.
1x Micro Servo Motor-
What model is not really a issue, you can use one similair suiting to your tastes.
7x Jumper wires
Size doesn't matter only how you use it.
Step 2: Connecting the Bluetooth Module With the Arduino and the Servo Motor
Now we connect the Arduino UNO, the servo and the HC-06 Bluetooth module with jumper wires.
You can also follow the image above
-Take the HC-06 module and connect it's VCC pin to the 3.3V of the Arduino,
-The GND of the HC-06 will be connected to the GND of the Arduino.
-The TX of the HC-06 goes to pin 10 on the Arduino.
-And the RX pin of the HC-06 will be next to that one on the pin 11 of the Arduino.
Then we will take the servo motor with it's 3 wires and connect it to the Arduino UNO.
-The Orange wire connects with pin 9 (next to the others of the HC-06)
-The Red wire connects with the 5 V output
-Brown wire connects with any of the GND pin
Step 3: AT Command for the Bluetooth Module and Code to Control the Servo Motor
It is possible that you are using a new Bluetooth module, so it is recommended to change some of the settings of the Bluetooth module by using AT commands.
We will change the name, the pin and the baud rate. Above in the left picture are the AT commands I used.
Run it in the IDE, the arduino program.
First connect the to pin 10 RX and pin 11 TX.
Set the pin right.
Then change the name.
Then set the baudrate to 9600 or the AT+BAUD4 setting which will set it to 9600.
When you are done with the AT commands you can go to the picture on the right where you can find the code to control the servo motor, you can modify it however you want to suit your satisfaction.
However it won't be doing anything when you run it.
We need to finish the last step with the Android smartphone before that will work.
Step 4: The Android Phone
With the Android phone we are going to use an Android device.That will let Bluetooth control our servo motor wirelessly. There are a lot of different possibile choices for this. I use the Arduino Bluetooth Controller , it is free and easy to use.
Instal the application on the device,
Enter the Pin number set. Which,if you haven't changed it ,is almost always;1234.
Now make the connection with the Bluetooth module.
Select Controller mode.
Now we can choose out of 10 different buttons. But we will only be needing 2 for our Servo motor, because it only needs to move left and right.These buttons need to send a value that will be received by the Bluetooth module and used in the Arduino program to control the servo motor. So one button will send "1" and the other will send the value "2".
You can do this in the menu right above.
In the right page of the last step back you can find the values of 1 and 2 controlling the movement of the servo motor going left and right.
Now if everything is properly connected, uploaded and pluged in. Then the servo should now be able to be yours to control.
This could be, with a bit of ingenuity and imagination a posible way for multiple projects. Like robot arms or remote controled catapults powered by the servo.
I hope you enjoyed the project.
We have a be nice policy.
Please be positive and constructive.