Summary: If you have an AVR device or an Arduino board that has the Arduino Boot Loader, using another Arduino board as a serial bridge is the most straight-forward way to program that device.
Hello, everyone. As a newbie in the world of Arduino, I’ve been benefited tremendously by the articles that were written and shared freely by many Arduino enthusiasts; I can say 90% of what I know about how to use Arduino comes from reading on the web. So here is my attempt at giving back to the community as much as a way to document some of the things I learn along the way so I can use them later without having to go and read it from my notebook.
Now let’s move onto the subject of my post today: using the Arduino UNO board to program other AVR microcontrollers or other Arduino boards. Depending on the UNO board you have, using it as a programmer may not be as easy as some tutorials indicate. The first place one should visit to learn about using the Arduino as a programmer is the ArduinoISP tutorial at the Arduino web site. A couple of other tutorials by the High Low Tech group at MIT (here and here) also gave me some insight into the subject. (I am working on a project that uses an ATtiny85 so the High Low Tech tutorials were my primary source of education).
I have 2 Arduino boards, both of which are made by OSEPP; one is labelled as UNO-compatible and the other is a PRO-compatible. Neither board is the “R3” design which means that neither of them has the SPI signals (MOSI, MISO, SCK) brought out to the header for the digital pins 11, 12, and 13. These boards also don’t have the I2C (SCL, SDA) signals brought out to the headers. In fact, if you check on the OSEPP web site about how to use their UNO board, their advice is that due to some firmware issues, you need to tell the Arduono IDE that the OSEPP board is a Duemilanove with the ATMega328P processor. For one of my projects, I was trying to use the UNO to program the PRO and I had to experiment a lot to get it to work despite the wide availability of help available out on the world wide web. The lack of the SPI signals in the headers (or maybe it’s the design of way the OSEPP boards) is my main source of frustration when trying to use the UNO to program the PRO board and the bare ATtiny85.
I am using Arduino 1.6.6 on Windows 8.1 running on an ASUS XT205A laptop (Intel Atom Z335F 1.33 MHz processor, 2GB RAM with 32GB of embedded Flash drive) as my main IDE. I also use 1.6.7 especially when dealing with the ATtiny85 about which I will write another post discussing my experience with it. Because of the architecture of the environment, the Arduino 1.6.6 and 1.6.7 IDE’s can co-exist in your system and they can both use the external cores (such as ESP8266 core and David A. Mellis’ ATtiny core) and libraries that you install.
If you are a newbie like me and you read around the web to look for the instruction for using the Arduino UNO to program another UNO or similar Arduino board, you will find that essentially you need to use digital pins 10, 11, 12, and 13 of the “programmer UNO” to the target Arduino board. I found that if your target board is also an Arduino type board, this procedure is overkill. The main reason that you need to use those digital pins (the SPI interface) is if your target board does not have the Arduino Boot Loader already loaded; i.e. if you are trying to program a bare ATmega or ATtiny microcontroller or if you had deleted the boot loader from your board.
If you are like me and are trying to program an Arduino PRO (or any other Arduino board that does not have the USB connector) and you had not deleted the boot loader, then simply using your UNO as a “serial bridge” to program will work fine. Here is how you do it:
- While power is off to your “programmer UNO” board, connect its RESET pin to GND; doing this basically leaves the USB-to-serial chip active while keeping the main processor on the UNO board disabled
- Connect digital pins 0 and 1 of the “programmer UNO” to digital pins 0 and 1 of the target board
- Connect the 5V and GND of your “programmer UNO” to the 5V and GND of your target board; doing this supplies power to the target board via the USB port
- Connect the USB cable from your computer to the “programmer UNO” board
- Start the Arduino IDE, read in the sketch that you want to load into the target board
- Make sure that you use the “Tools” menu to select the correct board, processor, and port settings
- The selection of Tools -> Programmer is NOT important since the “programmer UNO’s” processor is disabled anyway
- Press “Upload”
- Press briefly and release the RESET button on the target board once the Arduino software finishes compilation and shows that it is trying to upload
And voila! It’s done!
Note that this technique only works with boards or devices that already have the Arduino boot loader loaded AND the device or board has a serial (UART) interface.
I learned about this technique by reading this tutorial and another one which, unfortunately, I have lost the bookmark.