This project incorporates a simple 2WD robot, a bluetooth module (HC-05/06), and an Android phone to manually control the robots movement.

For this example, we are using a “Turtle Bot” with 2 motors, controlled by Arduino pins 6,7,8 and 9 (2 motors, 2 rotation directions each). The Rx and Tx pins for the bluetooth module are controlled by pins 0 and 1, respectively.

The motor driver we will be using is the L298 Dual H Bridge DC Motor Driver. First, connect the motors and voltage source to the L298.

A simple wiring diagram can be found below.

Connect pins IN1, IN2, IN3, and IN4 to arduino pins 8, 9, 6, and 7.

Note that ENA or ENB are not used in this example. These pins are the step input pins, and are used in combination with IN1/2/3/4 to control speed.

Next, connect the HC-05/06 Bluetooth module to the Arduino Board.

*****For more detailed info on how to interface the HC-05/06 module with Arduino, Click Here.*****

Copy and paste this into the Arduino IDE:

#include &lt;SoftwareSerial.h&gt;; SoftwareSerial bluetooth(0, 1); // RX, TX int BluetoothData; int Motor1CW = 8; int Motor1CCW = 9; int Motor2CW = 6; int Motor2CCW = 7; void setup() { bluetooth.begin(9600); pinMode(Motor1CW,OUTPUT); pinMode(Motor1CCW,OUTPUT); pinMode(Motor2CW,OUTPUT); pinMode(Motor2CCW,OUTPUT); } void loop() { if (bluetooth.available()) { BluetoothData=bluetooth.read(); if(BluetoothData=='8') { digitalWrite(Motor1CW,1); bluetooth.println(&quot;Motor 1 Forward&quot;); } if(BluetoothData=='9') { digitalWrite(Motor1CCW,1); bluetooth.println(&quot;Motor 1 Reverse&quot;); } if(BluetoothData=='6') { digitalWrite(Motor2CW,1); bluetooth.println(&quot;Motor 2 Forward&quot;); } if(BluetoothData=='7') { digitalWrite(Motor2CCW,1); bluetooth.println(&quot;Motor 2 Reverse&quot;); } if (BluetoothData=='0') { digitalWrite(Motor1CW,0); digitalWrite(Motor1CCW,0); digitalWrite(Motor2CW,0); digitalWrite(Motor2CCW,0); bluetooth.println(&quot;MOTORS OFF&quot;); } } delay(100); }

We are now ready to connect your Arduino to your Android!

To get started, download “Arduino Bluetooth Controller” on the Google Play store (free). To pair with the HC-05/06 module:

Open the app. Type in the passcode (either “1234” or “0000”) When paired, click on “Controller Mode”

You should now see this:

In the upper right corner, touch the menu button and input the following commands:

Hit the “back” button. Now you’ll be able to drive your pet crazy simply by touching the up, down, left, and right arrows on your Android! Hit triangle to stop all movement.

Feel free to leave any questions/comments below. More tutorials coming soon!

