DFRobotShop Rover Tutorial – Control With Android App / Bluetooth - LEKULE

Breaking

12 Jan 2016

DFRobotShop Rover Tutorial – Control With Android App / Bluetooth



DFRobotShop Rover - Title 3_25
DFRobotShop Rover v2 (Bluetooth Kit) [RB-Rbo-41]
The DFRobotShop Rover products have been out for a while and we have received many questions since then on both our support center and on our forum. One common question we get is how to control the rover using a smart phone / tablet?. This tutorial will cover a simple Android-based solution to make this happen for you and your rover!

Requirements

  • DFRobotShop Rover v2
  • DFRobot Serial Bluetooth Module
  • Android platform (Phone or Tablet) running Android version 2.3.3 and up
  • Arduino IDE
Please note there is also a DFRobotShop Rover v2 Bluetooth Kit with the Bluetooth module and a LiPo battery included, which is perfect for this application.

Programming the Rover

You can download the code for the Rover v2 here. Extract the files to a folder and go into the folder named “tank_wasd_keyboard_control“. From there, open the .ino file. If you have the Arduino IDE installed, it should automatically open the file. Make sure your rover is connected via USB to the computer and that you have the proper Arduino Uno drivers installed. Go to the Tools menu in the Arduino IDE and ensure you have the right board (Arduino Uno) and the right COM port selected.
Make sure to remove the DFRobot Serial Bluetooth Module before uploading code to the rover. Click the Upload button and wait for the process to finish. Once the upload is complete, you can optionally use the Serial Monitor (from the Tools menu or using the top-right corner icon Serial Monitor Icon) to test the rover. Make sure to select a baud rate of 9600. Send ‘W‘, ‘S‘, ‘A‘, ‘D‘ to move the rover forward, backwards, turn left and turn right. Send any other key to make the rover stop moving.
Once you are done uploading / testing the rover, simply disconnect the USB cable and replace the DFRobot Serial Bluetooth Module on its socket.

Bluetooth Pairing

Android Bluetooth Settings
From your Android device home screen, open Settings. Go to the Bluetooth category. Make sure the rover has the Bluetooth module on and that the Rover is powered. Also make sure the Android device’s Bluetooth interface is ON. If the device does not show up in the list press “Search for devices” and wait for it to show up. It should be named “Bluetooth_Bee_V2“. Select this device to start the pairing process.
blue-02-s
Bluetooth Pairing
To pair the device, you will need to enter the PIN 1234. Once this is done the module will pair to your Android device. It should now show up in the list under the heading “Paired devices“, as seen below.
blue-03-s
Module Paired

Obtaining the App

You can obtain the free app here. Note that this app is not affiliated with RobotShop. If you are unable to use this link, please follow these steps to obtain the app:
app-1-s
Google Play – Apps
First, open the Google Play app. From there, go to the “Apps” category.
app-2-s
Google Play – Arduino Bluetooth Controller
Then, search for “Arduino Bluetooth Controller“. Press on the app showed above.
app-3-s
App Installation
Install the app by pressing the “Install” button
app-4-s
Opening the App
Finally, once the app is installed press “Open” to start the Arduino Bluetooth Controller. Before opening the app, make sure the rover is still powered with the Bluetooth module attached and that the pairing was completed successfully.

Using the App

use-1-s
Bluetooth Permission Request
When the app starts, it may request that the Bluetooth to be turned on (if it was previously off). Activate Bluetooth to make sure we can connect to the rover.
use-2-s
UUID
Next, the app will ask you if you wish to change the UUID. There is no need to change it, so simply press “Proceed” to continue.
use-3-s
Bluetooth Paired Devices
Select the paired device called “Bluetooth_Bee_V2“. If it is not visible, ensure the rover is powered and the Bluetooth module is attached and press “Scan for devices“. If the device still doesn’t show up, go back to the Bluetooth Pairing step.
use-4-s
Controller Mode
Once at the mains screen, select “Controller Mode“. The view below is what is visible on a larger tablet screen. When viewed on a smart phone, the buttons will be closer together.
use-5-s
Set Commands
From the controller screen, select options at the top right and choose “Set Commands“.
use-6-s
Commands
Press each button name and enter the command of your choice. The default commands in the “tank_wasd_keyboard_control” example are ‘W‘, ‘S‘, ‘A‘, ‘D‘ as mentioned previously. Here we chose ‘X‘ as the “stop” command. When done setting the commands, press the back arrow to return to the controller screen.

You can now press the buttons on the screen to control your rover remotely through Bluetooth! Enjoy!

No comments: