The materials needed to pair two HC-05 Bluetooh Modules are: 2 HC-05 Bluetooth Modules, 5
Male to Female Jumper Wires, An Arduino Uno hooked up to the Arduino IDE, and if you want
to test the connection you're going to need another Arduino, another set of jumper wires
and a 5v power source.
First, LABEL YOUR MODULES, this might seem a little tedious but there's going to come
a point where you step away from your project for a couple days and when you get back you're
going to be really glad you took the time to do this.
Connect your Arduino to the computer and run the Arduino IDE to bring up a blank sketch.
Check that your board and port settings are correct, and upload the blank sketch to your
Arduino. we're going to start with the module marked "Slave" The first thing you want to
do is unplug the power source from the Arduino Uno and connect the slave module to the Arduino
using the following configuration: The STATE pin doesn't need to be connected to anything,
RX goes to RX, TX goes to TX, GND goes to Ground, 5v to 5v and the EN key can go to
the 3.3v pin of the Arduino.
If you plug the power source back into the Arduino you'll see the HC-05 power on with
short rapid blinks, this is standard pairing mode and the HC-05 is looking for another
module to pair with.
To pair the bluetooth modules we need to configure them in AT Command Mode.
AT Command mode is denoted by long, slow blinks.
To power on the HC-05 module in AT Command mode you wanna plug the power source into
the Arduino while holding down the reset button on the HC-05 module.
The long slow blinks indicate that we're in AT Command mode and we can begin to configure
the modules for master and slave.
Open the Arduino IDE and enter the Serial monitor.
Be sure that the Baud rate is set to 38400 and both new line and carriage return are
selected.
We can now begin entering AT Commands.
By default both modules will be set to slave and our goal here is to set one of them to
master and then bind it to the slave module using the slave's address.
Since we started with the slave module, all we really need to do here is get the address
of this module to give to the other one.
If you type AT into the top bar, at first you're going to get an error code, I'm not
really sure why this happens, but if you type AT again you will get an OK.
To confirm that we dealing with a slave module you can type AT+ROLE? this asks the module
for it's role.
0 is Slave.
1 is Master.
Since we have a zero here, we know that this module is configured to slave and all we need to
do is get the address.
If we type AT+ADDR? it will give us the address.
Copy this address down into a notepad or another application and as you copy it change all
the colons to commas.
When you enter it back into the master module you're not going to want those colons there.
This is all we need to do for the slave module so we can unplug this from the arduino and
repeat the previous steps to get the master module plugged into the arduino and powered
on into AT Command mode.
Back in AT Command mode for the master module, we need to do 3 things: change the role of
the module to master, change the connection mode of the module to only connect to one
device by it's address, and attach the address of the slave module to the master module.
If we type AT+ROLE?
into the command line we see it returns a 0 showing that by default it is set to slave.
To set this to 1 or master, you type in AT+ROLE=1 you'll get an okay and you can confirm that
this worked by typing AT+ROLE?
again and seeing that it is configured to 1.
Next we want to check the connection mode by typing AT+CMODE? you'll see it returns
a 1.
Connection mode 1 means that it will connect to any device within the vicinity . We want
it to connect to only one device, and that's connection mode 0 so we want to type in AT+CMODE=0.
We get an okay and we can just double checked that that worked by typing in AT+CMODE?
again and seeing that now it is configured to 0.
Now that we've told the module to only connect to one device, we have to give it an address
to connect to.
To do that we're going to type AT+BIND=, and then we're gonna copy the address of the slave
module from our notepad or other application and press enter you see we can get an okay
and we can check that by typing AT+BIND? and you can see it spits back the address with
the colons reinserted instead of the commas which means we're all set to pair the two
devices.
If you have an extra arduino handy you can test this connection by plugging them both
in.
You just need to make a couple changes to the wiring configuration.
For both modules you wanna plug RX into TX and TX into RX and get rid of the wire connecting
the EN pin to the 3.3v pin on the arduino.
With both arduinos powered on you will see that the two modules enter into their third
state which is their paired state and that in denoted by a synchronous blink between
the two modules.
That's it for this no-intro tutorial I hope it worked out for you.
If you like this video and you want to see more please subscribe to my channel and also
check out some of my robotics projects including Chopper from Star Wars Rebels and my BB-8
project.
Alright, see ya later!