Some contexts with my project. I am using an Arduino mega combined with a motor shield, to run four motors with Omni-directional wheels. Then I am using two HC-05 Bluetooth modules connected to each other with a series of buttons which control the forward, back, back left, etc. Then I can go from there and add stuff but that's the base idea.
I was testing the modules by getting one of the HC-05 connected to my phone and when I typed '1' and a LED would turn on. That all worked, but now I need to configure one HC-05 as a slave and one as a master.
I entered the module into AT mode by holding the button then powering it on then blinked every 2 seconds like the website said. Next, I uploaded a blank sketch into the Arduino, then entered serial monitor to enter 'AT' (this is a test prompt) which replied with OK. Then I entered 'AT+UART? which it replied with =UART: 9600,0,0, OK then I asked AT+ROLE? which it replied with +ROLE: 0 meaning it was a slave device. Next I told it 'AT+ROLE=1 changing it into a master device.
Now this is my problem, it wouldn't reply with anything. Normally it would say OK, then I could ask AT+ROLE? then would =1 (master) I'm not sure how to fix this and is there something I'm doing wrong or misread. When asked AT+ROLE? it replied which 0 (slave).
I have tried to do some research, but it wasn't very helpful, and I have only found a series of problem with this module.
If you need more detail or photos, just ask, and I'll try to provide you with what you need.
I'm a little confused, so I wire up my HC05 like normal except I move the TX and RX from 0 and 1 to 2 and 3. Then change into AT mode and upload the code to the Arduino, then put in my commands (AT+ROLE=1) as normal. Also, may be a dumb question but are all HC05's ZS-040, will this still work if mine isn't.
And finally, do I need to connect 3.3v to the pin34 like it said in the Martyn Currey page.
Now I've had some extra time to test and follow your tutorial, it still doesn't work. I changed the Rx from 0 to 3 and the Tx from 1 to 2. Next, I uploaded the code and put it in AT mode, by holding down the button and plugging in power. Then put in the commands 'AT' and 'AT+ROLE?', this gave the response OK and +ROLE: 0. Then wrote 'AT+ROLE=1'. No response.
I also tried AT+ORGL, to reset the board still didn't work. Have I done something wrong?
Uploaded: Oct 25 2023
BTserial started at 38400
>AT
OK
>AT+ROLE?
+ROLE:0
>AT+ROLE=1
>AT+ROLE=1
>AT+ROLE?
+ROLE:0
>AT+ORGL
OK
>AT+ROLE=1
Not relevant. If it's an HC-05, it should be configurable as a master, that is what HC-05s do. There are a lot of bodgie HC-05s around, and I guess most eBay stores neither know nor care about what they are selling.
in re "0 and 1 to 3 and 2."
Are you using SoftwareSerial for that?
(A Non-Pro tip: As an aside, they're 'arbitrary', but to keep them straight in my head - since 'R' comes before 'T' in the alphabet, and that's the order in SoftwareSerial, I use a lower number for 'R' than 'T', i.e. 2, 4 or 7,8.)