Connect the Bluetooth HC-06 Module to the Arduino #tt20

Tinkerer: Lory Livezey

Bluetooth seems to be in everything these days. Phones, cars, mice, coffee pots.. the hidden security camera in my yard light even has bluetooth. Learning to use this bluetooth module with your Arduino will not only give you insight into how it works, but will also give you some really cool possibilities for your own IoT project!


You'll learn how to:

  • Create a button that populates a label in App Inventor
  • What User Interface Design is and why it's important
  • How to add a new section to the block menu
  • How to connect and program the Kitronic Motor board

Previous Step

  Intro to Arduino UNO with an SOS Blink #tt19

This tutorial assumes that you know the basics of the Arduino Software. If you need a refresher, click the link above.

Starter Breakpoint

A breakpoint in programming is a place in the code where you set the program to stop so you can figure out what's wrong with it. We use the term breakpoint to refer to the code that you can load to start you off at a certain point in our tutorials.

Step 1 - Hook Up Bluetooth HC-06 Module

Connect your Arduino to the bluetooth module but only connect the power and ground for now. If you connect transmit and receive you won't be able to upload your sketch.

Connect Power and Ground

Step 2 - Write Arduino Sketch

Open your Arduino software, and create a new Sketch. You can start with the "starter" above, or copy/paste the code below.

We're going to set a variable to hold the value coming from the client, and the onboard LED pin, which is 13.

int val;
int ledpin=13;

In the setup function, we'll set up the console for 9600 baud, and set the LED pin to OUTPUT.

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

In the Loop function, we'll read the value coming in. If it's "a" then we're going to turn the LED on for one second, then off for one second. I'm going to send the words "Tinker Pi" back. You can send whatever you like.

void loop() {
  val =;
  if (val=='a')
    digitalWrite(ledpin, HIGH);
    digitalWrite(ledpin, LOW);
    Serial.println("tinker pi");

Step 3 - Upload the Sketch to the Arduino

Make sure you have the Arduino UNO selected under boards.


And then make sure you have the correct port selected.

Tools Port

Upload your sketch, and open the serial monitor. Type 'a' and click Send. The LED should blink on and off.

Upload Sketch

Step 4 - Connect the Android to the Bluetooth Module

Now that that's working, we're ready to connect to the Android device. Connect the transmit and receive wires, using this diagram.

Bluetooth Diagram

Connect to the Bluetooth in settings:

Settings > Connected Devices > Pair New Device > Select HC-06

Type 1234 for the password

Connect Android to Bluetooth

Step 5 - Download and Connect the Bluetooth Terminal App

Install the free App on your smart phone called "Bluetooth Terminal" from Google play store. This won't work on an Apple device, unfortunately.

Install Bluetooth Terminal App

Type the letter "a" at the bottom of the screen and click Send. You should see your message returned from the Arduino.

Connect App to Bluetooth

You should see the LED blink for 1 second:

Blinking LED

We're ready, now, to start incorporating bluetooth into your Arduino projects. Be sure to subscribe to my channel, so we can have some more fun with the bluetooth module.

Finish Breakpoint

Next Up

Create a Hello World Android App in App Inventor #tt21

Be sure to subscribe to our channel!