Bluetooth Gives Birth to Innovation

Everyone is familiar with Bluetooth and some of you deal with it on a daily basis. Briefly, Bluetooth is a wireless standard for exchanging data over short distances. It was invented back in 1994 by a telecom vendor Ericsson and has found its way in our headsets and players, keyboards and mice, gamepads, and finally, our phones. But what is actually so great about Bluetooth and how can we use it to develop cool stuff?

IMG_7640 (Large)

Certain Advantages of Bluetooth

  • Low energy consumption (especially Bluetooth Smart 4.0 & 4.1)
  • Universality. It doesn’t matter what type of device is being used for establishing connection.
  • Stability. Almost all the hitches caused by other wireless devices get eliminated by switching to another frequency.

Obvious Disadvantages of Bluetooth

  • Above mentioned universality is relative. The sad truth is, not all adapters support a full list of profiles even though Bluetooth is pretty affordable.
  • A bit rate is rather low and ranges from 1 Mbit/s on the version 1.0 to 24 Mbit/s on 4.0 / 3.0. This is okay for small volumes, though.
  • A short range of action (no more than one meter for class three, 10 meters for class two, and up to 100 meters for class one). The range of action indicated in the specifications is quite exaggerated, and depends a lot on whether there is an obstacle between pairing devices.

But BlueJacking specialists solved this problem!


BlueSniper is a hacker rifle which is capable of extending Bluetooth radios to 1,78 km using directional antennas and signal amplifiers. Unfortunately, this great solution is a dangerous thing for us, ordinary users. Don’t forget to disable your Bluetooth module when you are done with it. Otherwise, you can make it visible through wireless network, and therefore, open for an attack.

Bluetooth Use Cases

Bluetooth module can be used in a great variety of apps.

In fact, we have already covered some examples of startups that work on Bluetooth. Among them there is PowerUp — a paper plane with a flying device powered by Bluetooth, a digital kitchen scale Pre Pad from the Orange Chef, and a multi-card device called Coin.

What else?


  • Gloves that have a magic ability to interact with a touch screen and at the same time keep your fingers warm.
  • Bracelets that track your heart rate and sleeping phases. A great combination of a bracelet and an alarm clock can adjust to your sleeping cycles (they know it better than you do) and suggest the best time for you to wake up.
  • Sneakers that track your activity as you walk, run and even sit.
  • Medical sensors, which is a breakthrough for medicine as they can get into your organs instead of tweezers.
  • Smart house modules — a must for a new age apartment, which cares about security of home and your personal convenience wherever you are.

Read also: iPhone app design cost

Combination of Bluetooth & Android

using bluetooth in android app development

Long before Android appeared, Bluetooth had widely been used in other phones, allowing their users to listen to music, share content, play games, chat, and so on. Before Android 2.3. version got launched, Bluetooth support for Android was far from being perfect and couldn’t meet the expectations of owners of popular in those times J2ME and Symbian telephones.

Old Android versions didn’t allow, for example, to use Bluetooth module as a modem, neither did they allow to transfer files (only a small number of Android devices could support OBEX FTP protocol).

The current versions of Android OS support Bluetooth API which offers a broad range of functions which can be used to develop apps of different kinds and purposes. Bluetooth APIs can:

  • find other Bluetooth devices within a line of sight
  • implement pairing between devices
  • set up RECCOM channels
  • connect with other devices through service discovery
  • transfer data between devices
  • manage multiple connections

You can check Android documentation for more information on this subject.

Bluetooth version 4.0 called Bluetooth Smart includes 3 protocols: Classic Bluetooth, Bluetooth High Speed (based on Wi-Fi) and Bluetooth Low Energy. Bluetooth low energy used to exist under the name Wibree. It consumes less energy than the previous versions and developers claim that devices with such chips are able to run for years on a single battery.

Android 4.3 (API Level 18) has a built-in platform support for Bluetooth Low Energy and provides APIs that apps can use to discover devices, query for services, and read/write characteristics.

 Use of buetooth


How to put Bluetooth into Action

I had a development board MSP430 from Texas Instruments with two microcontrollers in the kit which was sitting somewhere at home.

What did I want to do with it? To tell the truth, at first I wanted to create a huge humanoid combat robot, but then I thought it would be too expensive for me.

My next idea was to connect the board to temperature and humidity sensors to monitor climate in my pets’ terrarium. (I have an awesome scorpio!) However, I decided to limit myself to standard flashing LEDs which can be used for the same purpose.

Out of a sudden, I came up with an idea to construct something that can move, no matter if it’s a car, or a plane, or a hexapod. It was supposed to be remotely controlled a combination of Android -> Bluetooth -> MSP430 development board.

