Below I would like to present you a brief description of the very popular HC-05master-slave Bluetooth module. It is a module for wireless Bluetooth communication, equipped with a UART interface and support for AT commands.
This module can be used, for example, for wireless two-way communication between a computer and an AVR microprocessor that supports the UART interface. Below I will describe the HC-05 module soldered to the adapter, where we have two ten-pin rows of goldpin pins (2mm raster) and LED1 and LED2 diodes. The dimensions of the board are 26x35x9mm. Power supply for the module 3.3V, range up to 10m, transmission speed 9600bps (sometimes the manufacturer gives the default as 38400, but my default is 9600), the default operation mode - slave, the current consumption measured by me is 42mA. Voltage level for UART communication 3.3V. The pairing password is: 1234. As I did not find the correct description of the adapter pins in the network, and the description from XBee does not match, below I present the pinout of the adapter board made by me:
As you can see, the adapter manufacturer did not give us too much - the goldpin pins only have power, reset and two programmable inputs / outputs. What are the LEDs on the adapter for - both LEDs have their cathodes pulled up to the ground, and the anodes are connected in series through 1k? resistors to the module outputs. LED1 to PIO8, LED2 to PIO9. LED1 shows if the module is paired or not; LED2 lights up when we turn on the terminal for communication on the computer. The prices of the module with shipment start from about PLN 40 on Polish auction portals, while for the purchase directly from China you need to spend less than $ 4 with the shipment. At this point, I would like to thank my colleague Zbyszek, aka Zibi, for providing a computer with built-in Bluetooth for the following tests - thank you, Zbyszek. The first of the tests I performed was pairing the module with the computer, sending a message wirelessly to the module and receiving it on the same terminal - the communication lines from the UART - Rx interface with Tx were shorted on the module, power supply for the 3.3V module. When the module is connected in this way, LED1 will flash quickly. A computer with Windows 10 and the "PuTTY" program was used here. Adding a Bluetooth device is shown below:
As you can see - the device was successfully added.
From now on, LED1 starts blinking less frequently. In the device manager in Windows, we have two new COM ports - in this case COM 4 and COM5.
Run the "PuTTY" program and in the "SESION" category, change the connection type to "SERIAL", enter "COM4" in "SERIAL LINE" and enter 9600 in the "SPEED" window. In the "SAVED SESSIONS" place, enter the name of your choice and press " SAVE ".
The next time we connect, we will be able to load our saved settings by selecting them and pressing "LOAD".
Now we go to the CONNECTION / SERIAL category and here we set our COM port.
Now click the "OPEN" button. LED2 lights up. From now on, everything that we enter in the terminal window will be sent wirelessly to the HC-05 module and will be sent back (thanks to the Rx line short-circuit with Tx) wirelessly to the computer and it will appear in our terminal window. In the terminal window, I typed the text "test hc-05" and that the text was displayed on the computer monitor.
There is no need to press the ENTER key, each time you press a button on the keyboard, the selected character will appear in the terminal window. Disconnecting the jumper connecting Rx with Tx will result in no reaction in the terminal window - we will not see what we press or get a response from the module, even though the module receives what we send to it all the time, after opening the jumper, the module sends nothing, because nothing is sent to the transmitting line.
The second part of the test is sending data wirelessly from one computer to another using the tested module. The distance between the computer and the module is approx. 6 m. In this test, I used a previously replaced computer, the tested HC-05 module and a second computer with Windows XP, to which a USB-UART converter built on the FT232 chip was connected. However, it should be remembered that our tested HC-05 module operates at the voltage level of 3.3V, therefore the jumper should be set to 3.3V on the USB-UART converter. On the second computer, "HyperTerminal" was used as the terminal. Here the converter is detected on the COM25 port, and below we have its settings for the "HyperTermianal" program.
From now on, we can communicate wirelessly between these computers thanks to our HC-05 module. In the "HyperTerminal" program, I turned on local echo in the settings so that what we typed on the keyboard can be seen in the terminal window. The effect of this should be that in the windows of both terminals we should see the same (as long as we transmit from the "HyperTerminal" - in "PuTTY" I did not find an option to enable echo, so we do not see what we enter in the "PuTTY" window . I typed in the "PuTTY" window and on the other computer I received this message in "HyperTerminal" as shown in the image below.
Since communication works one way, communication should work and the other way. To check in the "HyperTerminal" window, I enter the text:
The "PuTTY" window shows exactly what was written in "HyperTerminal" on the other computer.
As evidenced by the above wireless Bluetooth communication using the tested HC-05 module works correctly. Thanks to AT commands support, we can e.g. change the module name, baud rate or e.g. pairing password. To access AT commands, short PIO11 to 3.3V. Pin PIO11 is brought out to the goldpin no.20 pin. When doing the above test, it was not without problems. At the beginning, communication did not go as it should - there were some errors, ie when holding the "a" sign on the keyboard, one terminal kept showing "aaaaaaaaaaaaaa", while the other was receiving something like "azaazaaaazaaaa". The reason turned out to be very simple - I forgot about the common mass for the USB-UART converter and the tested HC-05 module. The converter was powered from the USB and the module from the power supply. Combining the converter and the HC-05 with a common ground solved the problem - the basics, but as you can see - it can mess up quite a bit. If the HC-05 was powered from the USB port, this would not be a problem.
When doing this test with the converter connected to the module for some time in a row, I forgot to switch the jumpers from the voltage level and the voltage was set to 5V, I noticed it after sending several dozen characters, but it did not cause any communication distortions or damage to the HC-05 module. As you can see - it can bear 5V, but better not take the risk and give some voltage converter to go down to the 3.3V recommended by the manufacturer.
When doing this test, when the converter was connected to the module for some time in a row, I forgot to switch the jumpers from the voltage level and they were set to 5V, I noticed it after sending several dozen characters but it did not cause any communication distortions or damage to the HC-05 module. As you can see, it tolerates 5V, but better not to risk it and give some voltage converter to go down to the 3.3V recommended by the manufacturer.
My mother has a Chinese hc-05 connected to a 3D printer for several months - it works with 5V signals and nothing is happening to him, I gave him about 3 USD.
There are at least several versions of the HC-05/06 module (or more precisely the board on which it is installed). Some tolerate only 3.3V (both supply and Rx / Tx), others tolerate 5V (both supply and Rx / Tx), others tolerate 5V on the supply and only 3.3V on Rx / Tx. These last modules, due to their unusual solution, are quite susceptible to bad connection (I had the trouble of having to deal with it and damage such a module). Unfortunately, the tiles for each version are often almost identical and someone who does not know this problem can easily adopt a different version than they actually have. An additional problem is that the descriptions of the sellers are often incomplete or simply incorrect The Xbee modules are so good that the descriptions for them are slightly better, but the price is higher.
I used HC0x series modules and they work quite stably. The range depends on the speed, but 10m is still safe. The speed is not the worst, but the delays - about 20ms breaks need to be done when sending large amounts of data (small buffer, time to prepare frames, etc.). Therefore, I had to do validation and delay adjustment according to errors. The most interesting, however, is that these modules can be FCC certified and probably also "CE" certified.
I use hc-05 and I noticed that if you send some data to it (I send from atmegi644) but the module has no wireless connection to anything, it collects this data in its memory and when wirelessly connected it sends it. I estimated it was around 3-4k bytes. Does anyone know how much this memory has exactly?
I bought a bluetooth HC-05 with 6 pins. It connects nicely with the computer, telephone, but I can not enter AT commands. I've tried all the forums and documentation methods and none work. After pressing the button from the low state, the state goes high to the appropriate pin. Is the purchased module really HC-05?
I have not done such tests. The distance was constant - about 6 meters.
I bought a bluetooth HC-05 with 6 pins. It connects nicely with the computer, telephone, but I can not enter AT commands. I've tried all the forums and documentation methods and none work. After pressing the button from the low state, the state goes high to the appropriate pin. Is the purchased module definitely HC-05?
On PC, I use PuTTY on a Terminal phone. Pairing and communication is fine. I can see the entered values on the computer and receive it accordingly on the phone. The problem is with entering AT commands. After pressing the button before the power supply or during operation, it gives nothing. The state on Pin 34 changes from low to 3.3V. According to the documentation " Mode switch input. If it is input low level, the module is at paired or communication mode. If it's input high level, the module will enter to AT mode. Even though the module is at communication, the module can enter to the AT mode if PIN34 is input high level. Then it will go back to the communication mode if PIN34 is input low level again. "It does not work. The LED on the module always blinks fast no matter how long or when I press the button.
On PC, I use PuTTY on a Terminal phone. Pairing and communication is fine. I can see the entered values on the computer and receive it accordingly on the phone. The problem is with entering AT commands. After pressing the button before the power supply or during operation, it gives nothing. The state on Pin 34 changes from low to 3.3V. According to the documentation " Mode switch input. If it is input low level, the module is at paired or communication mode. If it? S input high level, the module will enter to AT mode. Even though the module is at communication, the module can enter to the AT mode if PIN34 is input high level. Then it will go back to the communication mode if PIN34 is input low level again. "It does not work. The LED on the module always blinks fast no matter how long or when I press the button.
Finally, I found a solution to the problem with accessing AT commands in the module with the help of "grala1" :)
I started trying to connect to the module with "Putty", but the commands did not work in any way. I tried to press the button on the module before turning on the power or during work. Nothing worked. The next program is "hyperterminal". After a few hours, the commands were sent and received. I was able to change the name and the rest of the parameters. On the second day I wanted to reconnect to the module with the same settings, but it failed. Additionally, I have a problem with hyperterminal because after typing the 3rd character the program hangs for a few seconds and after typing the next character the same thing happens, and finally the module does not respond. After downloading "termite 3.3", the module is finally alive I can connect to it without any problem. OK ... but to the details ... My HC-05 is set to 38400 speed by default, 8 data bit, 1 stop bit, no parity. I can get to the AT command at any time before pressing the button on the module before sending the command to the module. Pressing the button before turning on the power or during in my case does not change the communication speed. Of course, the module cannot be connected to any other device. The LED flashing frequency does not change. Below the program settings (After changing the default speed from 38400 to 9600). IMPORTANT: 1) I don't know what the "append CR-LF" means in the program, but without checking this, the commands don't work. I've tried turning on these options in previous programs but it didn't change anything. 2) I wrote above about the communication speed along with the number of stop bits and parity, because you also have to enter these two parameters when changing the speed. By inadvertent, I had a little trouble figuring out why I lost the module after changing the speed ;)