RoboThings

robothings hc05

Product Overview:

Welcome to RoboThings! In this tutorial, we’ll guide you through using the HC-05 Bluetooth module with an Arduino board. The HC-05 allows wireless communication between the Arduino and a smartphone, making it perfect for a variety of projects.

What You’ll Need

 
  • Arduino board (e.g., Uno, Mega, Nano)
  • HC-05 Bluetooth module
  • Breadboard and jumper wires
  • Smartphone with a Bluetooth terminal app (e.g., Bluetooth Terminal, Serial Bluetooth Terminal)

Step 1: Install the Arduino IDE

If you haven’t already, download and install the Arduino IDE from the official Arduino website.

2: Wiring the HC-05 to Arduino

First, let’s connect the HC-05 to the Arduino. The wiring is straightforward:
  • HC-05 VCC to Arduino 5V
  • HC-05 GND to Arduino GND
  • HC-05 TXD to Arduino RX (Pin 0)
  • HC-05 RXD to Arduino TX (Pin 1)
  • Ensure the connections are secure. Now, let’s move on to programming the Arduino.
robothing_hc05_circuit

Step 3: Programming the Arduino

Open the Arduino IDE and write the following code to establish communication between the Arduino and the HC-05 module.

				
					#include <SoftwareSerial.h>

SoftwareSerial BTSerial(10, 11); // RX, TX

void setup() {
  Serial.begin(9600); // Default communication rate of the HC-05
  BTSerial.begin(9600);
  Serial.println("Enter AT commands:");
}

void loop() {
  // Keep reading from HC-05 and send to Arduino Serial Monitor
  if (BTSerial.available()) {
    Serial.write(BTSerial.read());
  }
  // Keep reading from Arduino Serial Monitor and send to HC-05
  if (Serial.available()) {
    BTSerial.write(Serial.read());
  }
}

				
			

 

In this code, we’re using SoftwareSerial to create a serial port on pins 10 and 11. You can modify these pins based on your setup.

Step 4: Installing the Bluetooth Terminal App

Download and install a Bluetooth terminal app on your smartphone. Here are some popular options:

 

Open the app, turn on Bluetooth on your phone, and pair it with the HC-05 module. The default PIN is usually “1234” or “0000”.

Step 5: Testing the Connection

After pairing, open the terminal app and connect to the HC-05 module. You should see a message like “Enter AT commands:” in the Arduino Serial Monitor.

Type any message in the Bluetooth terminal app and press send. The message should appear in the Arduino Serial Monitor. Similarly, type a message in the Serial Monitor and it should appear on your smartphone.

Conclusion

Congratulations! You’ve successfully set up the HC-05 Bluetooth module with your Arduino. Now, you can expand this basic setup into more complex projects, like remote controlling robots or home automation systems.

If you have any questions or run into issues, feel free to leave a comment below. Happy hacking!

2.5 28 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
Open chat
1
Hi, how can I help you?
Powered by