The Bluetooth Module allows your Arduino to create a wireless serial connection to your computer, to send and receive data and commands.

The module can be reconfigured using AT commands, and the firmware can be reflashed to change its features. By default, the module acts as a slave device and provides a serial link.

1. Fit the module to your Arduino or shield

The Bluetooth Module matches the XBee module format, so you can fit it directly into any shield or Arduino board that supports XBee. The Bluetooth Module uses the same pins as XBee for GND, 3.3V, TX, and RX. Note that it only supports 3.3V I/O, just like XBee, so only plug it into a board that provides 3.3V logic and power.

2. Place serial port jumpers

Depending on your XBee shield, you may need to set jumpers to select which pins to use for its TX and RX connections.

3. Apply power and pair the device

Connect your Arduino to your computer by USB to provide power. You can now pair the Bluetooth Module to your computer using PIN code 0000. See our Bluetooth Pairing Guide for detailed instructions on OS X, Linux and Windows. 

4. Load example sketch

Open the Arduino IDE, and create a new sketch. Copy and paste in the following sketch:

 

#include <SoftwareSerial.h>

SoftwareSerial bt(2,3); // RX, TX

int thisByte = 33;

void setup() {
  bt.begin(9600);
  bt.println("ASCII Table ~ Character Map");
}

void loop() {
  bt.write(thisByte);

  bt.print(", dec: ");
  bt.print(thisByte);
  bt.print(", hex: ");
  bt.print(thisByte, HEX);
  bt.print(", oct: ");
  bt.print(thisByte, OCT);
  bt.print(", bin: ");
  bt.println(thisByte, BIN);

  if(thisByte == 126) {
    thisByte = 32;
  }
  thisByte++;
}

 

Note that you may need to adjust the RX and TX pin settings depending on how your XBee shield is set up.

Select the usual serial port and board type for your Arduino, and upload the sketch via the Arduino's usual USB connection.

This sketch is based on the "ASCIITable" example included in the Arduino IDE, but modified to use Software Serial on pins 2 and 3 and to repeat the table continuously.

5. Open serial console using Bluetooth

After uploading the sketch to your Arduino using its regular USB port, you need to switch the Arduino IDE's serial connection over to using the Bluetooth connection to receive the data sent by the sketch.

In the Arduino IDE, open Tools -> Serial Port. On OS X, there will be a new serial port listed called "HC-05". On Linux, it will be called "rfcomm0". On Windows, it will be the COM port name that was assigned when you paired the device. Select the serial port for the Bluetooth device, and then open the serial console.

Set the baud rate to 9600bps.

You should then see messages from your Arduino, continuously repeating all the characters in the ASCII table.