Arduino Projects

Arduino OTA Over The Air Programming using Bluetooth

Arduino OTA, Uploading code to Arduino through Bluetooth:

Arduino OTA Over The Air Programming using Bluetooth– The easiest method that you are quite familiar with, is uploading the code using a USB Cable. It has limitations; you will need to connect the Arduino with the laptop or computer to upload the code. OTA programming can be quite handy and can save you much time in situations when your Arduino is installed in locations where you have no access. Like for example inside the Car Dashboard, inside the machine cabinet etc, and you need to make some changes to update the code. Opening the Car Dashboard or the machine cabinet may take a lot of time. In situations like these Arduino OTA programming can be a blessing. So, In this tutorial, we will learn something interesting; we will upload code to Arduino through Bluetooth module. We are not using cable connected to the laptop and Arduino; to upload the code instead of using cable we are using HC05 module to upload code to the Arduino. In order to perform this task we will undergo the following steps:

Configuring the HC-05 Bluetooth Module:

 Uploading the code to microcontroller without cable is generally done in the case of small microcontrollers which does not have a UART connection or in case of microcontrollers which are fixed on a PCB. The wireless uploading of a code is known as OTA (Over the air) upload.

When the code is sent to Arduino over Bluetooth (HC-05) it should reprogram the Arduino boot loader. The baud rate at which the Arduino boot loader gets programmed is different for different boards. Some of the boards and their respective baud rates are listed for your quick reference.

Arduino boardBaud Rate
Arduino pro or Pro mini (5 V, 16 MHz) w/ atmega328P57600
Arduino pro or Pro mini (3.3 V, 8 MHz) w/ atmega328P57600
Arduino pro or Pro mini (5 V, 16 MHz) w/ atmega16819200
Arduino pro or Pro mini (3.3 V, 8 MHz) w/ atmega16819200
Arduino Yun57600
Arduino / Genuino Uno115200
Arduino Duemilanover or Diecimila w/ Atmega328p57600
Arduino Duemilanover or Diecimila w/ Atmega16819200
Arduino Nano w/ Atmega328p57600
Arduino Nano w/ Atmega16819200
Arduino / Genuino mega w/ Atmega 2560115200
Arduno mega w/ Atmega 128057600

You see that the baud rate at which Arduino Uno boot loader works is at 115200. So for reprogramming the Arduino Uno boot loader we need to set the baud rate of HC-05 at 115200 baud rate. Now we will configure the HC-05, this is very simple. We will take the HC-05 into AT commands mode and type the following commands for programming Arduino Uno through Bluetooth.

AT+Name= Electronic clinic

AT+UART = 115200, 0, 0

AT + POLAR = 1,0

AT+NAME command is optional which is used to set the name of Bluetooth moduleAT+UART set the baud rate of HC-05. AT+POLAR is used to control the PIO8 and PIO9 pins on HC-05. The above three commands will be used effectively in the AT mode.

Arduino OTA

In order to configure Bluetooth module we will use TTL dongle to be interface with the Bluetooth module such that the RX of HC-05 should be connect with the TX of the TTL and TX of the HC-05 should be connected with the RX of the TTL.

Arduino OTA

The 5V of the TTL should be connected with VCC of the HC-05 and ground of the TTL should be connected with the ground of the HC-05. Now to bring the system in AT mode we will connect the TTL with the laptop or computer. Now in order to set the module in AT mode we will use the software called “Tera term” which is free available software we can download this software from

Now open the tera term software after opening the software select the serial and make sure that the com port is properly selected and click on the OK.

Arduino OTA

Now go to setup and select the Terminal

Arduino OTA

After selecting the terminal a dialog box will appear in which change the transmit  CR to CR+LF and enabled the Local echo.

Arduino OTA

Now again go to setup and click on the serial port

Arduino OTA

After selecting the serial port a dialog box will appear in which we will make several changes we will change the speed to 38400 and click on OK.

Arduino OTA

Now black window will appear in which we will write the AT commands:

First we will write AT and press enter, OK will appear on the screen. Now in order to set the baud rate as we are using Arduino Uno whose baud rate is 115200, so we will write the command:

AT+UART = 115200, 0, 0

Now press enter, Ok will appear on the screen

Now I will write the AT+Polar command and press enter:

AT+POLAR = 1,0

Arduino OTA

Interfacing the Arduino with HC-05 Bluetooth module: 

Now as the Bluetooth module is configured we will connect the HC-05 with the Arduino.

Arduino OTA

Interfacing the HC-05 with Arduino:

Following steps will be required for the connection of Arduino with HC-05:

  1. Connect the Arduino to remote power source not to the PC or laptop
  2. Connect the 5V of the Arduino with the VCC of the HC-05
  3. Connect the ground pin of the Arduino the ground of the HC-05 Bluetooth module
  4. Connect the TXD pin of the HC-05 with the RX pin of the Arduino
  5. Connect the RX of the HC-05 with the TX of the Arduino
  6. Connect the 10 micro farad capacitor such that positive leg of the capacitor will be connected with the state pin of the Bluetooth module and negative leg of the capacitor will be connected with the reset pin of the Arduino.
  7. Connect the positive terminal of the led with the pin number 13 of the Arduino and negative terminal with the ground
  8. Now the circuit is completed

Before we are going upload the code to the Arduino we will first connect the Bluetooth module with the laptop through Bluetooth. Click on the Bluetooth icon and then click on show Bluetooth devices.

Arduino OTA

Then click on the add Bluetooth device

Arduino OTA

After that click on the Bluetooth

Arduino OTA

Now click on the HC-05, Bluetooth module will be paired with the laptop

Arduino OTA

When the Bluetooth module is paired with laptop after that we will upload the code.

Uploading code to the Arduino:

The Arduino is powered with the external power bank and we will upload the code through HC-05 module and this can be used where ever we have complexity.


void setup() {
  // configure LED_BUILTIN as an output
// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  Serial.println("Led is Switched ON");
  delay(1000);              // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
   Serial.println("Led is Switched ON");
  delay(1000);              // wait for a second

In the above code we are blinking led by uploading the code through the Bluetooth module.

Arduino OTA

When the code is uploaded to the Arduino Uno the led will start blinking which will shows us that the code is uploaded and working properly.

Arduino OTA programming is simple and takes a few minutes to set up everything. This can be very useful and it will also keep the laptop away from any damage. I remember when my Arduino had a short circuit and it damaged my laptop USB port. Using the OTA will keep your laptop from such risks.

Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...


  1. Great tutorial. Please clarify, is it a 10 uF or 1uF cap that is used (see step 6). Is the LED between on pin13 necessary ?

  2. Thanks for this clear tutorial. My configuration was an Arduino Nano with Atmega328p and the baud rate for programming is 115200, not 57600. The board.txt file in the Arduino install directory gives the speed to use for any configuration.
    Also to make the programming work, I had to put a resistor in parallel to the 1 uF capa, otherwise the reset pull down was too weak. In my case, I used a 4.7 kOhm resistor which did the trick. It could be fine to update the schematic with such info.

    1. thankyou very much for this information,I have been stucked in this problem, i used to unplug the reset pin but after your everything is working well, deeply than u…

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button