Upload Codes Wirelessly in Arduino Board With HC05 Module | Updated 2023

by Electrosak in Circuits > Arduino

322 Views, 8 Favorites, 0 Comments

Upload Codes Wirelessly in Arduino Board With HC05 Module | Updated 2023

withou_at_polar.png

Uploading code wirelessly to Arduino was one of the most remarkable things ever. But all hopes crashed recently when the market is filled with fake HC05 chips which no longer support AT+POLAR=1,0. Below article will guide you to overcome this situation.

Supplies

  1. Arduino Uno
  2. HC05
  3. Jumper Wires
  4. USB2Serial converter for configuring HC05 module - https://www.amazon.in/xcluma-FT232Rl-Serial-Adaptor-Arduino/dp/B0714D9NDN/ref=sr_1_3?crid=37PL5EIK4951O&keywords=Ft232&qid=1681117105&s=industrial&sprefix=ft232%2Cindustrial%2C501&sr=1-3

Configure HC05 Module With FTDI Module

Bluetooth_setup_diagram.png
FPXCZLJHX6ARQFU.jpg

To program Arduino wirelessly we have to make sure the baud rate at which Arduino IDE uploads code to Arduino Uno is matching with the baud rate of the HC05 module.



Below are function of pins of HC05.

1.Enable/Key-->

This pin is used to switch between the Data Mode (set low) and AT Command Mode (set high) Before powering-up the module. By default, it’s in Data mode.

2.Vcc -->Powers-up the module. Is connected to +5V Supply voltage

3.Ground--> Ground pin of the module. Is connected to your system’s ground.

4.TX --> Transmits Serial Data. Everything received via Bluetooth will be given out by this pin as serial data to your microcontroller UART receiver.

5.RX -- > Receive Serial Data. Every serial data given to this pin will be sent via Bluetooth.

6.State-->The state pin is connected to an onboard LED, it can be used as feedback to check if the Bluetooth is working properly.


Make connections between HC05 and FTDI adopter as shown in the image, To check the settings of HC05 we have to put HC05 in AT- mode. This can be done by pressing the micro switch on the hc05 module while powering on HC05. You can observe the blink pattern of led on HC05 (2.5 sec on - 2.5 sec off sequence in at mode).

The default baud rate to connect in at mode is 38400. once FTDI is connected as shown connect mini-USB cable from FTDI to Computer, and look for a com port corresponding to the FTDI adapter.

Open serial terminal from Arduino with FTDI com port selected. select baud rate as 38400.

Enter command AT+NAME. You should expect an OK with the name of the Bluetooth module in return for this, if not check connections between FTDI and HC05. ( connections should be crossed ).

Once connections are confirmed and you get an OK from HC05 enter the below commands in Sequence.


AT+ORGL --> To reset HC05 to factory settings

AT+ROLE=0 --> To make it work as a slave

AT+UART=19200,0,0 --> Please check this upload speed for your board in boards,txt or on google.

AT+POLAR=1,0 --> To toggle. outputs a low level and turns on LED, PI09 outputs a high level and indicates a successful connection. If you are able to execute this command successfully please proceed with the connection attached in step 2, if you get an error proceed to step 3.



all commands can be found in below link : https://s3-sa-east-1.amazonaws.com/robocore-lojavirtual/709/HC-05_ATCommandSet.pdf

Connections With Arduino ( If AT +POLAR Command Worked )

with_at_polar.png
POLAR-ERROR.JPG

Connections are pretty simple. connect RX or HC05 to TX of Arduino and TX of HC05 to RX of Arduino. The reset of the Arduino is connected through a capacitor of 100 nf to the state pin of HC05.

How does it work?

The most critical part while uploading code to Arduino is resetting the microcontroller. As you know Arduino is active low. By default when we select the Bluetooth module com port in Arduino while uploading code while making connections state pin goes high for some time. This property of the state pin is connected to PIO9. default values of AT_POLAR is 1,1. But to make Arduino reset we need the inverse operation of this PIO9 which can be done with the AT+POLAR=1,0 command. Once u see uploading on Arduino IDE observe RX-TX led pattern. if they are blinking fast, Congratulations code in uploading through HC05 into your Arduino board.

Connections With Arduino ( If AT +POLAR Command Failed )

withou_at_polar.png

Connections are pretty simple. connect RX or HC05 to TX of Arduino and TX of HC05 to RX of Arduino. The reset of the Arduino is connected through an extra circuit of the transistor as shown in the diagram. both resistors are 5.6 Kohm and the transistor is 2n2222a NPN transistor along with 100nf capacitor,

How does it work?

The most critical part while uploading code to Arduino is resetting the microcontroller. As you know Arduino is active low. By default when we select the Bluetooth module com port in Arduino while uploading code while making connections state pin goes high for some time. This property of the state pin is connected to PIO9. default values of AT_POLAR is 1,1. But to make Arduino reset we need the inverse operation of this PIO9 which can be done with the AT+POLAR=1,0 command.

Since this command failed in this case, we have used a hardware inverter using a transistor as shown in the diagram. Once u see uploading on Arduino IDE observe RX-TX led pattern. if they are blinking fast, Congratulations code in uploading through HC05 into your Arduino board.