How to Upload Sketches to Pro Micro/Leonardo Via Serial Bluetooth

by dmjlambert in Circuits > Arduino

28250 Views, 32 Favorites, 0 Comments

How to Upload Sketches to Pro Micro/Leonardo Via Serial Bluetooth

1.jpg

Using Optiboot bootloader with ATmega32U4-based Arduino to upload sketches via hardware UART and Bluetooth module instead of USB

Expanding on the instructions from Make here:
http://makezine.com/projects/diy-arduino-bluetooth-programming-shield/

Let's use this method to program a Pro Micro wirelessly. We can program it wirelessly by changing the bootloader from Caterina to Optiboot, making the Pro Micro very similar to a Pro Mini. Minor differences include the Pro Micro has a little more memory, the built-in USB port, and the UART serial port is UART1 instead of UART0 as on the Mini.

A Pro Micro is essentially a miniature Leonardo, so you can use the same procedure for Leonardo. The Leonardo has the ICSP pins broken out to the ICSP header instead of pins numbered 14, 15, and 16 like the Pro Micro has, so you need to account for that to prepare the Leonardo.

Note: this Instructable updated 2015-08-22, to use my ATmega32U4 compatible fork of Optiboot.

​Preparing the Bluetooth Transceiver for Use by Arduino

b.jpg
a.jpg

There are different versions of HC-05 Bluetooth transceivers available. The different versions break out the RX and TX and some other pins from the HC-05 stamp-shaped module to header pins. One of the header pins accepts an input VCC voltage between 3.6 and 6 volts and sends the voltage through an on-board regulator, which supplies 3.3 V to the HC-05 on pin 12. The most common one on eBay right now (May 2015) has a Key pushbutton switch to put it in programming mode.

The transceiver in the Make guide does not have the State pin available on the header, so the instructions in the Make article have you solder a wire to pin 32 to get the State.

This transceiver from the Make article also does not have a Key pushbutton switch to put it in programming mode. Instead, the 3.3 V regulator output and they Key pin are on the header, and you temporarily connect the Key pin to 3.3 volts to put it in programming mode.

Another type of transceiver I have seen has the Key pin on the header, but does not have 3.3 V on the header. To program that one, you will need to supply 3.3 V to the Key pin using a method of your choice.

You could:

  1. use the 3.3 V pin on the Arduino (if you have an Arduino that has a 3.3 V pin).
  2. use two resistors as a voltage divider to produce 3.3 V from 5 V. Article about voltage dividers: https://learn.sparkfun.com/tutorials/voltage-dividers
  3. solder a wire to the HC-05 module pin 12 like I have done (for purposes outside of the scope of this article).

Most of the different backboards I have seen for the HC-05 have a built-in 3.3 V regulator connected between the VCC header pin and pin 12 of the HC-05 module. Soldering the wire to pin 12 of the HC-05 is my favorite method, because I may have other uses in my projects for a small 3.3 V regulated power source.

The various boards have this in common: Hold the key button depressed, or keep the key pin connected to 3.3 V, while powering up the Bluetooth transceiver in order to put it in programming mode. Once it is powered up for a couple of seconds, you can release the button. This part of the procedure is discussed in the next step, after uploading a programming sketch to an Arduino and wiring the transceiver.

Sidebar: Another thing the various boards have in common is all of the pins presented on the header for input and output are 3.3 V logic level. In theory, they should not be used with 5 V logic levels. On most of the pins they include an in-series resistor on board that some believe provides a limited amount of 5 V tolerance, and there is also some discussion on the web about older produced versions of the chips on the module were known to be 5 V tolerant. In practical use, you may or may not decide to treat the header pins as 5 V tolerant. It depends on how reliable and long-lasting you need your project to be, and weigh the risks and troubles and the price of the tranceiver, and make a decision.
The Bluetooth transceiver 3.3 V logic level outputs such as the TX pin and State pin from the module are most likely going to be high enough to be considered readable by a 5 V Arduino RX input pin, if your wires are short and the environment is not noisy, so you may not need level conversion for the signals traveling from the transceiver to the Arduino. If you do find you need or want level conversion, you can use a transistor circuit or level converter module. Going the other direction from a 5 V Arduino to transceiver, you just need to consider the RX pin of the transceiver, and the Enable pin if you have a need to use it. It would probably be best practice to use a voltage divider for the input pins, and there is very little reason to skip doing that and wire directly, considering the small cost of a couple of resistors.