Here is what you need to assemble a hand-made car:

  • MSP430 LaunchPad
  • Bluetooth Module HC-07
  • 4 Relay Module
  • 2 wheel chassis
  • an Android device

How I thought a hand-made car would be constructed

I don’t really want to go into details of the painful designing process, so I will just point out the main steps I took to make it possible for a car to move by itself.

  • Take MSP430 development board and a microcontroller.
  • Hook it up to an old Bluetooth USB stick.
  • Buy chassis fitted with engines.
  • Write software for the microcontroller.
  • ?????
  • Profit!

As the process went on I had to adjust myself to the requirements of a hand-made car that weren’t visible at the beginning. For instance, at some point I figured that an old Bluetooth USB stick wasn’t a perfect solution. I had to buy a new Bluetooth module to make the thing work.

Read also:cost of Android app development

How you can actually assemble a car


  • Take MSP430 development board
  • Hook up a new Bluetooth module
  • Attach chassis with engines
  • Connect engine controller to the whole thing. Engine controller is responsible for the power supply and controlling engines.
  • Consider wiring
  • Write code for the microcontroller
  • Solder all the components together

 car with bluetooth adapter

I didn’t manage to find an engine controller, and employed 4 Relay Module to get the job done, instead.

Of course, an engine controller is more convenient compared to a relay. The problem I faced applying a relay was a lack of power supply since a relay consumes a lot of power. I didn’t have enough time to do anything else so I used two phones — one as a remote control and the other as a battery supply for a device.

And here is some code of the Connection Thread:

package com.voltazor.bluetooth_test;

import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothSocket;
import android.util.Log;


* Created by Dmitriy Dovbnya on 25.01.14.
public class ConnectionThread implements Runnable {
    private static final String TAG = ConnectionThread.class.getSimpleName();

    private BluetoothSocket mSocket;

    private InputStream inStream;
    private OutputStream outStream;

    private boolean canceled = false;

    private volatile int curCommand = 0;

    public ConnectionThread(BluetoothDevice device) {
        try {
            // MY_UUID is the app's UUID string, also used by the server code
            mSocket = device.createRfcommSocketToServiceRecord(Const.MY_UUID);
        } catch (IOException e) {
            Log.e(TAG, "createRfcommSocketToServiceRecord", e);

    public void run() {
        // Cancel discovery because it will slow down the connection

        try {
            // Connect the device through the socket. This will block
            // until it succeeds or throws an exception
        } catch (IOException e) {
            Log.e(TAG, "connect failed", e);
            // Unable to connect; close the socket and get out

        // Get the input and output streams, using temp objects because
        // member streams are final
        try {
            inStream = mSocket.getInputStream();
            outStream = mSocket.getOutputStream();
        } catch (IOException e) {
            Log.e(TAG, "IO streams init failed", e);

        while (!canceled) {

            try {
            } catch (InterruptedException e) {
                Log.e(TAG, "sleep failed", e);


    public void applyCommand(COMMAND command) {
        curCommand = command.value;
        if (mSocket.isConnected()) {
            Log.d(TAG, "Command apply: " + + " (" + curCommand + ")");

    private void write(int msg) {
        try {
        } catch (IOException e) {
            Log.e(TAG, "writing to out stream failed", e);

    private void read() {
        byte[] buffer = new byte[128];
        // Keep listening to the InputStream while connected
        try {
            // Read from the InputStream
            if (inStream.available() > 0) {
                int bytes =;
                if (bytes > 0) {
                    Log.d(TAG, "Response: " + new String(buffer, 0, bytes));
            // Send the obtained bytes to the UI Activity
// mHandler.obtainMessage(MESSAGE_READ, bytes, -1, buffer).sendToTarget();
        } catch (IOException e) {
            Log.e(TAG, "reading from input stream failed", e);

    public void disconnect() {
        try {
            if (outStream != null) {
            if (inStream != null) {
            canceled = true;
        } catch (IOException e) {
            Log.e(TAG, "close socket", e);

    public enum COMMAND {

        PAUSE(0b0000_0000), FORWARD(0b0000_0011), LEFT(0b0000_1100), RIGHT(0b0011_0000), BACKWARD(0b1100_0000);

        public final int value;

        COMMAND(int value) {
            this.value = value;



All the rest you can find on my Github.

3.5/ 5.0
Article rating
Remember those Facebook reactions? Well, we aren't Facebook but we love reactions too. They can give us valuable insights on how to improve what we're doing. Would you tell us how you feel about this article?

We use cookies to personalize our service and to improve your experience on the website and its subdomains. We also use this information for analytics.

More info