Arduino Bluetooth Wireless Communication

This post is part I of a III part series of posts related to Arduino and Raspberry PI Wireless Bluetooth communications.

For a project I’m working on, I was searching for a method of sharing information between the Arduino and a Raspberry PI and Bluetooth came to mind. So, I start exploring.

Here’s a small example of a Wireless connection between Arduino and an Android Phone using Bluetooth.

Hardware

1x Arduino (I’m using UNO but any other will work)

1x Android phone with BlueTerm app installed

1x HC-05 or HC-06 bluetooth sensor

HCs
HC-06 and HC-05

Connections

arduino Bluetooth

The connections are straight forward. Bare in mind that, we need to switch the RX and TX. It doesn’t matter which is which in the Arduino PINs, as long as we switch them in the code.

HC-05 or HC-06 Arduino PIN
VCC VCC 5v
GND GND
RX 6 (will be the TX in the code)
TX 5 ( will be the RX in the code)
The connections
The connections

Code

To program a bluetooth sensor with the Arduino is nothing more than use a serial connection where we send and receive commands. The bluetooth sensor will take care of sending and receiving the data, forwarding it to the serial connection.

Upload the code to the Arduino.

After uploading/connecting the Arduino, the LED on the Bluetooth Module will be blinking fast. After pairing with the phone, the LED will blink slowly.

On the Android phone, please install the BlueTerm application. This application will allow serial communication using the Bluetooth.

Now, turn on the bluetooth and pair with the module. Either is the HC-05 or HC-06 modules, the code will be 1234.

Open the application and connect to the paired device.

Once paired, start sending 0s or 1s to see the LED turning on or off.

Bluetooth-1
BlueTerm window – not connected
Connecting to the module
Connecting to the module – HC-06 appears as BT UART
Bluetooth-3
After connecting
Sending commands
Sending commands
ArduinoLED13
The LED will turn on or off according to the commands given by the phone

More information

Arduino Playground

Instructable by Mohannad Rawashdeh

9 Replies to “Arduino Bluetooth Wireless Communication

  1. what do i have to do to pass the blue screen on blueterm? i tried to keep it close to HC-05/arduino, but nothing happens! – do i need to type something? pl help.

    1. Hi Sunil V !

      Have you paired the device with your mobile phone ? Enable local echo (in blueterm) and start typing 0’s and/or 1’s

    1. Hi Tolis.

      Don’t now what you’re trying to do or what is the problem you’re having, but using the above code and sketch, you can send and receive commands.

      1. Thanks for your reply. So you are saying that I can use the sketch to send commands to the arduino the are not simple “1” or “0” but can be more complex as “MOT10” ?

        1. Yes, you can use the sketch, but you must code that part yourself.

          Where it reads :

          if (btdata == ‘1’)

          you must put there your own strings – but remember, you must perform string comparison – I kept it simple and just compare it with ‘1’.
          btdata is the variable that holds whatever comes through the serial port…

          Read about serial communication in Arduino

          Best regards

Leave a Reply to tolisn Cancel reply

Your email address will not be published. Required fields are marked *