HC-05 Bluetooth module (Part 1)

Part 1, 2, 3

Many web pages, posts and topics can be found on the web, however it took me quite some time to gather enough information to have a clear picture about the HC-0x series Bluetooth modules. Although they are outdated by low power BT modules, these modules are still a product of choice for building amazing applications snappy and on the cheap.

Update: Some more work on this type of modules proved that the situation is messier than I thought! In fact the HC-0x modules have been assembled in various manners using various firmware versions which makes the hobbyst’s life a little more complicated.

Anyway, this new series of posts dedicated to these Bluetooth modules, which will explain the way to program them and to use them. This is going to be a progressive approach, so please be patient if you look for the ultimate configuration or code !

Let’s start with some basics. HC-0x modules are easy to use Bluetooth SPP (Serial Port Protocol) modules, designed for transparent wireless serial connection setup. The HC-Ox series consist in a variety of modules as per the description below:

  • Industrial level: HC-03 (Master/Slave), HC-04 (Slave)
  • Civil level: HC-05 (Master/Slave), HC-06 (Slave)

Unless specified, I will deal with the HC-05 module which is the most versatile. Next is an illustration of the module itself, as it can be soldered on a main PCB for its real use (datasheet):

Most of the available assemblies featuring HC-05 and HC-06 modules look like the illustration below. Once again, unless specified, I will deal with the ZS-040 version of these modules fitted with the version 3.0-20170601 for which I found no documentation…

The pinout of the assembly is as follows (and printed at the back of the PCB):

  • State (dir.: out) : module state (3 V digital level). The level of the state goes high when the module is paired. The controller may read this signal is order send data only if the module is paired. You may also wire a LED through a resistor of few hundred ohms. Warning: the pin is inactive on some modules!
  • RXD (dir.: in) : Receive data from the controller (3 V digital level)
  • TXD (dir.: out) : Transmit data to the controller (3 V digital level)
  • GND (dir.: in): Ground
  • VCC (dir.: in): DC voltage (3.6 to 6 V)
  • EN (dir.: in): AT enabling mode (3 V digital level). The enable pin is also known as the key pin. In the case of the ZS-040 module, a high level on this pin has the same effect than pressing the push-button.

The board itself features a push button which enabled the AT mode and a LED which blinks according the module state, as described below:

  • Slow blink (1 Hz): AT mode, or command mode
  • Fast blink (2 Hz): Trying to pair
  • Bursts of two blinks (1Hz): Paired module, ready for communication

Back to the connections: keep in mind that the module can be fed with a DC voltage ranging from 3.6 to 6 V, but the digital pins must comply to a 0-3 V range. This is a pretty well known situation in the world of prototyping as more and more components require less and less power and consequently most often lower supply voltages. Three options can be applied:

The poor man translator using a voltage divider featuring a bridge of two resistors as shown below. This is a cheap solution. However, it draws a significant amount of power and should be use for prototyping only. Note that the TXD signal from the HC-05 is not boosted as a high signal (3.0 V) exceeds the trigger point of the input pin from a 5 V powered micro-controller. The enable pin shall be strapped on purpose to the 3.3 V from the Arduino platform. We will call this reference design the “basic platform” for later use.

The state of the art translator featuring a purpose built chip. Many chips cover the various needs which depend upon the type of communication. In the present case, a general purpose unidirectional translator will do the job, although the proposed TXB104D exceeds the needs as this is a bi-directional translator.

The in-between features popular discrete components. Each channel is fitted with a N-channel general purpose low signal MOSFET biased by two resistors. You may use some cheap of the shelves translator modules.

Next is an illustration of the poor-man’s design featuring a vintage Arduino Diecimila and an early Adafruit shield (Soon both collectors!).

Ultimately, one may want to build a fully versatile platform for programming and using the modules. Next is a suggestion of reference design that will be used in later posts and that we will recall as the “advanced platform”.

This version features a power supply control line which allows a full control of the module by the platform.

Next post on same subject

Leave a Reply

You must be logged in to post a comment.