Arduino with HC-05 (ZS-040) Bluetooth module – AT MODE

Update 20.07.2017

The zs-040 breakout boards are now being used for many different modules and you may not have the exact same boards as those shown below. The modules I am using here use the EGBT-045MS Bluetooth module and have the HC/Wavesen 2.0-20100601 firmware. They also have an EN pin rather than a KEY pin and they have a small button switch just above the EN pin.

There are now newer zs-050 modules that use the real HC SMD modules, these have a newer firmware and include a blue LED at the top right of the SMD daughter board.

There are also modules that use the same breakout board but have different board markings such as the fc-114 modules:
HC-05 FC-114 and HC-06 FC-114. First Look
HC-05 FC-114 and HC-06 FC-114. Part 2 – Basic AT commands
HC-05 FC-114 and HC-06 FC-114. Part 3 – Master Mode and Auto Connect

 

AT Command Mode

AT command mode allows you to interrogate the Bluetooth module and to change some of the settings; things like the name, the baud rate, whether or not it operates in slave mode or master mode.
When used as a master device AT commands allow you to connect to other Bluetooth slave devices.

The HC/Wavesen 2.0-20100601 firmware has different AT modes:
A full mode at 38400 baud.
A partial mode at 38400 baud.
A partial mode at the user settable baud rate.
A partial mini mode (even less commands work) at the user settable baud rate.

Most commands work when in any AT command mode but there are some commands that only work when pin34 is HIGH. This fooled me for quite a while. I now believe the partial/mini AT command mode is a bug in the firmware and I now only recommend using the full 38400 baud rate AT command mode.

HC-05 zs-040

To activate AT mode on the HC-05 zs-040 modules pin 34 needs to be HIGH on power up. The small push button switch connects pin 34 to +3.3v so we can either:
– connect pin 34 directly to +3v3v and power on, or
– hold the button switch closed when starting the module.

Please be aware that for the full AT command mode, pin 34 has to be HIGH all the time and we cannot do this with just the button switch. When in AT command mode with pin 34 not HIGH (LOW or floating) some commands will not work and so, when using the button switch, you need to press and hold it closed when sending some commands.

Using the button switch to enter AT command mode using 38400 baud rate:
– 1. remove power from the module
– 2. Hold the small button switch closed while powering on the module.
– 3. Press and hold the button switch.
– 4. While still holding the button switch closed, apply power.
– 5. When you see the LED come on you can release the button switch.

Enters AT mode with the built in AT mode baud rate of 38400. The baud rate cannot be changed by the user.
This method allows the module to enter AT mode on start but but does not keep pin 34 HIGH and some commands will not work.

Alternatively, if you are using AT command mode for any length of time, make a direct connection between pin 34 and +3.3v. Either solder a wire to the pin or use a clip.
HC-05_AT_MODE_02_BreadBoard_ClipCloseup_01_1200

Using pin 34 to enter full AT command mode using 38400 baud rate.
– 1. Remove power from the module
– 2. Make a connection between pin 34 and +3.3v
– 3. Reapply power.

Enters AT mode with the built in AT mode baud rate of 38400. The baud rate cannot be changed by the user.
If you keep pin 34 HIGH you will enable the “full” AT mode which allows all AT commands to be used.
If you let pin 34 return LOW after power on then “mini” AT mode will be enabled.

Continue reading