I am using 5V Pro Micros. If you use 3.3V Pro Micros, the voltage divider would not be necessary. If your Pro Micro runs at 8MHz you will need to compile Optiboot to run at 8MHz and I believe that would involve editing the Makefile.extras line "atmega32u4: AVR_FREQ ?= 16000000L" to change the frequency, when you come to the compiling Optiboot step.

This Instructable covers using a Bluetooth transceiver that has the 3.3 V regulator onboard. Recently, I have seen on eBay some boards that are shorter than most, and you can tell from the pictures there no circuitry between the HC-05 stamp-shaped module and the header pins. If there is no circuitry on the back of the board, these are the ones that do not have the 3.3 V regulator onboard. Ask questions of the seller if you are not sure, including asking for photos of the back side of the board if it is not shown in the listing. For boards with no regulator it is common for the description in the listing says the supply voltage is 3.3 to 6 V, that is outright incorrect. If you use one of these, you will need to supply it 3.3 V instead of 5 V.

Programming the Bluetooth Transceiver

4.jpg
5.jpg

In the procedure below, we will use an AT command to program the State signal to go low when the computer starts a serial connection via Bluetooth. Use other AT commands to set the baud rate, name, and pairing code. These settings are made via the serial port when we put the transceiver in programming mode. The transceiver remembers the setup, so you will not need to re-program it unless you want to change the baud rate or other settings.

Use the sketch from the Make article to program the transceiver using an Arduino. I have modified the sketch a little because we are using a Pro Micro to program it and we don't need to use software serial, we can just use Serial1, which is the hardware UART.

/* Serial Loop */

char myChar ;

void setup() {
  Serial.begin(9600);   
  Serial.println("AT");
  Serial1.begin(38400);
  Serial1.println("AT");
}
void loop() {
  while (Serial1.available()) {
    myChar = Serial1.read();
    Serial.print(myChar);
  }
  while (Serial.available()) {
    myChar = Serial.read();
    Serial.print(myChar); //echo
    Serial1.print(myChar);
  }
}

Upload the sketch to the Arduino, then disconnect the Arduino from the computer to remove power.

  • Connect pin RX of the Arduino to the TX pin of the transceiver.
  • Connect pin TX of the Arduino through a voltage divider to the RX pin of the transceiver.
  • Connect VCC or 5V of the Arduino to the VCC or 5.0 pin of the transceiver.
  • Connect GND of the Arduino to the GND pin of the transceiver.

If you have the type of transceiver from the Make article with the Key and 3.3 V pins on the header, connect the Key and 3.3 V pins together. If you have the transceiver with the button, hold the button down. Connect the Arduino to the computer to power it up. After power up you can release the button.

Open the Serial Monitor window. Set the Line Ending to Both NL & CR and baud rate to 9600. Enter AT on the send line and click Send. You can enter AT commands in lower or upper case. You should see an OK response in the Serial Monitor. It is alright if the response you see to the first AT command you enter is ERROR. Just enter AT again and it should then respond OK. Enter these commands and see the responses:

at
OK
at+orgl
OK
at+role=0
OK
at+polar=1,0
OK
at+uart=57600,0,0
OK
at+name=Arduino
OK
at+pswd=1234
OK

Close the Serial Monitor window and disconnect the Arduino to remove power. If you have the type of transceiver from the Make article with the Key and 3.3 V pins on the header, disconnect the wire between the Key and 3.3 V pins. Connect the Arduino to the computer to power it up. Go into your System Preferences or Control Panel on your computer and pair the Bluetooth transceiver with your computer using the password you programmed into the transceiver as the pairing code.

Your Bluetooth transceiver is now prepared for use with Arduino. I have programmed mine for baud rate 57600. If you prefer a different baud rate, follow the same procedure above, except change the at+uart command to program your preferred baud rate. The transceiver name Arduino shown above is an example. You can name it whatever you wish. You can also program it with whatever pairing code you wish.

About Optiboot for the ATmega32U4 Processor

There are situations where I want to upload sketches to a Pro Micro via regular serial instead of USB. I have noticed some others on the web are also interested, but I did not find any answers or resolutions. The reason I want to do this is to upload sketches via Bluetooth.

