I was confused but many posts not being clear about what a Bluetooth module is. People call the HC-05 a Bluetooth Module, but the EGBT-04 documentation refers to its module, always, as a ‘Bluetooth Module’. So when people are passing on information about the ‘Bluetooth module’ it is sometimes hard to tell which part is being referred to. Also, often, people pass on information about the EGBT-04 thinking they are describing the HC-05 and vice versus. For example, people say to use a resistor divider, or other 3.3V limiter, on the Rx line. This is definitely true for the EGBT-04 and true for the HC -05 if the HC-05 designer connected the HC-05 Rx pin directly to the EGBT-04 Rx pad. But if the HC-05 designer included a limiter circuit (as the EGBT-04 manual recommends) then one wouldn’t need to include an external limiter. And their documentation would say “No voltage limiting circuit is needed”. And then someone would conclude that all HC-05s need no limiting circuit and they would report that on the forum and insist that everyone else is wrong.
So I will start by defining my word usage that I will use in this post: The EGBT-045MS is a Bluetooth module that is part of an HC-05 Bluetooth device. (You can do it your way in your document, just tell us.)
I am setting up several systems that have 2 Arduinos communicating through 2 HC-05 Bluetooth devices. I am not going to show my code or an image of my board. There are already manu posts and my stuff would just confuse you because it is just a proof of concept. Only the ideas are useful to know
My current project is to build an HC-05 programming tool to configure the 2 HC-05s at the same time on 1 Arduino.
I'm using SoftwareSerial to talk to the HC-05s. I have a DIO output set up to drive the EN/CMD/KEY signals on both HC-05s (with a divider) to enter the AT command mode. Also a DIO to control a PNP transistor to turn on and off the power to the HC-05s.
I'm also creating a python tool to handle all the AT commands programmatically.
Things I have learned:
1) Byte stream anomalies
If the Arduino or Python is slow to send out the LF after the CR, to the HC-05, extra bytes are received, which corrupt responses and overflow buffers.
I found this note that I have seen nowhere else except in the primary documentation for the EGBT-045MS Bluetooth Module, which is the main guts of the HC-05.
Important note: All commands must be terminated by CR LF. If the host controller sends a CR only, EGBT-045MS will repeatedly send a response that will stop only when LF is issued by the host controller.
So, this means that as soon as the EGBT-045MS receives the CR it begins sending the response over and over again with the normal operation of sending a LF immediately after the CR causing it to stop after the first response is sent.
I have seen that any character sent after the CR will stop the stream of responses.
2) HC-05 circuit variety
I've seen HC-05 schematics that show a 10K or 12K resistor as a pull down for the CMD pin 34, on the EGBT-045MS, and a 470 ohm resistor in line with the EN pin, on the HC-05 to pin 34. That would be a 1 to 20 divider, approximately, which would reduce 5.0V down to around 4.75.
On a different module I measured 4.0V on the CMD pin when 5.0v was put to the EN pin of the HC-05. That would indicate a 1 to 4 divider on the board. Apparently some designer thought that was sufficient. I wonder what they read to make them think that.
Then I saw a schematic with EN connected directly to CMD. It seems that every design is different and everyone posts the recommendation that they read for their module as if it was the truth for all modules. Obviously, not so. I recommend ignoring posts that don't give a reference for their advice.
I am giving no advice about what wiring decisions to make. My advice is do your best to find the correct documentation for your module or make direct measurements yourself to find a solution.
Every schematic I have seen shows CMD pin 34 also connected through the RESET pushbutton to the output of the 3.3V regulator on the HC-05 carrier board. My measurements have always shown 3.3V on CMD pin 34 when the button is pushed while powered with 5.0V.
All schematics I have seen and measurements show a direct connection of Rx and Tx from the HC-05 pins to the Bluetooth module pins. Many people say the external 1 to 2 divider is not needed, that 5.0V can be applied directly to those pins. The document says
"EGBT-045MS RX input is not 5V tolerant."
It shows a recommended Schottky diode circuit rather than the commonly mentioned resistor divider circuit. With 3.3V available on the Arduino it wouldn't be hard to use their circuit. I have always used a 1 to 2 resistor divider to reduce risk. In the future I will probably choose a Zener diode circuit.
3 Different AT Behavior in Software Versions
I have experienced version 2.0 and 3.0. I hear there is a 4.0 and assume there was a 1.0
Here is a table of the perplexing differences I have seen.
All of these unnecessary changes made it time consuming to build a parser for commands and responses.
4 SoftwareSerial library issue
Subtitle "One should read the fine print, dummy".
Not only is a SoftwareSerial port half-duplex, if you run 2 SoftwareSerial ports SoftwareSerial is 'quarter duplex'. Trying to use more than one SoftwareSerial channel (Rx or Tx) from any of the ports at the same time, will likely result in byte corruption and dropping.
So one can't send a byte from one SS port to another on the same Arduino, reliably. This didn’t interfere with being able to program one HC-05 at a time, but it makes transmission testing impossible without 2 Arduino Unos, a Due or a Mega, etc., to provide more HardWare serial ports.
I used 2 Arduinos to verify my new HC-05s are good. One storing received characters until a NL and then transmitting them back. The other is talking to the Python App and sending a string and then waiting for the reply. This wasn’t too much trouble but it becomes problematic when I have to change 3 software images to add deeper reliability testing. Also, this testing configuration is not compatible with the ability to set up 2 HC-05s at once.