Connecting an Android Phone to Arduino using Bluetooth

Services: 

Additional Software

Arduino IDEArduinoSerialBare.PDE, MyRobotLab.apk

Hardware: 
  • Smartphone running Android 2.3.3 or later
  • LED
  • 1K resistor
  • Arduino bluetooth board, or Arduino clone with bluetooth module

 
Description

This tutorial will demonstrate how to connect an Android device to an Arduino using bluetooth.

Steps

  1. Attach a bluetooth module to the Arduino Clone.  In this case I wll be using a Bare Bones Board.  Attach an LED with a 1K resistor to pin 10.
  2. Connect the Arduino via USB or FDTI cable to you computer.  Download and install the arduinoSerialBare.pde located here (arduinoSerialBare.pde)
  3. You will need to pair your smartphone with the bluetooth module.  Some modules require you enter a pin. On the HTC Inspire the menu to pair a device is:
    Settings -> Wireless & networks -> Bluetooth settings -> Scan for devices
     
  4. Download, install and start MyRobotLab.apk to your smartphone.


start MyRobotLab on smartphone


select the ArduinoBT service


press the add button


name the service arduino


click on the new arduino service


click on get port


select the desired already paired device.  Here is my DETTLEBOT !  remember to load the arduinoSerialBare.pde on the Arduino.


Now that MRL Android is now connected to the Arduino control and communication can begin.  If you hooked up an LED to pin 10, you should be able to click on the grey round button and the LED should turn on.  Tap it again, and the LED should turn off.  The pin mode buttons for the digital pins are initially set to "OUT" for output.  They can be toggled to "IN" for input and you can watch the digital lines blink depending on if the Arduinos digital pins are sensing 5 volts or ground.

The slider is for the PWM pins.  If you hooked your LED up to pin 10, and change the slider you should be able to see the LED grow dimmer or brighter depending on the location of the slider.

The analog pins can be toggled to poll.  This means if the red light is on the Arduino will stream the current analog values from the selected analog pin.

Trouble shooting

In the past I have had difficulty in connecting, even with identical smartphones.  The first thing I would look for is if the bluetooth module can pair with other devices.