Introduction: Android (remotexy) UI to Control Servo Motor Using Arduino and Bluetooth
In this Instructable i will give you quick step to make Android User Interface using Remotexy Interface Maker to control Servo Motor connected to Arduino Mega via Bluetooth.
This video show how the UI will controlling servo motor speed and position.
Step 1: How This System Working
This is how its working:
When we touch/use UI on Android, Android app will send signal to arduino via bluetooth connection, then processed signal will sent to (driver) servo. Encoder sensor will then send feedback signal to arduino, and the signal (position) will sent via bluetooth to displayed on Android UI.
Step 2: Get Servo Motor and Arduino Ready
Assuming that you already have a working Servo Motor connected to Arduino, i will skip this part because our focus is to create UI to controlling servo from Android.
In this project i am using Vexta brushless dc motor connected to a gear to moving an arm mechanism.
For Arduino i am using Arduino Mega.
Step 3: Make Sure Encoder Sensor Installed Properly
This is very important step, make sure your encoder sensor installed and can read value correctly.
Test it before continue to next step. This reading value will displayed on UI and become our reference for servo position.
The value will range from 0-1024 (analog), and since 1 fully rotation is 360 degrees, we need to do some math, and its different depend on encoder sensor and servo motor itself.
In my project, analog value from 100-900 represent 0-360 degree rotation.
Step 4: Install HC-05 Bluetooth Modul
Next is to install Bluetooth modul to Arduino Mega.
Use diagram above to reference only, since maybe your Arduino will have different layout and pin.
Step 5: Create UI With Remotexy
Open remotexy.com, create account, and start new project.
Select bluetooth as connection type, and start coding using examples from example pages.
You can start to drag and drop elements from Elements side menu, like slider, panel, button, etc.
In my project i am split the UI into left and right area. Left area will controlling lets say servo1, and right area will controlling servo2. Then in each area, i am using this Elements:
- TEXT STRING for displaying encoder sensor value (analog) in range 100 to 900.
- SLIDER (for speed) with TEXT STRING on top of it. I modified Text string so it will displaying the SPEED slider's value in range 0 to 100%.
- SLIDER (for position) with TEXT STRING on top of it. I also modified this Text string so it will displaying the POSITION slider's value 0 to 100%. AND i also add a "LINEAR DIVISION LEVEL" as an indicator and modified it so it will represent encoder sensor value in range 0 to 100%.
- Some LABEL for text labeling (of course...)
*this step will get updated next time with my source code, appologize for that.
UPDATE: i am sorry i cant share my source code for UI since its related to the National Research Company where i did the project. But i update the picture so you can see my actual UI when i designing it on remotexy editor.
Step 6: Upload Code to Arduino
Upload finished code, include lib, to Arduino Mega via USB, using Arduino IDE software.
Note that its necessary to disconnect bluetooth Tx and Rx wire to uploading code via USB.
There is other ways doing it without disconnect the wire, but this method works for me.
Step 7: Install Remotexy on Android, and Test It
Final step wiil be installing remotexy app from Google Play. You can find it by search "remotexy" on Google Play.
After that, open the app, search for your HC-05 Bluetooth, Pairing with it, and your user interface (that have been uploaded to Arduino) will shown up.
If everything setting correctly, you can start controlling servo motor from this user interface.
This video show testing the UI for controlling servo's speed and position.