Introduction: Getting Started With Arduino - Bluetooth Communication

About: Tutorials provided by BA/BSc (Hons) Digital Art and Technology at Plymouth University

In this tutorial we are going to look communication between an Arduino and Computing via Bluetooth.

In order for us to do this, we are going to use a reasonably priced HC-06 bluetooth board.

So that we had some data to stream, you are going to need to build a simple Arduino sensor circuit. Why not try our light sensor project.

Step 1: Wire Up Your Arduino

Once we have some data to send, we need to connect the bluetooth board.

On the Arduino side, connect the following wires (as shown in the photos):

  • A black wire to one of the GND pins
  • A blue wire to digital pin 1 (usually marked TX for "transmit")
  • An orange wire to digital pin 0 (usually marked RX for "receive")
  • A red wire from the 5v pin on the Arduino

The red and black wires will provide power to the bluetooth board, the blue wire will carry outgoing data and the orange wire will bring incoming data to the Arduino.

Step 2: Voltage Divider

There's a problem.

The Arduino that we are using is a 5v board (as are many of the Arduinos out there), but the bluetooth board's input and output pins are only 3.3v volts. If we send 5 volts to the bluetooth board it would probably burn it out.

For this reason, we need to build something called a "voltage divider" - this is basically a simple circuit that splits the voltage in two, sending some to the bluetooth board and the rest back to the Arduino (via the GND pin).

To build the voltage divider we are going to need two resistors. The value of the resistors doesn't matter - except that one needs to be twice that of the other. We are using a 200k resistor and a 100k resistor. Wire up the resistors as shown in the photo with:

  • The blue wire from the Arduino connected to the smaller resistor (100k).
  • A white wire connected to both resistors.
  • A black wire connected to the larger resistor (200k) - this black wire should lead back to any of the GND pins on the Arduino.

WARNING: Be sure to wire up your circuit just as shown in the photo or you risk damaging your bluetooth board !

Step 3: Wire Up Your Bluetooth Board

Now that we have a voltage divider to provide a safe input signal, we can wire up the HC-06 Bluetooth board as shown in the photo:

  • Connect the red (5v) wire from the Arduino to the VCC pin on the bluetooth board
  • Connect the black GND wire from the Arduino to the GND pin on the bluetooth board
  • Connect the orange wire from the Arduino to the TX pin on the bluetooth board
  • Connect the white wire from the voltage divider to the RX pin on the bluetooth board

Note: It's safe to power the board with 5v because it has a built in voltage regulator to deal with it

Note: We don't have to voltage divide the signal on the orange wire since this is only used for data coming out of the bluetooth board (which is 3.3v anyway)

Step 4: Pair Your Computer With the Bluetooth Board

Before we can start communicating between Arduino and Computer, the two need to be paired.

This process will depend on what operating system you are using - check your documentation for details.

Your Arduino should be on so that the Bluetooth board is powered up and is discoverable.

Note: Make sure you check the Password/PIN used by your bluetooth board. The PIN for the board we are using is 1234. Pairing failed first time around until we specified this in the pairing options.

Step 5: Select the Bluetooth Serial Connection

Once your Bluetooth board is paired with your computer, a new Bluetooth serial port will appear in the "ports" menu of the Arduino IDE. This name will usually contain the name of the bluetooth device (you can see that we have got multiple HC-06 boards paired in the photo above).

Select the Bluetooth serial port from your ports list.

Once this has been done, any data sent from the Arduino (using the Serial.println functions) will be received by your computer via Bluetooth.

Step 6: Connect Via Serial Monitor

Open up the "Serial Monitor" by clicking on the magnifying glass icon on the top right of the Arduino window. The Serial monitor should look like the above - make sure that the baud rate matches that of the sketch running on the Arduino (9600 in our case). You should now be able to see any data being sent from your Arduino appearing in this window.

Step 7: Enjoy

If everything worked, you should now be able to receive data wirelessly from your Arduino. Equally, you can also send data wirelessly to your Arduino from your computer. This can be done using Serial Monitor as usual. Alternatively, you can write desktop applications that communicate via serial with your Arduino.

But that is a whole other instructable...

If you enjoyed this instructable, check out our other tutorials

If you love this kind of stuff, check out our degree