Arduino MEGA/HC-05 BT Module Configs - Almost have it

Ok, so I have been reading and testing and I am getting closer but still a little off. Hoping for a little guidance here. I am trying to configure two HC-05 BT modules (a slave and a master) with two Arduino MEGA cards using the following link:

http://www.martyncurrey.com/connecting-2-arduinos-by-bluetooth-using-a-hc-05-and-a-hc-06-pair-bind-and-link/

The only difference in the setup is I am using the RX0 (pin 0) and the TX0 (pin 1) vice the D2 and D3. I know that I get into full AT mode as I am able to use all commands.

I have no problems setting up the SLAVE module. Where I seem to run into the problem is on the MASTER config. The two commands that I continue to get failure on is the pair and link. The bind works. I guess I have two questions.

  1. When I am done configuring the SLAVE BT module, what do I do with it while I am configuring the MASTER? Meaning, do I keep it in full AT mode, do I pull pin 34 and reset it so it’s blinking fast again and do I keep the RXO and TXO pins the same?

  2. What could be causing the pair and link commands to fail?

The only difference in the setup is I am using the RX0 (pin 0) and the TX0 (pin 1) vice the D2 and D3. I know that I get into full AT mode as I am able to use all commands.

Why? Why not use TX1 and RX1, and Serial1 to read them, and keep Serial available for debugging?

  1. When I am done configuring the SLAVE BT module, what do I do with it while I am configuring the MASTER? Meaning, do I keep it in full AT mode

This page says no.

https://arduino-info.wikispaces.com/BlueTooth-HC05-HC06-Modules-How-To

do I pull pin 34 and reset it so it's blinking fast again

Don't know. Would guess yes.

and do I keep the RXO and TXO pins the same?

Yes, and no. You don't change pins after configuring the device, but you shouldn't use those pins, either.

  1. What could be causing the pair and link commands to fail?

Your code. The fact that the devices are not configured properly. Improper power. Lots of things.

Paul, you ALWAYS give me what I am not doing right, but never seem to be helpful in the corrections. In fact, you are more condescending than anything. With that said, I value any assistance you may offer because you are, of course, the first to ever get to the Brattain rank.

www.martyncurrey.com was suggested on here from a previous post similar to this one that I posted.

What I am not understanding the most is why someone cannot tell me why the pair and link portion isn't working. The connections I am using are working per the link above so, if it's the code that is incorrect, could you please let me know what the right code is?

As for the link that you gave me. I have read that in the past. The commands to use are identical to what I am using. Also, when you click to go to the page that shows connections and code, it doesn't give the specific Arduino it is using so I am confused there.

Lastly, when I tried using your TX1 and RX1 with my setup, I was getting nothing in the serial monitor. So, as with my original post and all the posts I have submitted prior, can you please help me figure out what I am missing so I can get it correct?

lpetrowicz:
The only difference in the setup is I am using the RX0 (pin 0) and the TX0 (pin 1) vice the D2 and D3. I know that I get into full AT mode as I am able to use all commands.

You probably don’t, you just think you do.

I have no problems setting up the SLAVE module.

You probably do, but haven’t found that out yet. The only thing you needed to do was ensure the passwords are the same, and I guess they were all along, therefore you didn’t need to do anything.

I submit you would be a lot better off if you just did what Martyn told you to do. The code will work fine on a Mega and, while there are other ways of doing it on a Mega, it is not unreasonable to use it.

Folks, I have followed that link to the letter. When I was mentioning configuring the SLAVE, I used the command AT+ORGL, therefore having to rename the module to SLAVE. Yes, I left the default baud rate, role and mode.

I believe I am in the full AT Mode because, as the link reads, all the commands can be used. The only two commands not functioning properly are the pair and link. Every other command is working fine for me.

However, after serving the country for 20 years, I learned a valuable lesson. If you are going to bring forth a problem, then come with a solution as well. All you guys keep telling me is what I am doing wrong. Myself and my IT assistant have been at this for a couple months now and read through so many links. I feel like I am doing things correctly and getting closer and you all keep shooting it down. I have no problem with that but would love a little assistance on how to make the two BT modules pair and link so I can complete my extremely overdue project.

Any and all assistance would be greatly appreciated. Thank you for your time.

Have you noticed that this is the Programming part of the forum? We discuss CODE here. So far, you've posted none.

You have NOT told us what AT commands you have issued to the master device. You have not told us the EXACT responses.

You have NOT told us what AT commands you have issued to the slave device. You have not told us the EXACT responses.

How can you really expect us to know why your damned devices won't pair?

Folks, I loaded a blank sketch for the code in the Arduino IDE. Below are the AT commands I entered, in order, and the results I received. As I have stated, the two commands that failed were Pair and Link. Every other command has responded properly.

AT+ORGL
OK

AT+NAME=MASTER
OK

AT+NAME?
+NAME:MASTER
OK

AT+ROLE=1
OK

AT+ROLE?
+ROLE:1

AT+PSWD?
+PSWD:1234
OK

AT+UART?
+UART:38400,0,0
OK

AT+CMODE?
+MODE:0

AT+INIT
OK

AT+PAIR=2010,10,317820,30
FAIL

AT+BIND=2010,10,317820
OK

AT+BIND?
+BIND:2010:10:317820

[AT+LINK=2010,10,317820
FAIL

I DID IT!!!!! They are paired, binded and linked and I have tested them. I tested them by opening a serial monitor on each and then typed a message and it showed up on the other serial monitor.

I AM STOKED!!!!! Thanks for putting a little fire under mu buttocks, lol!!!

I DID IT!!!

So, what DID you do to make that happen?

I was mistyping a 0 when I should have been putting a 6 for a number in my address. That was why pair and link did not work.

I know…EMBARRASSING!!!