An Android-Bluetooth SDK for controlling a DFROBOT Pirate 4WD Robot
This project was inspired by the Decepticon-SDK developed by Timothy Yong and Jonathon Risinger from Rutgers University -- an SDK for controlling the Pirate Robot through a Raspberry Pi using Serial
- The DFROBOT Pirate 4WD Robot
- An Arduino Uno with an Arduino USB cable
- Any Bluetooth Module for the Arduino( I used this)
- A breadboard, jumper wires, a 9V battery with a battery cap, and a portable cell phone battery like this
- A Dual H-Bridge Motor Driver for DC or Steppers - 600mA - L293D
- An HC-SR04 UltraSonic Module
- And obviously, an Android phone with a micro-usb cable
- Android
- Android Studio
- Arduino IDE
- Assemble the Pirate Robot - use the manual and this video but do NOT mount the Arduino yet and do NOT put the very top platform on. Also, you don't NEED to solder the wires, you can just use elctrical tape, but soldering reduces the most noise
- After you're done assembling the robot pull all the wires (except for the battery pack wires) through the openings of the top of the robot
- Now grab your breadboard and place the H-Bridge chip on it. Using this diagram, connect Vcc2 to the positive wire of the 9V battery (after placing the batterycap on the 9V battery) and connect the rest of the three corners to POWER (red) strip of the breadboard. Connect the "Heat Sink and Ground" to GROUND (blue). Now, on your robot, tape or solder the negative wire of the top left motor to the positive wire of the bottm left motor. Do the same for the right motors. Now assume that each side is one big motor and put the top free wire on the left side in 1Y and the bottom into 2Y. Do the same for the right side, but into 3Y and 4Y instead. Now connect pins 9 and 10 of the Arduino to 2A and 1A, respectively. Connect pins 5 and 6 to 3A and 4A, respectively. Finally, connect the Arduino 5V pin to the POWER strip of the breadboard and one of the GND pins to the GROUND strip. Connect the BLACK wire of the 9V pattery to the GROUND strip as well.
- Now, place the Bluetooth Module on the breadboard and connect VCC to the breadboard's POWER strip and GND to the breadboard's GROUND strip. Connect RX to the Arduino's TX pin and TX to the Arduino's RX pin.
- Now, place the UltraSonic module on the breadboard and again, connect VCC to POWER and GND to GROUND. Connect Trig to the Arduino's pin 12 and Echo to pin 11
- Go to the Amarino downloads website and a) Download the Amarino app (here is a good link on how to download APK's) and b) download the MeetAndroid Arduino library and on your Arduino IDE go to Sketch>Import Library>Add Library> and add the MeetAndroid library
- Download the source code from this repository, open
RobotControl.ino
from thearduino
folder, connect your Arduino to your computer, and upload the program onto the Arduino - Open Android Studio, go to File>Import Project> and choose the folder containing the source code from this repository
- Make sure that your Arduino is connected to your computer or another power source and that the light on the Bluetooth module is blinking
- Open up the bluetooth settings on your Android phone and pair it with your bluetooth module, it will most likely say HC-06 if you're using the one I did and the password is usually 0000 or 1234
- Open up the Amarino app and note the address (which will look something like XX:XX:XX:XX:XX:XX). The, use it for
DEVICE_ADDRESS
inMainActivity.java
andManualOverride.java
in Android Studio - If you want to make your robot move autonomously, simply use the Decepticon object's methods and fill in the code of the
automate
method inMainActivity.java
- Install the RobotControl app on your Android phone by connecting your phone to your computer with the micro-usb cable and clicking "Run" on Android Studio
- Go back to the Amarino app and click "Connect" next to your bluetooth modules name. The light on your bluetooth module should now have stopped blinking and should just be constant.
- Go back to the RobotControl app and click "Start" if you filled the
automate
method out or click "Manual Override" to use your phone like a remote control. - Unplug the USB end of the Arduino cable from the laptop and plug it into the portable cell phone battery so your robot can freely move around
- Enjoy!!!
If you have any questions or issues, email me at [email protected] or message me on Facebook!
- Add Camera support
- Add Claw support
- Upload a video demonstration?