Some other reasons for doing this:

  • Want to use the USB port of the Arduino to control something or connect with a PC, want to program it on-the-fly, and don’t want that same PC to be the Arduino programmer.
  • Want to use a Pro Micro as the general-purpose Arduino or favorite-go-to Arduino, and not particularly thrilled by programming it via USB.
  • Want to power Arduino project via the USB port, but want to program or update it by other means.
  • Want a blend of some available features of the ATmega32U4 and the characteristics of the classic Arduino boards such as reset-on-serial-connection and on-board USB port that can act as a mouse.
  • Want to upload sketches via a specialized serial interface (such as Bluetooth).
  • Want to avoid excessive wear on USB sockets.
  • Want convenience and flexibility in embedded projects where the USB port is not accessible, otherwise occupied, or not practical to use for sketch updates.
  • Want to update or upload software in a multiple-processor project through a single interface or program multiple Arduinos simultaneously.
  • Want a smaller and better bootloader.

Next step is to build Optiboot for an ATmega32U4-based Arduino board. Once you burn the Optiboot bootloader on the board, you will no longer be able to upload sketches using the USB port on the Arduino. So, you will need to remember to select the correct board and port from the Arduino menu. I remember this by putting a small op57 sticker on the board. If I run into a circumstance where I want to upload via the USB port, I will burn the Caterina bootloader back onto it using an ISP programmer.

Just because you are not using the USB port to upload sketches, this does not mean you are disabling the USB port on the Arduino. You can still use it for serial monitor and keyboard/mouse emulation, and whatever other uses Arduino stock and 3rd-party libraries let you do.

Building Optiboot for ATmega32U4

I started with Arduino 1.6.5 for MacOS, and this article demonstrates using a Mac for the procedure. The Windows procedure should be very similar. I understand that you can build Optiboot in Arduino for Windows using omake.bat. See the README.TXT file that comes with Optiboot for details.

Download Optiboot v6.2, optiboot-master.zip file from https://github.com/dmjlambert/optiboot

This is a fork of Optiboot which has added ATmega32U4 support. The directory structure you get when you extract the zip file includes several levels of directories. You will see the structure

optiboot-master/optiboot/bootloaders/optiboot

Rename the optiboot subdirectory under bootloaders to optiboot32u4 and move it to the Arduino.app’s hardware directory /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/bootloaders.

Change directories to /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/bootloaders/optiboot32u4 to work on the build. Run the make command to build Optiboot. Optiboot comes with the script omake for Mac and batch file omake.bat to run the build. This script runs make with the appropriate parameters. I believe you could use the script or batch file if you have the Arduino app built from source or if you have added build tools. I have used the make command that comes with Mac OSX. Syntax:

make OS=macosx ENV=arduino LED_DATA_FLASH=1 LED_START_FLASHES=3 LED=B0 BAUD_RATE=57600 atmega32u4

Optiboot flashes the LED 3 times when it runs. If you want a different number of flashes or no flashes, change the command line accordingly. It also flashes during upload of a sketch as an activity indicator. If you do not want that, remove LED_DATA_FLASH=1 from the command line. The LED it flashes is B0, which is pin 17 or the RXLED on the Pro Micro. If you want another LED to flash, research the correct port and bit LED number and replace B0. If you want a different baud rate for uploading, change BAUD_RATE on the command line accordingly (and change your boards.txt file entry and baud rate of the Bluetooth transceiver).

If it worked correctly, you now have a optiboot_atmega32u4.hex file, which is the bootloader.

Downloads

Adding the Bootloader and Custom Board Settings to Your Arduino Program

Copy the optiboot_atmega32u4.hex file you created to the Arduino directory in the documents folder hardware structure, (docsdir/Arduino/hardware/custom/avr/bootloaders) directory and name it optiboot_atmega32u4_57600baud.hex, then create a custom board in boards.txt file to match the options selected.

Create or add to existing docsdir/Arduino/hardware/custom/avr/boards.txt:

atmega32u4o57.name=[Optiboot] ATmega32u4 Pro Micro 57600 baud
atmega32u4o57.build.board=AVR_PROMICRO16
atmega32u4o57.build.vid=0x1B4F
atmega32u4o57.build.pid=0x9206
atmega32u4o57.build.vid.0=0x1B4F
atmega32u4o57.build.pid.0=0x9205
atmega32u4o57.build.vid.1=0x1B4F
atmega32u4o57.build.pid.1=0x9206
atmega32u4o57.upload.tool=arduino:avrdude
atmega32u4o57.upload.protocol=arduino
atmega32u4o57.upload.maximum_size=32256
atmega32u4o57.upload.speed=57600
atmega32u4o57.upload.disable_flushing=false
atmega32u4o57.upload.use_1200bps_touch=false
atmega32u4o57.upload.wait_for_upload_port=false
atmega32u4o57.bootloader.tool=arduino:avrdude
atmega32u4o57.bootloader.low_fuses=0xff
atmega32u4o57.bootloader.high_fuses=0xde
atmega32u4o57.bootloader.extended_fuses=0xcb
atmega32u4o57.bootloader.file=optiboot_atmega32u4_57600baud.hex
atmega32u4o57.bootloader.unlock_bits=0x3F
atmega32u4o57.bootloader.lock_bits=0x0F
atmega32u4o57.build.mcu=atmega32u4
atmega32u4o57.build.f_cpu=16000000L
atmega32u4o57.build.usb_product="SparkFun Pro Micro"
atmega32u4o57.build.core=arduino:arduino
atmega32u4o57.build.variant=sparkfun:promicro
atmega32u4o57.build.extra_flags={build.usb_flags}

