Subscribe to Make Magazine Today!

Make: Projects

New Project: Connect an Arduino to a $7 Bluetooth Serial Module

Make your Arduino communicate with any Bluetooth-enabled device.

New Project: Connect an Arduino to a $7 Bluetooth Serial Module

The Arduino microcontroller board is a fantastic starting point for electronic and physical computing projects. As the standard Arduino board does not offer any wireless connection, such as WLAN or Bluetooth, this project shows how to easily connect a $7 Bluetooth serial module to your Arduino. The Bluetooth serial module enables your microcontroller board to communicate with every Bluetooth-equipped device, such as laptops, tablet PCs or smartphones.

Steps

Step #1:

PrevNext
New Project: Connect an Arduino to a $7 Bluetooth Serial Module

The image shows a $7 Bluetooth serial module that you can readily find on eBay. It offers 4 pins (5V, Ground, RX and TX), that you have to connect with the right pins on your Arduino Uno board. No additional electronic parts are necessary.

Step #2:

PrevNext
New Project: Connect an Arduino to a $7 Bluetooth Serial Module

You will need to identify the 5V and Ground pins on your Arduino in order to provide the power source for activating your Bluetooth serial module. Connect the Bluetooth module’s RX pin to the Arduino’s TX pin. Connect the Bluetooth module’s TX pin to the Arduino’s RX pin.

Step #3:

PrevNext
  • After connecting the Bluetooth serial module to your Arduino you are able to pair the Bluetooth module with any Bluetooth-enabled device. Use ’1234′ as the pairing key.
  • There is no additional library necessary for communication. The Bluetooth module replaces a normal serial cable on RX and TX.
  • The Arduino code for writing to the Bluetooth serial module is quite simple: void setup() { Serial.begin(9600); } void loop() { Serial.println("test"); delay(1000); }
  • For receiving the output on your PC just open a terminal program, or Putty, and connect to the COM port of your Bluetooth Serial profile (e.g. COM3 on my PC).

  • wolfgang

    no specific library is needed, it’s normal serial Arduino communication. i added this code to the guide.
    To receive the Arduino output, just open a terminal program and connect to your Bluetooth serial profiles com port (e.g. COM3).

  • http://gravatar.com/komfushee komfushee

    I’ve followed your tutorial, but when I try to open the terminal on windows, I get the error “Unable to open connection to COM3 – Unable to open serial port”, the serial connection is on the COM3 when I get the properties of the connection in windows, the speed is set to 9600 on both arduino and windows, but it does not work, any idea why it does that ?

  • Otto

    How do you know the pairing key and how can you change it?
    Also, your code is just writing to the serial monitor, it’s not using the bluetooth at all. Do you have a code that show the bluetooth working?

  • Mumble

    what else can you do with this bluetooth serial module

  • http://forexground90.tripod.com forexground.pl

    Have you ever thought about adding a little bit
    more than just your articles? I mean, what you say is fundamental and all.

    But think about if you added some great photos or video clips to
    give your posts more, “pop”! Your content is excellent
    but with images and clips, this blog could certainly be one
    of the best in its field. Awesome blog!

  • Gary

    It should also be noted that in order for this to work, the RX and TX wires going between the Arduino and the Bluetooth module should not be connected until the sketch is finished uploading.

  • KentridgeEngineering

    Does anyone know…is it possible to have two of these being used in the same room, without interference? Like if I have two Android phones, controlling two Arduino robots…could I pair them so Phone 1 communicates with Arduino 1, and Phone 2 with Arduino 2?

    • Nilas Støhrmann

      When two bluetooth devices Ex. Phone 1 and Arduino 1 has etablished a WPAN connection (paired) they communicate with the same “spread-spectrum frequency hopping”. Which mean that the transmitter Ex. Arduino 1 changes between 79 communication frequencies every 1.6 ms and the paired device Phone 1 uses the same frequancy at the exact same time. Other WPAN connection Ex. Phone 2 and Arduino 2 will operate the same way and therefore it is very unlikely that they will interfere with another WPAN since the chances of communicating with same freq as Phone 1 and Arduino 1 at a certain time are very little.

  • Gait

    Can the bluetooth module pair more than one device with the arduino at a time ?

    • Zootalaws

      Can you be more specific?

      These BT serial devices are strictly 1:1, but if you want multiple bluetooth devices talking to your Arduino, just add more BT devices and connect them to different pins.

  • disqus_9MakbM3VW6

    Is it possible for one Arduino bluetooth device to be linked to multiple devices, even if it’s can only “speak” to one at a time?

  • Bird

    is it possible to use your computer bluetooth to connect to it as serial comunication

  • Bort

    I finished these steps, and while I can use serial monitor just fine, I cannot upload anything. I get this error: “avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x0d”

    • nicknormal

      Try disconnecting Pin 0 when uploading; does that solve the error?

      • Bort

        Pin 0 is RX, don’t you mean to disconnect pin 1 (TX)? How can the Arduino be programmed without RX?
        I tried disconnecting pin 0 anyway, and then pin 1 instead, neither worked. I tried using two diffren’t PCs, one with the Arduino Beta IDE, and another with the standard IDE. No dice. I don’t know what else to try. Maybe I’ll have to spend the $25+ and get an official Bluetooth EZ Link from Adafruit.

        • nicknormal

          Disconnecting pin 0 always works for me with “avrdude: stk500_getsync()” errors; using Uno. This solution has worked for others too: http://www.instructables.com/id/A-solution-to-avrdude-stk500getsync-not-in-syn/ — and several other instances reported in Google search. Not sure what else to mention. Good luck.

        • nicknormal

          And no the Arduino is not “programmed” over RX/TX; RX/TX is a serial communication protocol for whatever device is attached, in this case the Bluetooth module. The Uno is programmed (typically) via the USB cable attached to it, through the IDE. If you’re trying to “program” the Uno via the Bluetooth module you’re in territory unfamiliar to me. Hope this clarifies. Cheers.

  • Pingback: Hands-On with New Board: the PSoC 4 BLE Pioneer Kit | MAKE()

  • Pingback: Mattie’s Progress – Week 1 | KALEIDOSPOKE()

Related Supplies at Maker Shed