- HC-04, HC-05 and HC-06
- RN-41 and RN-42
- AUBTM series chips
The multitude of chips are designed to fulfill different types of objectives. For example, range or the maximum distance over which communication is possible. In this post, we will use the HC-05 bluetooth chip which is a Class 2 bluetooth device. All Class 2 bluetooth devices should have an approximate range of 30 feet. In order to give you an idea of how you may put the bluetooth module to use, we will see how to blink a LED remotely by sending commands from a Windows Phone. The Arduino sketch used in this example is written in such a way that it will receive a number between 1 and 5, then depending on the number received from the phone, it will blink the LED that many number of times.
To start with let us inspect the HC-05 bluetooth chipset and try to understand the pins that are needed for making a connection with the Arduino Uno.
Figure 1 - HC-05 Bluetooth |
There are 6 pins provided with the chip. Out of the 6 pins we will be using only 4 pins for the bare minimum interfacing.
- Rx Pin (HC-05): This pin will be connected to Arduino Uno's Tx pin. However, we will shift Arduino's 5V to 3.3V using a votage divider. That is because the HC-05 module's Rx pin uses 3.3V.
- Tx Pin (HC-05): Connect this pin to Arduino's Rx pin directly. Although HC-05's Tx pin works at 3.3V, it would still be sufficient for Arduino's RX pin which operates at 5V.
- Gnd Pin (HC-05): This pin should be connected to Arduino's Gnd pin directly.
- +5V (HC-05): This pin should be connected to Arduino's 5V pin. The current drawn by HC-05 should be less than 50mA, hence it should get the required current from Arduino's 5V pin.
For using the HC-05 with Arduino Uno, the first thing that we will have to do is to connect the chip with the Arduino Uno as explained above. You may follow the schematic diagram shown below for easy reference.
Figure 2 - Using Bluetooth with Arduino |
Big Caution: DO NOT connect the Jumper wires to Arduino's Tx and Rx pins while loading the C sketch, to avoid loading the program to the Bluetooth device.
Good Practice: DO NOT connect anything to the Arduino while loading a program.
Once nothing is connected to the Arduino board, except the cable to your computer, load the following C sketch into your Arduino Uno for interfacing the LED with the Bluetooth module, as shown in the picture above.
Now connect the HC-05 module to the Arduino board and power on the Arduino board by connecting to your computer USB port.
On the other end, launch BT Terminal on your windows phone.
Connect to your HC-05.
In the Communication screen, send any number between 1 and 5 (as per your choice), as shown below.
Figure 3 - Sending commands to HC-05 from Windows Phone |
As soon as you send a number the on-board LED on Arduino's Pin 13 will blink that many number of times.
That's it! You have established a basic bluetooth connected project.
Cheers!
KBRC