This includes a setting that expects the sparkfun hardware folder installed in docsdir/Arduino/hardware. If you don't have that, change:

atmega32u4o57.build.variant=sparkfun:promicro

to:

atmega32u4o57.build.variant=arduino:leonardo

After making changes to or creating your boards.txt, quit the Arduino IDE and re-launch it for changes to take effect.

The directory structure and file specification for custom boards.txt, bootloader directory, and other add-ons in the Arduino sketches directory is detailed in the Arduino IDE 1.5 3rd party Hardware specification page here:
https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5-3rd-party-Hardware-specification
Although it is somewhat tedious to read when you are in a hurry to try to get a bootloader to work, it is worth taking the time to read and understand.

Burning Bootloader on the Pro Micro

6.jpg
7.jpg

I am going to cover using a Pro Micro as an ISP programmer to burn the bootloader on another Pro Micro, but you can use any Arduino as your ISP programmer. There is a minor change to make to the example ArduinoISP sketch that comes with Arduino, in order for it to work on a Pro Micro.

In the Arduino IDE open File, Examples, ArduinoISP

Change the line:

#define RESET     SS

to:

#define RESET     10

Select the board and port of the Arduino you are using as the ISP programmer. Upload the sketch. After uploading the sketch, disconnect to Arduino to remove power. If you are using an ATmega328-based Arduino as the ISP programmer, you will need to disable the automatic reset on serial connection. It is not necessary to do this on the Pro Micro or Leonardo. If you are using an ATmega328-based Arduino, connect a 10 uF capacitor between the reset pin and ground. See this article for details:
http://playground.arduino.cc/Main/DisablingAutoResetOnSerialConnection

Connect these pins between the ISP programmer and the target Arduino to which you are burning the bootloader:

  • Pin 16 or MOSI on ISP programmer to pin 16 on target Pro Micro
  • Pin 14 or MISO on ISP programmer to pin 14 on target Pro Micro
  • Pin 15 or SCLK on ISP programmer to pin 15 on target Pro Micro
  • Pin 10 on ISP programmer to RST pin on target Pro Micro
  • VCC on ISP programmer to VCC on target Pro Micro
  • GND on ISP programmer to GND on target Pro Micro

The pin numbers for MOSI, MISO, and SCLK are probably not 16, 14, and 15 if you're using an ATmega328-based Arduino. Look up the pin numbers in the data sheet for your processor or on commonly-available pinout diagrams on the Web.

Connect the ISP Programmer Arduino to the computer via USB. In the Arduino IDE menu goto Tools, Board, and select [Optiboot] ATmega32u4 Pro Micro 57600 baud. Goto Tools, Programmer, and select Arduino as ISP. Goto Tools, Burn Bootloader. After a few seconds you should see the message Done Burning Bootloader near the bottom of the IDE. Unplug the USB cable and disconnect all wiring. Your Pro Micro now has a serial bootloader.

Windows users need to include an extra one-time step if using a Leonardo or Pro Micro or other ATmega32U4-based board as the programmer. Create a custom programmers.txt entry for Leonardo as ISP, so you can specify the arduino protocol instead of stk500v1 protocol. The details of this are discussed here by PeterVH: https://petervanhoyweghen.wordpress.com/2012/09/16/arduinoisp-on-the-leonardo/

Connecting the Bluetooth Module to the Pro Micro for Serial Programming

8.jpg
9.jpg

The State pin is used as DTR when you are programming an Arduino with the Bluetooth transceiver. If you connect it to the RST pin of the Arduino through a 0.1 uF capacitor, it will pulse a reset signal to the Arduino when a serial connection is made. This is the same method used to program an Arduino Uno, Duemilanove, Nano, Pro Mini, or other ATmega328-based boards. Nick Gammon shows us a pretty neat picture of what the in-line capacitor's pulse looks like compared to the DTR signal, which goes low and stays low during the connection: http://forum.arduino.cc/index.php?topic=145996.0

