Find your DIY supplies in the Maker Shed → Kits, Books, Components, 3D Printers,
Arduino, Raspberry Pi, More!
Subscribe
Now
Give a Gift
Subscriber
Services
PARTS
HC-05 Bluetooth moduleon a "JY-MCU" 6-pinadapter board (1)R1, Resistor - 2.2k (1)R2, Resistor - 15k or 10k(1)R3, Resistor - 10k (1)
MAKE: PROJECTS
DIY Arduino BluetoothProgramming ShieldBy Joshua Newell Category: Arduino, Electronics Difficulty: Moderate Difficulty: Difficult
If you’ve ever wished you could program your Arduinowithout lugging a USB cable around, wanted to put anArduino project somewhere out-of-reach but still be able toeasily upload changes to it, thought about building a projectthat interfaces with an Android phone, or contemplated away to get remote sensor data streamed to your computer— this project is for you.
It uses a common, low-cost Bluetooth module mounted ontoa prototyping shield for durable and reliable use. Along withthe module is a circuit that allows the Arduino IDE toautomatically reset the Arduino when uploading a newsketch. This project also uses the latest version of theArduino IDE which eliminates the need to hack in modifiedDLL files to get the serial programming to work.
C1, Capacitor - ceramic -100nF (1)Arduino PrototypingShield (1)Female Header (1) Cutthe header down toabout 8 pins. Solder ontothe protoboard for theHC-05 module to pluginto.WireBattery or AC adapter forArduino
TOOLS
Soldering IronSolderFluxDiagonal cuttersBreadboardHot glue gun OptionalComputer runningWindows, with built-inBluetooth or Bluetoothdongle
Besides uploading sketches, the shield can be used forserial communication using the standard Arduino Seriallibrary between multiple Arduinos, smartphones, computers,or even a Bluetooth-enabled Raspberry Pi.
You will need a computer with built-in Bluetooth or a USBBluetooth dongle to use the shield to upload sketches toyour Arduino. These instructions are specific to Windows 7,but should be similar for Windows 8. Mac and Linux userscan probably figure out how to get this working too.Smartphones need to support Serial Port Profile (SPP) towork (this excludes iPhones but includes many Androidphones). This project is moderate to difficult, and requiressoldering and previous prototyping experience.
STEPSPROJECT STEPS1. Install the latest, betaversion of Arduino.
2. Breadboard theBluetooth module setupcircuit.
3. Upload the setup sketch
4. Run the setup sketch andenter serial commands.
Step #1: Install the latest,beta version of Arduino.
5. Setup the Bluetoothmodule in Windows.
6. Setup the Bluetoothmodule in Windows(cont'd).
7. Solder a jumper onto theBluetooth module.
8. Build the programmercircuit.
9. Program the ArduinoWith Bluetooth!
Step #2: Breadboard theBluetooth module setupcircuit.
The current beta version of the Arduino IDE has fixed someof the issues that made Bluetooth programming difficult inthe past. The most current version available today isArduino 1.5.6-r2.
You can download the installer from:http://arduino.cc/en/Main/Software
The Bluetooth module used in this project is the HC-05. It isinexpensive and one of the most common modules you'll see ina lot of other projects. The HC-05 is sold bare or mounted to abreakout board. You want one on a 6-pin breakout board. You
Step #3: Upload the setupsketch
can find them for sale on eBay and Amazon. The datasheet forthe module is here.Using a breadboard, temporarily wire the HC-05 Bluetoothmodule per the schematic.With 3.3v on the Key pin, the module will enter 38400 baudcommand mode and will accept AT commands. The Key pinmust be connected to 3.3v when the module is powered on. If itis connected afterwards, the module will enter command modeat the default baud rate (as set by the 'AT+UART=' command or9600 baud from the factory).
Get the sketch from here and upload it to your Arduino.
Step #4: Run the setupsketch and enter serialcommands.
Open the serial console and make sure the baud rate is set to9600 and line endings is set to be "Both NL & CR"Enter the following AT commands into the serial console.
Step #5: Setup theBluetooth module inWindows.
AT+ORGL
AT+ROLE=0
AT+POLAR=1,0
AT+UART=115200,0,0
AT+INIT
In order, these commands tell the module to reset to factorysettings, switch to slave role (transparent serial bridge), set pin32 low on Bluetooth connection, change baud rate to match theArduino Uno programming rate, and to initialize.Disconnect 3.3v from the Key pin and cycle the power to themodule. It will now be running at 115200 baud and be in pairingmode.
Step #6: Setup theBluetooth module inWindows (cont'd).
From the Control Panel select Add a Device.Add the Bluetooth module.Select enter pairing code option.
Step #7: Solder a jumper
Enter "1234" for the pairing code.At the Add a device success window, click Close.Device ready to use. The OS will create two serial COM portsassociated with the device. Always use the one with the lowernumber.
onto the Bluetooth module.
Step #8: Build theprogrammer circuit.
Disassemble the breadboarded circuit. Solder a jumper wiredirectly to the HC-05's Pin 32.Don't forget to use flux.You may want to use hot glue or tape to protect the joint.
Step #9: Program theArduino With Bluetooth!
Build the programmer circuit onto the prototyping shield.Solder on a female header for the Bluetooth module if you wantto be able to easily remove it later.
Power on the Arduino from a battery or AC adapter.In the Arduino IDE, choose the serial port of the Bluetoothmodule (the lower valued one of the two) and then upload asketch like normal.
JOSHUA NEWELL
Joshua Newell is a software developer byday, and an electronics and embeddedsystems enthusiast by night.
Website
Comments Community Login1
Sort by Best
Join the discussion…
• Reply •
Sidhant • a year ago
Is it possible to program the Arduino Mega with the sameprocedure.
5
• Reply •
Guest • 4 months ago> Sidhant
Yes
• Reply •
Marijn • 3 months ago
Is it possible to program just the atmel328p chip with thisprocedure?
1
• Reply •
Alexandre Terentiev • 4 days ago> Marijn
Yes if the 328 is loaded with the Arduino bootloader.
Sujeet Banerjee • a month ago
GOT IT WORKING IN SECOND ATTEMPT!
Recommend
Share ›
Share ›
Share ›
Share ›
• Reply •
GOT IT WORKING IN SECOND ATTEMPT!
Baudrate set using AT+UART is a critical piece (Step 4), whichif done incorrectly will lead to avrdude: stk500_getsync(). Thebaudrate somehow depends on the Arduino/Processor.
Arduino Uno: AT+UART=115200,0,0Pro Mini: AT+UART=57600,0,0
In case you hit, stk500_getsync() while sketch upload viabluetooth, Check out how the Arduino Software loads it using aUSB/FTDI. Go to preferences and turn ON verbose mode forcompile and upload. This will show you what baudrate isexpected for a particular make.
And, after lots of experimenting I found out, the levelshifresistors', capacitor values are really not rigid. Just ensure thatthe resistor to ground should be at least 1.5 times of the one toVcc.
• Reply •
Guest • 3 months ago
I followed every step, but cant upload sketches. It says thatCOMport is in use.
Also when I check devices in configurationscreen. It saysbluetooth disconnected.
• Reply •
keven • 5 months ago
You can buy Bluetooth shields, Bluetoothduino, Bluetoothadatper here: http://www.elecfreaks.com/stor...
techietav • 5 months ago
Thanks for this info.. I used a HC06 and soldered a wire to the
Share ›
Share ›
Share ›
• Reply •
Thanks for this info.. I used a HC06 and soldered a wire to theSTATE header (which did not have a pin) It doesn't work on theHC06 as there is only the STATE which pulses whiledisconnected in AT mode and then stays on when connected.Tried creating a simple circuit using a low pass filter to smooththe pulses and then a NPN transistor to pull the RST low, thisworks, but holds it low the whole time connected. Might have toget a HC05 instead..
• Reply •
Guest • 4 months ago> techietav
It does work on the HC06 don't use the 'state' pin, butfollow the instructions and solder to the Pin34 of the HCmodule.
• Reply •
techietav • 4 months ago> Guest
Tried that, but the pin doesn't stay low whenconnected as the module doesn't accept thePOLAR command to invert the pin 34 state. Itgoes high which is the default.
• Reply •
Guest • 4 months ago> techietav
FWIW, I just checked my 'good' HC
at+version
+VERSION:2.020100601
Guest • 4 months ago> techietav
PS I have a module where the 'state' pinis actually tied to PIO2 pin25. You neverknow until you find a supplier that gives
Share ›
Share ›
Share ›
Share ›
• Reply •
know until you find a supplier that givesyou a consistent product that you cantrust.
• Reply •
Guest • 4 months ago> techietav
What exact module do you have?
The 'Hc05' and 'HC06' designations areloosely attributed by every variousChinese assembler with access to afirmware tool. In reality, HC05 and HC06are model numbers of Linvar Ltd. I'veseen about three or four differentfirmwares with variations on the ATcommand set. I have 10 with the mostawful limited firmware that I will be reflashing as soon as I have the correcttool. The command set on that is limited tosetting the UART and password.
If it was an actual 05 or 06, it wouldaccept the POLAR command. Maybe itwas based on another chip other than theCSRBC417 chipset?
• Reply •
Mikolaj.K • a month ago> Guest
Hey, I have a problem 'cause AT onArduino doesn't working. Noneconfirmations from Ardu.
Sarchasm • a month ago> Mikolaj.K
Not enough information to answer that
Share ›
Share ›
Share ›
• Reply •
Not enough information to answer that
• Reply •
Mikolaj.K • a month ago> Sarchasm
I don't know what is important.
Sarchasm • a month ago> Mikolaj.K
What have you done so far? What kind ofArduino board are you using? Whatconnections have you made? What areyou using to connect to the Arduino? Doyou get any sort of indication that you areconnected correctly?
Simply: If you follow the instructionsabove to the letter, it works so workthrough the instructions one step at a timeand make a note of what works whenyou reach a step that doesn't work come back and tell us what is wrong.
There are two distinct stages of gettingthis to work. The first step is to set up theArduino to talk to the BT module so youcan program it.
That includes loading a sketch that setsup the serial pins, wiring up those pins tothe BT module, powering the pin on theBT module to set it in command mode,connecting your PC to the Arduino toconnect to the BT module in commandmode.
Share ›
Share ›
• Reply •
Once the BT module is programmedcorrectly, you have to wire it up to act asthe programming interface, using serialpins 0 and 1 (1&2, depending on how younumber them).
• Reply •
techietav • 5 months ago> techietav
An update to say after trying unsuccessfully to flash aHC06 with HC05 firmware (which is possible). I boughta HC05 connected up as per instructions and it worksperfectly! THANKS
• Reply •
Guest • 4 months ago> techietav
What did you use to try to reflash the HC06?
• Reply •
Joshua Newell • 3 months ago
> Guest
have you seen this?https://github.com/lorf/csrsp...
1
• Reply •
Guest • 2 months ago
> Joshua Newell
No, I haven't but thanks that looks likeexactly what I need!
Thanks Joshua!
Aidas Zarskus • 6 months ago
Spent 2 evenings trying to replicate no luck.Have perfectly operational and setup per instructions HC05
Share ›
Share ›
Share ›
Share ›
Share ›
• Reply •
Have perfectly operational and setup per instructions HC05Get connection (slow blink) when sending sketch to the boardBut it is either "programmer not responding", or "not in synch"errorsAt some point was able to upload sketches 2 times in a row(miracle!), but had to unplug the ground resistor (15k) to getboard running, as it would remain in reset mode, I believe.Tried different values of divider bridge, and capacitor, to noavail.Anybody else have it working reliably?
• Reply •
Claudio Aguila • 2 months ago> Aidas Zarskus
Same problem. The error mesage is "avrdude:stk500_getsync()...."
Guest • 4 months ago> Aidas Zarskus
Yes, it works, as described in the instructions, perfectly.
The trick is to follow the instructions to the letter don'ttry and take any short cuts.
I was getting nowhere until I started talking it over withsomeone else and he pointed out a few things I wasmissing... my enthusiasm overriding my ability to read, itseems :)
In essence, there are two distinct phases to making thiswork: The 'programming the bluetooth module' phase where you wire it up and load the sketch that allows youto configure the BT module in command mode. Thenthere's the 'loading the sketch over bluetooth' mode,where you rewire your circuit for programming over BT.
In my case, the 'gotcha' was not noticing that after the
Share ›
Share ›
• Reply •
In my case, the 'gotcha' was not noticing that after thefirst phase, you had to move the TX and RX from thepins used to setup the bluetooth module to pins 0 & 1 ofthe hardware UART used to program the sketchwirelessly. You have to wire the BT module to pins 0 and1 for it to work the bootloader is expecting to syncusing the hardware UART.
I also didn't have all of the components needed, like therating of resistors and 100 picofarad capacitor in thediagram, but I substituted 3.3kohm and 5.1kohmresistors and a 220 picofarad electrolytic and it stillworked, so the circuit is forgiving.
I have loaded everything from 'blink' to the full 30k ofArdupilot over BT reliably.
• Reply •
Joshua Newell • 3 months ago> Guest
Thanks for helping people out here!
• Reply •
Guest • 3 months ago
> Joshua Newell
Thank you! You did all the heavy lifting, Ijust had to RTFM :)
• Reply •
ammy • 5 months ago> Aidas Zarskus
some time ago I was trying to look for out how toprogram the arduino wirelessly, I have found thishttps://play.google.com/store/..., maybe this can help.
Jian Li • 7 months ago
Share ›
Share ›
Share ›
Share ›
• Reply •
Jian Li • 7 months ago
the bluetooth module is always paired to the computer as abluetooth device and is not assigned a port. How do i assign it toa port?
• Reply •
Markus Eglin • 7 months ago
I had to use Baud rate of 57600 to program with Arduino 1.5.7and Seeeduino.With the Baud rate 115200 it didn't work.
• Reply •
Guest • 4 months ago> Markus Eglin
Correct the default for the 328Pbased Arduino's is57600, I believe.
• Reply •
Brian Impellizzeri • 8 months ago
Thanks a bunch for this page I connected the 3.3vpin and keypin together and removed the level shifting resistors and finallygot at commands on HC06!
• Reply •
Biplab Roy • 8 months ago
Thanks for the Project. I have two questions.1. Do I need 2 ATMEGA328 chips? one in the BT programmingshield & the other one is TARGET chip?2. Why the KEY pin is shorted & disconnected? What is theneed of connecting & disconnecting the KEY pin with 3v3 pin?Any help shall be appreciated.
Joshua Newell • 7 months ago> Biplab Roy
1. no
Share ›
Share ›
Share ›
Share ›
Share ›
• Reply •
1. no2. shorted=command mode, floating=transparent relaymode
• Reply •
Fernando Mattoso Lemos • 9 months ago
How to configure HC05 to program Arduino Leonardo viabluetooth ?
• Reply •
gugus • 10 months ago
Hello, I would like to know if this is safe, can the arduino bedamaged (unable to upload new sketches) in case there areinterferences while uploading (missing or corrupted data) ? Inthe Arduino IDE there is option "Check code after upload", Isuppose this might help detect upload errors, but does it workwith BT? Thanks ;)
Joseph • a year ago
Also, I didn't need to solder a jumper wire to the HC05. I just
Share ›
Share ›
Share ›