Introduction: 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
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
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
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
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.