[Arduino] Bluetooth Controller

Communicate with an Arduino using the Bluetooth adapter on your Android device.

Alex M. Smith
4 min readAug 10, 2017

You’ll need:

Arduino Hookup

Four wires — that’s it.

5V to VCC, GND to GND, TX(1) to RXD, RX(0) to TXD

Wire 1 (Power): Connect the VCC pin to the Arduino’s 5V (or 3.3V) pin.

Wire 2 (Ground): Connect GND on the module to a GND pin on the Arduino.

Wire 3 (Transmit): Connect the TXD pin on the module to the RX (pin 0) on the Arduino.

Wire 4 (Receive): Connect the RXD pin on the module to the TX (pin 1) on the Arduino.

Note: The TX and RX pins are the transmit and receive pins, respectively. The TX (transmit) pin on the HC-06 should be connected to the RX (receive) pin on the Arduino, not TX to TX or RX to RX.

Now, connect your Arduino to your laptop with a USB cable. The red indicator on the HC-06 module should begin to blink.

The App

  1. Go to the Play Store on your Android device.
  2. Search “arduino bluetooth” and install the first app.
The very first result from “Giumig Apps”

3. Open the app.

Find your device, open it in controller mode.

4. If your HC-06 module doesn’t immediately appear in the “Connect to a device” section, check the available devices section. Click on your HC-06 module.

If prompted for a password, use “1234.” This is the standard password.

5. Connect in controller mode. When you attempt to use the controller, it may give you some flak about having not “configured” your controller yet. Follow the prompt or click the icon in the upper corner to configure.

6. Custom “commands.” I went with 1–7 for the first 7 buttons, and ‘s’, ‘t’, ‘x’, and ‘c’ for the square, triangle, X, and circle buttons respectively. You’ll see why in the code section.

The Code

It’s a tiny bit of code available here.

Check for input

The TX and RX pins on the Arduino are serial pins. We will use Serial.read() to acquire inputs from the Android application.

When the Arduino reads from the Serial, it will now receive a single character (char) such as ‘1’, ‘2’, ‘3’, ‘s’, ‘t’, etc. depending on how you calibrated your controller.

(The //commented sections are not read by the compiler when uploading to your Arduino)

In your Arduino IDE, Upload your sketch, and open up the Tools > Serial Monitor. Using the cell app, tap a few of the buttons to test the connection.

Controller
Testing out the connection

What’s Next?

The next steps are highly dependent on your project. Making a quadruped? The ‘1’ command may correspond to a function that moves your robot forward. The ‘9’ command may make your robot jump. Insert your custom code inside of the switch cases (read the code //comments for ideas).

Our project: 120+ lb Mars rover.

Our team, Yonder Dynamics, uses this module as an auxiliary method of rover control. If we need to move the rover between workstations or across campus, we can connect to it with our phones within seconds. It is very handy.

Cheers,

Alex M. Smith

--

--