Introduction
HC-05 Bluetooth Module
HC-05 is a Bluetooth device used for wireless communication with Bluetooth enabled devices (like smartphone). It communicates with microcontrollers using serial communication (USART).
Default settings of HC-05 Bluetooth module can be changed using certain AT commands.
As HC-05 Bluetooth module has 3.3 V level for RX/TX and microcontroller can detect 3.3 V level, so, there is no need to shift TX voltage level of HC-05 module. But we need to shift the transmit voltage level from microcontroller to RX of HC-05 module.
For more information about HC-05 Bluetooth module and how to use it, refer the topic HC-05 Bluetooth module in the sensors and modules section.
Interfacing Diagram
Interfacing HC-05 Bluetooth Module with Particle Photon
Note: Default Bluetooth name of the device is “HC-05” and default PIN (password) for connection is either “0000” or “1234”.
Example
Here, we will transmit data from Smartphone via Bluetooth to the Particle Photon board and display it on Serial Monitor of PC.
Download and install a Bluetooth terminal application on your phone and use it to connect to the HC-05 Bluetooth module.
Data is sent from the Smartphone using the Bluetooth terminal application.
Sketch for Displaying Data Received Via Bluetooth On Serial Monitor
void setup() {
// put your setup code here, to run once:
Serial.begin(9600); /* Define baud rate for serial communication */
Serial1.begin(9600); /* Define baud rate for serial1 communication */
}
void loop() {
// put your main code here, to run repeatedly:
if (Serial1.available()) /* If data is available on serial port */
{
Serial.write(Serial1.read()); /* Print character received on to the serial monitor */
}
}
Output of HC-05 Bluetooth
Components Used |
||
---|---|---|
Particle Photon PHNTRAYH |
X 1 | |
Bluetooth Module HC-05 Bluetooth is a wireless communication protocol used to communicate over short distances. It is used for low power, low cost wireless data transmission applications over 2.4 – 2.485 GHz (unlicensed) frequency band. |
X 1 |
Downloads |
||
---|---|---|
|
bluetooth | Download |