When you upload a sketch to a Pro Micro (or Leonardo) via a USB connection with the Caterina bootloader, the process is different. The Pro Micro is not reset via DTR, but rather the Arduino IDE sends a signal by briefly setting the baud rate to 1200, which enables a watchdog reset on the Pro Micro, and then it accepts the sketch via USB.

What we have done by burning the Optiboot bootloader onto the Pro Micro is change that behavior, and make the Pro Micro behave just like a Pro Mini. We will reset it via a serial DTR signal, and the Pro Micro will accept a sketch via serial. As mentioned earlier, the USB port will still function on the Pro Micro for all uses except uploading sketches.

Connect the Bluetooth transceiver to the Optiboot Pro Micro using the same wiring we used earlier to program the transceiver:

  • Connect pin RX of the Arduino to the TX pin of the transceiver.
  • Connect pin TX of the Arduino through a voltage divider to the RX pin of the transceiver.
  • Connect VCC or 5V of the Arduino to the VCC or 5.0 pin of the transceiver.
  • Connect GND of the Arduino to the GND pin of the transceiver.

Add one more connection; connect the State pin of the transceiver to the RST pin of the Pro Micro through a 0.1 uF capacitor, as discussed above.

You can now power the Pro Micro via the USB port. If you connect it to your computer to do that, you will notice the USB port does not enumerate or become visible as a device to your computer like a typical Caterina-bootloader Pro Micro. The computer only supplies power and the USB port is otherwise unused until you put a sketch on it that uses USB, such as a sketch that uses Serial, keyboard, or mouse functions. If a sketch you upload to it uses Serial1 and does not use Serial, keyboard, or mouse functions, the USB port will only be used for power. You could use a cell phone charger to power it. Or you can skip connecting USB, and instead connect a battery to the RAW input, or connect a regulated 5 V power supply to the VCC pin.

You're Done!

10.jpg

In the Arduino IDE menu goto Tools, Board, and select [Optiboot] ATmega32u4 Pro Micro 57600 baud. In Tools, Port, select the Bluetooth transceiver. Upload a sketch. If your sketch uses Serial1 for input and output, you can also use the IDE Serial Monitor to interact with your Arduino via Bluetooth.

What About Making the Leonardo Wireless?

11.jpg

Programming the Bluetooth transceiver is exactly the same as Step 2. Connect the Leonardo using the same pins as shown in the schematic and use the same sketch to send the AT commands to the transceiver and program it.

The boards.txt entry for the Leonardo with Optiboot does not need to be any different from the Pro Micro entry shown in step 5, but I like to make a separate entry for it in my custom boards.txt file anyway:

atmega32u4o57L.name=[Optiboot] ATmega32u4 Leonardo 57600 baud
atmega32u4o57L.build.board=AVR_LEONARDO
atmega32u4o57L.build.vid=0x2341
atmega32u4o57L.build.pid=0x8036
atmega32u4o57L.upload.tool=arduino:avrdude
atmega32u4o57L.upload.protocol=arduino
atmega32u4o57L.upload.maximum_size=32256
atmega32u4o57L.upload.speed=57600
atmega32u4o57L.upload.disable_flushing=false
atmega32u4o57L.upload.use_1200bps_touch=false
atmega32u4o57L.upload.wait_for_upload_port=false
atmega32u4o57L.bootloader.tool=arduino:avrdude
atmega32u4o57L.bootloader.low_fuses=0xff
atmega32u4o57L.bootloader.high_fuses=0xde
atmega32u4o57L.bootloader.extended_fuses=0xcb
atmega32u4o57L.bootloader.file=optiboot_atmega32u4_57600baud.hex
atmega32u4o57L.bootloader.unlock_bits=0x3F
atmega32u4o57L.bootloader.lock_bits=0x0F
atmega32u4o57L.build.mcu=atmega32u4
atmega32u4o57L.build.f_cpu=16000000L
atmega32u4o57L.build.usb_product="Arduino Leonardo"
atmega32u4o57L.build.core=arduino:arduino
atmega32u4o57L.build.variant=arduino:leonardo
atmega32u4o57L.build.extra_flags={build.usb_flags}

Burning the Bootloader

12.jpg
13.jpg

Burning the bootloader procedure is the same as in step 6. You can use a Leonardo to burn the bootloader on your target Leonardo, or use any other type of Arduino as an ISP programmer.

