How to Interface HC-06 to Arduino
Introduction
Electronics projects nowadays usually needs a wireless communication interface. Bluetooth device is one of the most commonly use for this purpose. Today, I am going to show you on how to interface HC-06 bluetooth module to Arduino.
Bill Of Materials
- HC-06 bluetooth module
- Arduino Uno board
- A couple of jumper wires
Hardware Instruction:
- Connect the HC-06 VCC pin to +5V pin of Arduino Uno (please refer to the schematic below).
- Connect the HC-06 GND pin to GND pin of Arduino Uno.
- Connect the HC-06 TXD pin to pin 2 of Arduino Uno (functions as Rx).
- Connect the HC-06 RXD pin to pin 3 of Arduino Uno (fucntions as Tx).
- Connect the Arduino Uno to the computer.
- Run the Arduino IDE.
- Make sure Arduino Uno is selected under Tools > Board.
- Select the correct serial port under Tools > Port.
- Upload the sketch. Source code is provided below. This basically echoes the serial data through HC-06 to hardware serial of Arduino Uno and vice-versa.
HC-06 Troubleshooting
- Connect a jumper wire between HC-06 RXD and TXD.
- Connect +5V supply to VCC.
- Connect the supply ground to GND pin.
- Using a mobile / smart phone connect through a bluetooth to HC-06.
- Enter pin code 1234. This basically echoes whatever is received by the HC-06 to a bluetooth terminal.
Call To Action
If you find this lesson useful, please kindly visit my website and Youtube channel. Links provided below:
Schematic Diagram
Source Code
1#include <softwareserial.h>
2
3SoftwareSerial hc06(2,3);
4String cmd="";
5
6void setup(){
7 //Initialize Serial Monitor
8 Serial.begin(9600);
9
10 //Initialize Bluetooth Serial Port
11 hc06.begin(9600);
12
13 Serial.print("Setup DONE.");
14}
15
16void loop(){
17
18 //Write data from HC06 to Serial Monitor
19 if (hc06.available()){
20 Serial.write(hc06.read());
21 }
22
23 //Write from Serial Monitor to HC06
24 if (Serial.available()){
25 hc06.write(Serial.read());
26 }
27
28 delay(100);
29}
Posts in this series
- How to Get Started with ATTiny85 in Arduino IDE
- Tutorial: How to use MFRC522 RFID module using Arduino
- SOS Flasher Using Millis Function with Enable Switch
- Tutorial: How to use DS3231 RTC in Arduino
- Tutorial: How to use 0.96 OLED - a small and cute display
- Tutorial: Getting Started with the NRF24L01 | How to use | Arduino
- Tutorial: How to use SIM800L GSM Module for Controlling Anything | Arduino
- Tutorial: How to use Keypad | Text Entry Mode | Arduino
- Tutorial: How to use 4x4 Keypad | Arduino
- Project Idea: Arduino Voltmeter
- Project Idea: Door Lock Security | Arduino
- Multitasking with Arduino | Relay Timer Controller | using millis
- Tutorial Understanding Blink Without Delay | How to millis
- Arduino Simple LCD Menu
- How to use SIM800L GSM Module using Arduino | Make or Answer Voice Calls
- Tutorial: How to Use Arduino Uno as HID | Part 2: Arduino Mouse Emulation
- Tutorial: How to Use Arduino Uno as HID | Part 1: Arduino Keyboard Emulation
- Tutorial: How to use SIM800L DTMF to Control Anything | Arduino
- Tutorial: Arduino EEPROM
- How to use SIM800L GSM Module | Arduino | Send and Receive SMS
- 16x2 LCD Menu for Arduino
- Tutorial: Arduino GPIO | How to use Arduino Pins
- MIT App Inventor for Arduino
- RC Car using L298N, HC-06, and Arduino Uno
- How to Use LCD Keypad Shield for Arduino
- How to Use Arduino Interrupts
- Project: Automatic Alcohol Dispenser
- TUTORIAL: How to use HC-SR04 Ultrasonic Sensor with Arduino
- Source Code: Astronomia Meme and Funeral Dance | melodies the Arduino way
- How to Get Started with L293D Motor Driver Shield with Arduino
- How to Get Started with L298N Motor Driver module using Arduino
- Part 2: Wav Music Player with Lyrics Using Arduino and SD Card
- Interfacing Infrared to Arduino Uno
- Part 1: Wav Music Player Using Arduino Uno and SD Card
- How to Interface Stepper Motor to Arduino Uno
- How To Play MP3 Files on Arduino from SD Card
- What is Arduino Software Serial
- How to Interface SD card to Arduino (without SD card shield)?
- Playing Melodies Using Arduino
- 8 Degrees Of Freedom (DOF) Robot Using Arduino Uno
- How to Interface PS2 Controller to Arduino Uno
- Part 3: DF Player Mini Tinkering with Arduino Nano and LCD
- How to make a Remote Control RC car using Arduino and HC-06 bluetooth module
- Part 2: DF Player Mini Tinkering with Arduino Nano
- Part 1: DF Player Mini - a mini cheap mp3 player
No comments yet!