This tutorial guides you, how to interface Bluetooth module with Arduino UNO and Arduino Mega 2560. Interfacing HC-05, HC-06, JY-MCU v1.02 or v1.03 with Arduino Uno or Arduino Mega 2560 using two serial ports.
HC-05 Pinouts:
HC-05 & HC-06 have different pin numbers of LEDs only, power and Serial Communication pins are same.
JY-MCU Pinouts:
JY-MCU BT_BOARD v1.02 and v1.03 have same pinouts.
Connections:
Connect Bluetooth Module JY-MCU BT_BOARD v1.02 and v1.03 with Arduino as:
Bluetooth JY-MCU | Arduino Mega 2560 | Arduino Uno |
1 – Gnd | GND | GND |
2 – Vcc | +5v | +5v |
3 – RX | TX1 | TX |
4 – TX | RX1 | RX |
Connect HC-05 or HC-06 with Arduino as:
Bluetooth | Arduino Mega 2560 | Arduino Uno |
1 – Gnd | GND | GND |
2 – Vcc | +3.3v | +3.3v |
3 – RX | TX1 | TX |
4 – TX | RX1 | RX |
Code for Arduino Mega:
void setup() { Serial1.begin(9600); Serial.begin(9600); } void loop() if(Serial.available()) }
|
Code for Arduino Uno:
As Arduino Uno has only one serial port. So we will connect Bluetooth Module with RX and TX pins of Arduino Uno. This code will continuously transmit text “GalaxySofts” and “http://www.galaxysofts.com” with a delay of 1 second.
void setup() { Serial.begin(9600); } void loop() |
Video on Interfacing Bluetooth Modules with Arduino Uno and Mega 2560: