Introduction: Program an Arduino Wireless Over Bluetooth

Picture of Program an Arduino Wireless Over Bluetooth

An Arduino Uno is a really cool piece of hardware to get started with electronics, but one downside to the Arduino is it needs to be plugged into computer using a serial to USB cable each time you want to upload the code. In some projects it would be really handy to program the Arduino wireless, so in this instructable I'm going to show you how to program an Arudino wireless over Bluetooth, so you don't have to carry an extra USB cable again or unplug the Arduino from the project just to upload the new code.

You can also view the video below on how to build this project.


Step 1: Tools and Components

Picture of Tools and Components

Here is a list of the components and tools required, the list is simple and all you need is -

  • Arudino Uno
  • HC05 Blueooth Module
  • PCB
  • Breadboard
  • 2.2K Resistor
  • 1K Resistor
  • 0.1uF Capacitor (code 104)
  • Header Pins
  • Wires
  • Soldering Iron
  • Soldering wire

Step 2: HC05

Picture of HC05

This project uses the HC05 Bluetooth module for communication, this is cheap and easy to find on eBay. Make sure you have the HC05 module and not the HC06, they look the same, but the difference is that the HC05 works as both a master and client but the HC06 works only as a client. This project may not work with the HC06.

If you bought a module with the breakout board make sure it has a key terminal, if it has a Wakeup terminal you will have to solder a wire to the pin 34 which will act as a KEY pin. Then solder the pin 32 of the HC05 we will use this to reset the board each time we upload the code.

Step 3: AT Commands

Picture of AT Commands

Before establishing connection between the Bluetooth module and the PC, we need to upload the code, to the Arduino that puts the HC05 in at command mode. The code can be found bellow

#include <SoftwareSerial.h>

SoftwareSerial BTSerial(10, 11); // RX | TX

void setup()
{
pinMode(9, OUTPUT); // this pin will pull the HC-05 pin 34 (key pin) HIGH to switch module to AT mode
digitalWrite(9, HIGH);
Serial.begin(9600); Serial.println("Enter AT commands:"); BTSerial.begin(38400); // HC-05 default speed in AT command more }

void loop() {

// Keep reading from HC-05 and send to Arduino Serial Monitor if (BTSerial.available()) Serial.write(BTSerial.read());

// Keep reading from Arduino Serial Monitor and send to HC-05 if (Serial.available()) BTSerial.write(Serial.read()); }

Step 4: Circuit

Picture of Circuit

Next we need to connect the arduino at the HC05 to put it into AT Command mode this can be done by setting up the connection as follows

HC05 GND to Arduino GND Pin

HC05 5V to Arduino 5V

HC05 TX to Arduino Digital Pin 10 (soft RX)

HC05 RX to Arduino Digital Pin11 (soft TX)

HC05 Key (PIN 34) to Arduino Digital Pin 9

After setting up the following connection on the breadboard, before connecting the Arduino to the computer, remove the power to HC05 by disconnecting the VCC pin. After you connect the Arduino to a computer you can go ahead and plug the VCC pin back. This would have put your HC05 in AT command mode.

Now open up a serial terminal and enter the following commands, the board will respond with an "OK" each time a command runs successfully

AT+ORGL
AT+ROLE=0
AT+POLAR=1,0 AT+UART=115200,0,0 AT+INIT

.

Step 5: Measuring

Picture of Measuring

Now lets start with building the programming shield, you could add header pins to all the terminals of the Arduino and make a shield for your project but I choose to add header pins required for this project. Plot the pins onto the PCB and solder them.

Next we need to cut out the excess PCB, I used a rotary tool to do this, you could also use a PCB cutter. After cutting the board place the PCB on the Arduino and make sure that everything fits right.

Step 6: Circuit

Picture of Circuit

You can refer to the picture for the circuit, the circuit is quite simple. Now we use the pins 32, VCC, GND, TX, RX of the HC05, we no longer require the KEY pin. The pin 32 of the HC05 is used as a reset pin for the Arduino, because the board resets automatically each time the code is uploaded to the board. There is also a voltage divider part of the circuit as the pin 32 of the HC05 supports 3.3V logic so you should maintain a voltage level of 3.3V.

Step 7: Testing

Picture of Testing

After soldering the components make sure you soldered all the terminals right using a multi-meter. After all the connections are done, you can now plug the programming shield on the Arduino, and connect the Bluetooth module to your computer, the default password is "1234".

Now open up the Arduino IDE and select the blink program (we will use this as the test sketch), select the right com port. You can find the serial port of your module in the device manager if you are using windows. Next hit upload and you should see the HC05 connect to the computer and upload the code to the Arduino.

If everything went well you should have the Arduino on board LED, blink at an interval of 1 sec.

Comments

Anjan Halder (author)2017-08-27

is 2.2k and capacitor shorted?

petefreid (author)2016-10-31

What is the function of pin 32? The datasheet lists it as an I/O pin

syaruls (author)2016-09-25

when this BT disconnects with the smartphone, can the smartphone ring an alarm??

Kira_gelo (author)2016-07-24

is this possible for BLE?

anorehian (author)2016-06-27

So what are the differences between the 05 and the 06?

tomatoskins (author)2016-06-24

I never knew that this was possible! Great project! Thanks for sharing!

geekrex (author)tomatoskins2016-06-24

nice instructables ,thanks for sharing.

pseaton (author)2016-06-24

Two terrific Arduino projects in two days! Really appreciate the great read, and clear instructions. Thanks for sharing!