[Resolved] Switch a BT module HC-05 to master mode

Hello !

I have recently bought two HC-05 to be able to communicate between two arduino boards. I need to switch one to master mode but after watching tons of videos and tutorials, I just can't get it right !

I get how to enable the AT mode and I know I have to write AT+ROLE=1 to put switch it to master mode but I don't know where I am supposed to write it. I mean am I supposed to write it in the serial monitor of Arduino ? And if so how do I program it ?

For info, I am using an AT mega 2560 and I have a PC.

Thanks for your attention and for your help I hope !

Usually you just type "AT" into a serial monitor and the device (whatever it is comes back with a command prompt, which could be AT: or anything else but you know it's command prompt if it keeps replying with the same prompt when you hit the carraige return (called the "ENTER" key these days).

So I don't need any kind of code or program ? I just open a blank arduino page and I open the serial monitor ?

As I said, without reading any instructions , if you THINK it has a serial user interface you just open the monitor and hit RETURN. IF IT IS ALIVE and IS a serial user interface, it will reply with the same prompt no matter how many times you hit RETURN. If you enter the correct command at the command prompt it will acknowledge with a confirmation code. Some user interfaces respond with a command menu if you just enter "?"/RETURN.

Ok thank you a lot for your answer =)

I'm not familiar with the device you are on about but...

in very basic terms...

You can upload a program called SerialRelay to your Arduino, and connect that to the device. When you open Serial Monitor anything you send to the Arduino will be sent on to the device, and anything it responds with sent to your screen.

Thank you I'll try that !

Any idea where I can find it ?

You could try my signature link... XD

Ok thanks =)

Wait, are you saying on your website that if I am using an AT mega, I can't use the serial monitor ?

I'm a little bit wiser now - you are aware that it is a 3.3 volt device aren't you? And are you using level shifters on the communication pins? Or is it on a module and you don't need to worry about it? Sending 5 volt signals to a 3.3 volt device won't improve it's life expectancy.

I don't know what you mean by being on a module but it's on a thing with pin like this one : http://www.google.fr/imgres?imgurl=http%3A%2F%2F3.imimg.com%2Fdata3%2FCV%2FLA%2FMY-1833510%2Fbluetooth-module-breakout-hc-05-250x250.png&imgrefurl=http%3A%2F%2Fdir.indiamart.com%2Fmumbai%2Fbluetooth-module.html&h=250&w=250&tbnid=Y_8d5kRzZddevM%3A&zoom=1&docid=l27uPLLns4B5NM&ei=9exOU76ADomOO6_BgeAP&tbm=isch&iact=rc&uact=3&dur=232&page=1&start=0&ndsp=19&ved=0CIUBEK0DMA8

You preempted my next question!

No, you can communicate with it using a Mega. You have other hardware serial ports available, use one of those to connect to your module and amend the SerialRelay code as appropriate? (Remove reference to SoftwareSerial, relay the input to one of the other serial ports)

Serial 1: 19 (RX) and 18 (TX); Serial 2: 17 (RX) and 16 (TX); Serial 3: 15 (RX) and 14 (TX).

If you get stuck, post your code!

Why don’t you just use the datasheet ? (see attached)

HC-0305_serial_module_AT_commamd_set_201104_revised.pdf (85.7 KB)

Raschemmel : I’ve looked at the datasheet, the thing I don’t get it when they say “write in the serial” does it mean the serial monitor of Arduino ? Because when I do it it doesn’t work.

Dannable : Ok I’ll try that thanks !

I don't know what page of the manual you are referring to.

Page 2, 2. Step 3

PPEChaptal2013: after watching tons of videos and tutorials, I just can't get it right !

Did you see this one?

http://arduinofy.blogspot.com.au/2013/10/tutorial-programming-hc-05-at-mode-with.html

this guy doesn't mind holding your hand........

Agentnoise on this forum is doing some useful things in this arena (also having a bumpy ride)

Hey !

No I didn’t see this tutorial but I still managed to switch the mode thanks ! =)