Master / Slave Bluetooth Module (HC-05)
Master / Slave Bluetooth Module (HC-05)
This module is described as " a serial communications port (default is 9600 baud) over a Bluetooth wireless connection with no software configuration". As a hardware engineer I equate that to a UART. I've tried talking to it with a terminal app in my phone but it doesn't show any activity. I don't want to use an Arduino - just some logic that I wish to control. The slave mode seems perfect. I don't really even need two-way comms - just receive. The support info. on the website jumps straight into AT commands and Arduino code. How do I use it without software, please?
Re: Master / Slave Bluetooth Module (HC-05)
By default, the module operates in slave mode. Here's the steps you'll need to do to get your phone to connect to it:
Initial Setup
1. Powering On:
When you connect power to the module for the first time, it will automatically enter pairing mode. The LEDs will flash to indicate this.
2. Pairing with Your Phone:
- On your phone, search for and pair with a new Bluetooth device.
- The module should appear in the list of available devices.
- Select the module, and when prompted, enter the code 1234 to pair.
Note: At this stage, the device is paired with your phone but not yet connected, so the LEDs will continue flashing.
Connecting to the Module
To communicate with the module, you’ll need a Bluetooth-compatible terminal app installed on your phone.
- For Android: You can use the app Serial Bluetooth Terminal.
1. Open the app, select the Bluetooth module, and connect to it.
2. Once connected, the LEDs on the module will change from a quick flash to a slow double flash, indicating a successful connection.
Communication
While connected, anything you type into the terminal app will be transmitted to the module's serial header Tx pin at a baud rate of 9600.
Initial Setup
1. Powering On:
When you connect power to the module for the first time, it will automatically enter pairing mode. The LEDs will flash to indicate this.
2. Pairing with Your Phone:
- On your phone, search for and pair with a new Bluetooth device.
- The module should appear in the list of available devices.
- Select the module, and when prompted, enter the code 1234 to pair.
Note: At this stage, the device is paired with your phone but not yet connected, so the LEDs will continue flashing.
Connecting to the Module
To communicate with the module, you’ll need a Bluetooth-compatible terminal app installed on your phone.
- For Android: You can use the app Serial Bluetooth Terminal.
1. Open the app, select the Bluetooth module, and connect to it.
2. Once connected, the LEDs on the module will change from a quick flash to a slow double flash, indicating a successful connection.
Communication
While connected, anything you type into the terminal app will be transmitted to the module's serial header Tx pin at a baud rate of 9600.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.
Re: Master / Slave Bluetooth Module (HC-05)
Thank you, Andrew, I'll try that tomorrow.
Re: Master / Slave Bluetooth Module (HC-05)
One more thing: will the device remember the pairing when powered down? If not, I presume we repeat the process. If yes, how do I change the pairing later?
Re: Master / Slave Bluetooth Module (HC-05)
Yes it will. After powering up the module you can just reconnect via your terminal app.One more thing: will the device remember the pairing when powered down?
To remove the pairing you'll have to put the module into command mode and issue an AT command via the serial header. Note, BAUD rate in command mode is 38400, not 9600. Information on how to put it into command mode can be found in the first post of its product thread under 'How to put the module into command mode':If yes, how do I change the pairing later?
viewtopic.php?f=74&t=1567
Issuing an AT+RMAAD will remove all previously paired devices.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.
Re: Master / Slave Bluetooth Module (HC-05)
Thank yuou Andrew. Just to be clear, can the commands to clear the pairing come from the phone terminal app or must they come from the module TXD pin?
Re: Master / Slave Bluetooth Module (HC-05)
AFAIK, the only way it can be done is via the serial interface (Tx & Rx pins) whilst the module is in command mode.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.
Re: Master / Slave Bluetooth Module (HC-05)
Thank you Andrew. I'm still waiting for an opportunity to try out my unit again...
Can you tell me whether the module itself cares about parity, and whether all characters are 8 bits?
Way back when I worked on GPO 1200 bps modem type data comms, teletypes, and what were once called VDUs or terminals, everything textual was 7 bit ASCII plus I think odd parity, and binary data was 8 bits but usually protected by block CRC codes. These memories may be less than helpful in the present situation!
There is another unexpected thing: in my memory TXD refers to outgoing data for transmission, which is sent (input) to the sending modem/uart, and RXD is received data, from the receiving modem/uart output. It appears to be the opposite on this module's pinout (I understand your saying that the TXD output is data received from a transmitting device). Can you clarify, please?
Sorry for all the questions - a more comprehensive module (or is that Bluetooth) description/specification would be nice.
Kind regards,
David
Can you tell me whether the module itself cares about parity, and whether all characters are 8 bits?
Way back when I worked on GPO 1200 bps modem type data comms, teletypes, and what were once called VDUs or terminals, everything textual was 7 bit ASCII plus I think odd parity, and binary data was 8 bits but usually protected by block CRC codes. These memories may be less than helpful in the present situation!
There is another unexpected thing: in my memory TXD refers to outgoing data for transmission, which is sent (input) to the sending modem/uart, and RXD is received data, from the receiving modem/uart output. It appears to be the opposite on this module's pinout (I understand your saying that the TXD output is data received from a transmitting device). Can you clarify, please?
Sorry for all the questions - a more comprehensive module (or is that Bluetooth) description/specification would be nice.
Kind regards,
David
Re: Master / Slave Bluetooth Module (HC-05)
Yes it's 8 bits, one stop bit, no parity. That's pretty much the standard for most things nowadays.Can you tell me whether the module itself cares about parity, and whether all characters are 8 bits?
I'm going to take a guess that you used to use a PDP-11?Way back when I worked on GPO 1200 bps modem type data comms, teletypes, and what were once called VDUs or terminals, everything textual was 7 bit ASCII plus I think odd parity, and binary data was 8 bits but usually protected by block CRC codes. These memories may be less than helpful in the present situation!
I'll get the information in this thread added to an FAQ in the product thread ASAP.Sorry for all the questions - a more comprehensive module (or is that Bluetooth) description/specification would be nice.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.
Re: Master / Slave Bluetooth Module (HC-05)
Close, Andrew - it was a PDP-8, during my first job out of university, where I was responsible for the design of a hardware interface betweel an Elliot hight speed paper tape reader and a General Automation SPC-16 minicomputer, part of a Post Office modem-based data transmission system aimed at industry, employing CRC error detection and retransmission protocols. My final degree year project had been the design and fabrication of a hardware real time clock for a Ferranti FM1600B minicomputer. I watched all the now-familiar (and some obselete) logic families, technologies, silicon devices and design tools arrive one by one... [exit reminiscing mode here]
OK I now have the HC-05 paired with my Galaxy A53 5G, and sending and getting talkback (by linking TXD and RXD) with Serial Bluetooth Terminal 1.48. My 'scope confirms 1 start bit, 8 data bits, no parity, and 1 stop bit, with the polarity you would expect from an inverting RS232 receiver (high = mark = logic "1"). It works!
The range seems very low, but that may be due to all the metal in my workshop. Presumably it's very line-of-sight. Given I have that, what kind of range should I be seeing?
It's probably obvious, which is why is isn't explicitly stated, but I think the AT commands are only for one's own modem - not the modem at the other end of the link. This is consistent with the higher data rate. Also I assume AT commands cannot be embedded in normal comms data - the AT mode has to be entered and exited so that the appropriate baud rate is selected.
There also appears to be, in BT 2.0, a sleep mode, which would be useful if it reduced the longterm ~10mA consumption. Is the sleep/wake protocol handled internally by the HC-05, or does it require the user to generate the required messages and responses?
More apologies...
Kind regards,
David
OK I now have the HC-05 paired with my Galaxy A53 5G, and sending and getting talkback (by linking TXD and RXD) with Serial Bluetooth Terminal 1.48. My 'scope confirms 1 start bit, 8 data bits, no parity, and 1 stop bit, with the polarity you would expect from an inverting RS232 receiver (high = mark = logic "1"). It works!
The range seems very low, but that may be due to all the metal in my workshop. Presumably it's very line-of-sight. Given I have that, what kind of range should I be seeing?
It's probably obvious, which is why is isn't explicitly stated, but I think the AT commands are only for one's own modem - not the modem at the other end of the link. This is consistent with the higher data rate. Also I assume AT commands cannot be embedded in normal comms data - the AT mode has to be entered and exited so that the appropriate baud rate is selected.
There also appears to be, in BT 2.0, a sleep mode, which would be useful if it reduced the longterm ~10mA consumption. Is the sleep/wake protocol handled internally by the HC-05, or does it require the user to generate the required messages and responses?
More apologies...
Kind regards,
David