Introduction: Modifying the AT Codes on a HC-05 With the Code ZS-040 Which Has the EN Pin Instead of KEY Pin

Picture of Modifying the AT Codes on a HC-05 With the Code ZS-040 Which Has the EN Pin Instead of KEY Pin

Whilst searching on how to modify the AT settings for the HC-05 it became obvious there were a number of the boards that had different numbers to most of the tutorials I found. The one I will be working with here is the HC-05 with a code of ZS-040. This has a pin called EN instead of the KEY or WAKEUP pins as in other versions of this board. Also a lot of these tutorials say you need to connect pin34 on the board to the VCC (live) by soldering a wire to the board, which in my case was not necessary as I will describe below.

Step 1: Upload an Empty Sketch to Your Arduino

Without the HC-05 Board connected upload this empty sketch to your Arduino, this will allow the boot-loader to be bypassed. THIS IS IMPORTANT


// Empty Sketch

void setup() {
} void loop() { } //End Empty Sketch

Step 2: Wire Your HC-05 to Your Arduino As Follows

Picture of Wire Your HC-05 to Your Arduino As Follows

RX to RXD

TX to TXD

GND to GND

DO NOT CONNECT THE 5V to VCC at this time!!

Step 3: Putting the HC-05 Into AT Mode

Picture of Putting the HC-05 Into AT Mode

Locate the push button as indicated on the HC-05 Board. You will now need to keep the button pressed whilst connecting the 5V to VCC Wire. When the led indicator starts blinking every 2 seconds you are in AT mode and you can release the button.

Step 4: Sending AT Commands to the HC-05 STEP 1

Picture of Sending AT Commands to the HC-05 STEP 1

Open the Arduino IDE Software, goto the TOOLS menu and make sure the Arduino Board you are using is chosen and the correct COM Port is chosen.

Step 5: Sending AT Commands to the HC-05 STEP 2

Picture of Sending AT Commands to the HC-05 STEP 2

In this same TOOLS menu choose Serial Monitor, a new window will open
up, at the bottom of this window you will see 2 boxes, in the left box choose the "BOTH NL & CR" option and in the right box choose the "38400 baud" option. Press the button on the HC-05 board again and keep it pressed whilst typing into the top window "AT" then send, at this point you should get an "OK" appear, this will tell you you have connection to the AT command option of the HC-05 board where you can change the cards baud rate, the pairing password and the ID of the HC-05 Bluetooth device. To change these parameters you will need to keep the button pressed as you type in the command otherwise nothing will happen.

·

To change device name from the default HC-05 to: BLUETOOTH enter: "AT+NAME=BLUETOOTH"

To change default security code from 1234 to 4321 enter: "AT+PSWD=4321"

To change HC-05 baud rate from default 9600 to 115200, 1 stop bit, 0 parity enter: "AT+UART=115200,1,0"

Most useful AT commands are
AT : Check the connection.

AT+NAME : See default name

AT+ADDR : see default address

AT+VERSION : See version

AT+UART : See baudrate

AT+ROLE: See role of bt module(1=master/0=slave)

AT+RESET : Reset and exit AT mode

AT+ORGL : Restore factory settings

AT+PSWD: see default password

Step 6: Finalizing the Procedure

To finalize this procedure you will need to remove power to the HC-05, then swap over the RX and TX wires on the Arduino board.

PLEASE NOTE

You cannot upload sketches whilst the HC-05 board is active, to up load a sketch remove the power to the HC-05 board before uploading.

Comments

lhowell5 (author)2016-01-25

The TX and RX pins on the device are 3.3v. Arduino TX and RX are 5v. You will eventually burn out the board. You need a voltage divider from the arduino's TX pin to reduce the voltage. The RX pin on the arduino will register 3.3v as a high signal so no conversion is needed for that pin

GeoffreyT2 (author)lhowell52016-01-26

I'm happy to concide that point, I have only been trying with arduino
for 7 days so certainly accept I know very little, however it took a lot
of searching to get the device to accept the AT commands and in all the
tutorials but one the instruction was to solder or short the 34 pin to
enable the AT function when it isn't necessary, also it is often
suggested that the device will accept 3.3v to 6v in some of the
tutorials as well as the datasheets and product descriptions for the
HC-05, Take the sound sensors, all the tutorials give the indication
that plug them in and they will do the job when in actual fact they
don't without getting the potentiometer exactly right, which i'm
struggling with

lhowell5 (author)GeoffreyT22016-01-26

I think a lot of confusion comes from the markings on the board since it says both 3.6 - 6v and 3.3v. If you look closely they are both marked, one "Power" the other "Level" but I think this confuses a lot of people, as stated though, the level lines are 3.3v :)

wold630 (author)2016-01-25

This looks really useful. Thanks for posting your very first instructable!

About This Instructable

2,056views

15favorites

Bio: Im a 54 year old Biker, In the last 4 years I have been improving my education as when I left school I had less ... More »
More by GeoffreyT2:Modifying the AT Codes on a HC-05 with the code ZS-040 which has the EN pin instead of KEY pin
Add instructable to: