Things I learned about HC-05 and Arduino

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.
My Terminology
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.)
My Project
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.

2 Likes

Nice Job!

I am book marking this one!

[Mod edit]
Some comments removed.

While it is clearly good practice to use a voltage divider on Bluetooth Rx when using 5v Arduinos, I have never heard of anybody having grief if they don't, and half the diagrams you see on Google don't show it. Nobody has ever drawn the distinction between the modules, so I imagine the same applies to the EGBT-04MS, but there is probably no need to take the risk.

Most Arduinos have very little power available from the 3.3v pin and using it for a Bluetooth module is most probably a bad idea - hence the breakout boards made for 5v supply. There is an HC-05 available on a 3.3v board, but it might not be made for Arduino.

Programming two Blueteeth at once implies the same configuration for both, and further implies some sort of mass production. If that is the case, I can't see that being anything more than connecting Bluetooth to hardware and software serial and sending the commands to both as one shot in setup.

The HC-05 v3 of 2017 may be a fake and the v4 of 2019 almost certainly is.

Thank you for the compliment. If you haven't seen the EGBT-04 Manual it is here https://cdn.instructables.com/ORIG/FQ1/CUVZ/HXA9PUVQ/FQ1CUVZHXA9PUVQ.pdf

It is also listed in several other posts on this forum.
You should be able to see that the EGBT is a smaller circuit board. It gets mounted onto another circuit board, the HC-05, which provides a 6 pin interface scheme, a 3.3V regulator, a reset switch, and other circuitry, which is seen in the schematic of the HC-05. These components are not part of the EGBT module. The EGBT module is a component of many other Bluetooth products with different purposes, for example, all HC-xx products have an EGBT-04xx module included.

Yes, powering the HC-05 from the 3.3 volts on the Arduino is a bad idea. I hope you don't think I was suggecting that. Even if you do that, the outputs of the Arduino are still 5V going to a 3.3V limited input.

My goal is to program 2 HC-05 with one Arduino system and one program. They are programmed to talk to each other, one as slave the other as master, which requires reading the ADDress of each and configuring it into the AT+BIND of the other. The two configurations aren't the same. There is no problem using the SoftwareSerial library for programming since only one HC-05 is communicated with at a time and only half duplex is needed. My issue occured trying to receive bytes from one module which were being tramsmitted by the other at the same time. Overlapping bit timings interfere.

The HC-05 v3 operates correctly and communicates reliably with an HC-05 with v2. The variences of the programming commands are annoying but not show stopping. I wouldn't call it a fake (like a Chinese 1 terabyte memory stick) but more of a knock-off with minor issues. I guess you mean that the v3 software, installed into the memory of the BC417 system on the v3 units, was developed without much regard for matching the original's protocol, not retaining original functionality or adding any enhancements. I agree, pretty lame.

That's what "eGizmos" is calling their HC05 module. I think "HC-05" is the more generic term (available from many vendors.) Thus the "EG" in the part number. I haven't heard anyone else use the EGBT-04 part number as a general module.

I guess OP is clarifying the differences between the core SMT module
image

vs the more arduino-friendly module that includes consolidated pin headers, a 3.3V voltage regulator (and perhaps the voltage divider/etc?)

as well as gathering some additional info. Since most of these modules come without much documentation, I appreciate the additional info...

What the OP is saying is far from clear. A lot of people suffer a bit of grief with these things. I think he is just adding to it.
Untitled

He may actually be alluding to a shield. Indeed, the only time I have seen an EGBT-04 actually specified was on a shield. It was notable in that it was soldered direct to the shield, rather than via a common breakout board, thereby starting a sensible trend. I'm not aware of anybody actually using it, perhaps for good reason, but I thought this thread might be a first.

Great discussion. It's the old component within a component within a component dilemma.
When one refers to the component, which one do they mean?
Calling the EGBT-04 a shield makes some sense since a shield board generally is mounted on a motherboard. But since the HC-05 circuit board is just an interface not a microprocessor, shield is not quite right. The EGBT-04 is more like an integrated circuit (IC), except is isn't integrated down to a single silicon chip, it is integrated to being a surface mount PCB to be mounted on a larger surface mount PCB. Once again the words don't clearly distinguish. We'll just have to use the specific names instead of the generic descriptive names if we want to be clear. They are the HC-05 and the EGBT-04, end of story, no module, no shield, no component, no device, no unit, etc. We don't really need to know the kind of thing we refer to if we know the exact thing we refer to.

Hmmm. Did this leak over into being a philosophy of language thread?

Nick, the left image in your last post is not an HC-05. I don't know whether you found it labed that way or put that label on it, yourself. Either way it just isn't so. westfw shows an HC-05 in their lower image.(labeled SZYTF, ?)
And eGizmo calls their shield an HC-05 and mod1 mounted on it is also called an HC-05. I don't think we can ever have any agreement when both items have the same name.
I agree to disagree.

Folks,
I've done a bit of deleting as some of the language was getting impolite. By all means disagree and disagree strongly but please use polite language, remember the whole world can read what is here.

Thank you.

2 Likes

We need to remember that, as with most other peripherals (that have a interface), the HC-05 and HC-06 have firmwares (code running on their little MCUs, not unlike the code for Arduino themselves)

With the right gear, you can flash the HC-05s and HC-06s with firmwares of your choice. If the hardware is comparable you might even flash them with identical firmwares!


In my case, I am looking to flash a HID-device capable firmware, called "RN42", but there is little to no instructions.
Then I found out that the HC-05 have a physical SPI connection much like the Arduino -- something you will need if you want to flash the firmware. And those aren't broke out on most "shields".

It's quite complicated to get two mcus to talk to each other, especially when you want to deal with things that are not text (e.g. joystick position)


Edit:
This post here explain much of the stuff about HID gamepad.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.