In this example wiring, I am using an UNO to burn the Optiboot bootloader on the Leonardo, using the custom boards.txt entry and the same ArduinoISP example sketch that has been uploaded to the UNO.

I like to add a cheat sheet to remind me of the pin numbers and names for the ICSP pins on the Leonardo. You can also use these pins as extra digital pins in your sketches for the Leonardo. Free extra pins you may not have known about!

Connect all pins of the ICSP header on the UNO to the ICSP header on the Leonardo, except pin 5, the RST pin. Connect pin 10 of the UNO to the RST pin of the Leonardo. There are 2 RST pins on an Arduino, one in the ICSP header pin 5, and one on the power header.

As mentioned in step 6, I have added a 10uF or larger capacitor between GND and RST on the UNO to keep it from resetting upon serial connection.

Connect the ISP Programmer Arduino to the computer via USB. In the Arduino IDE menu goto Tools, Board, and select [Optiboot] ATmega32u4 Leonardo 57600 baud. Goto Tools, Programmer, and select Arduino as ISP. Goto Tools, Port and make sure the port of the Arduino you are using as the ISP programmer is selected. Goto Tools, Burn Bootloader. After a few seconds you should see the message Done Burning Bootloader near the bottom of the IDE. Unplug the USB cable and disconnect all wiring. Your Leonardo now has a serial bootloader.

Nick Gammon has an excellent web page with details and pictures on wiring various different Arduinos to each other in preparation for burning boot loaders.
http://www.gammon.com.au/bootloader
The web page deals with using a different sketch in place of the example ArduinoISP, but the wiring is done the same way with his sketch or with the ArduinoISP sketch. When using the ArduinoISP sketch, it may be necessary to also disable automatic reset of the Arduino used as ISP programmer with the 10uF or larger capacitor between GND and RST for some Arduinos. When using Nick Gammon's sketch, that is not necessary, but you do need to translate the bootloader .hex file to a .h file that contains a byte array as described on his web page.

Connecting the Bluetooth Module to the Leonardo for Serial Programming

14.jpg

The wiring is the same as for the Pro Micro in step 7.

  • Connect pin RX of the Arduino to the TX pin of the transceiver.
  • Connect pin TX of the Arduino through a voltage divider to the RX pin of the transceiver.
  • Connect 5V of the Arduino to the VCC or 5.0 pin of the transceiver.
  • Connect GND of the Arduino to the GND pin of the transceiver.
  • Connect the State pin of the transceiver to the RST pin of the Leonardo through a 0.1 uF capacitor

Power the Leonardo via the USB port, or connect a battery to the Vin pin, or connect a regulated 5V power supply to the 5V pin.

In the Arduino IDE menu goto Tools, Board, and select [Optiboot] ATmega32u4 Leonardo 57600 baud. In Tools, Port, select the Bluetooth transceiver. Start uploading sketches! If you use Serial1 instead of Serial in your sketches, you can use the IDE Serial Monitor to interact with your Arduino via Bluetooth.

Notice in my picture I have added the OP57 sticker to the Leonardo, to remind me it has the Optiboot bootloader. That will remind me not to use the USB cable to upload sketches to it. It now accepts programming via the RX/TX pins instead of USB.

The Leonardo has enough blank area that you could use some Gorilla or hot glue and neatly attach the Bluetooth module, resistors and capacitor, in the area of the Leonardo name/logo, and wire it up permanently. You could then add your own custom label on top, and call it something like Leo BT.

The Arduino Micro is also a miniature Leonardo, and the Arduino Robot is a pair of Leonardos on wheels, so the same procedure should apply to make them programmable via Bluetooth. I don't have either of those on hand, but if somebody follows this procedure and would like to send me pictures of the wiring for those boards, I can post them. Same thing applies for Arduino Esplora.

FTDI

img776.jpg

Q:

I'm old school, man. No wi-fi or cell phones around here, and I wear a foil hat. Sure ain't gonna have Bluetooth. What can I do?

A:

The wiring is just about the same when you use an FTDI adapter:

  • Connect RX pin of the Arduino to the TX pin of the FTDI adapter.
  • Connect TX pin of the Arduino to the RX pin of the FTDI adapter.
  • Connect 5V or VCC of the Arduino to the 5V or VCC of the FTDI adapter.
  • Connect GND of the Arduino to the GND of the FTDI adapter.
  • Connect the DTR pin of the FTDI adapter to the RST pin of the Arduino through a 0.1 uF capacitor.