A simple Android <-> Arduino Bluetooth project

This is a simple project that use a bluetooth channel in order to connect an Android application with an Arduino.
The aim of this sample is:

  • Learn how Bluetooth serial channel works
  • Learn how to configure a bluetooth device on Android
  • Send a string from Arduino to Android (in this example the value of light sensor)
  • Send a byte from Android to Arduino (in this example the LED ON-OFF status)

The Arduino schema is very simple



I’ve used an HC-06 bluetooth adapter, the cheapest (and slower) available on ebay. You can find the source code of the android application and Arduino Sketch file on my GITHUB repositories.

Now I’m ready to add bluetooth feature on my “HomeTemp” project.


Bluetooth HC-06 + Arduino + RX1 and TX1

Yes…I’m alive.
It’s about 1 year that I didn’t post something on this wonderful blog but I’ve been quite busy.

But some days ago I bought a bluetooth module (HC-06, the cheapest module for Arduino) in order to integrate wireless capability in my HomeTemp project, and I want to share a simple thing about its configuration:

DO NOT WIRE THE MODULE TO RX1 (pin 0) AND TX1 (pin 1).

I tried the easiest way to connect the module to an Arduino UNO board, using the standard RX1 and TX1 pin, but the behavior was a little confusing:

  • The module sends correctly data via bluetooth
  • The module does not receive any data via bluetooth

I didn’t understand why…maybe a “conflict” with the standard Serial USB communication. But after some experiments  I found a post somewhere that suggests to use the “SoftwareSerial” Arduino Library and use two others PIN (10 and 11). With this simple configuration the following example works like a charm 🙂 Not all pins support change interrupts, check the SoftwareSerial page and check which pins should work.

Pair the device with your PC (the default pairing PIN is 1234) and then open a serial console (on Mac OSX I use “screen /dev/tty.XXXYYZZZ). You are now able to read and send data.

I hope it could be helpful to someone.

#include <SoftwareSerial.h>
#define LED_PIN 12

SoftwareSerial bluetoothSerial(10, 11);

void setup() {
  pinMode(LED_PIN, OUTPUT);  


  bluetoothSerial.println("I'm ready");
  digitalWrite(LED_PIN, LOW);
  digitalWrite(LED_PIN, HIGH);
  digitalWrite(LED_PIN, LOW);
  digitalWrite(LED_PIN, HIGH);
  digitalWrite(LED_PIN, LOW);
  Serial.print("Ready to go");  


void loop() {

  if (bluetoothSerial.available() > 0) {
    char inChar = bluetoothSerial.read();
    if (inChar == '1') {
        digitalWrite(LED_PIN, HIGH);
    else if (inChar == '0'){
        digitalWrite(LED_PIN, LOW);