Arduino to Arduino — Cheap AVR Programming

How To Flash Your Arduino Using Other Arduino Board — #basicTronic #Episode 10

J3
Jungletronics
6 min readApr 19, 2020

--

Hi, in this quick post I will show you how to flash any AVR chip using an Arduino as ISP.

This is the cheapest way ever to flash the AVR chips.

Another option is this device: https://www.sparkfun.com/products/14747; I am waiting for the postmen knocking in my front door to ship and use it in future post:)

Fine, this post is about this:

Let’s use what we have now: Arduino as ISP!

It takes much debug to get to this post, so I decided to document it for the community (and for my future reference).

Arduino has a bootloader on its chip, ATmega328p.

When Arduino wakes up (power-on-or-reset) he says:

- Are you sending me a new program over USB? if so, I’ll load it into most of my memory (not, of course, overwrite to the bootloader).
Fig 2.From https://www.arduino.cc/en/tutorial/arduinoISP

So we don’t need in-system programming for day-to-day programming (see this topic at Arduino.cc: Bootloader).

This simple fact described above is what makes Arduino what it is today: a fascinating solution for embedded design!

The open-source nature of the Arduino project has allowed many thousands of developers to create their own Arduino-flavored variations to meet their project needs. Arduino has drastically lowered the barrier to fairly advanced embedded controller design while maintaining an accessible and easy-to-use user interface. This allows a much broader audience of potential Arduino users more opportunities to create new and fascinating solutions. It’s especially empowering to put this sort of accessible technology within
the reach of ever younger children, providing them with the tools to build and create, instead of merely consume.

The downside of the program is the oversimplification of the system, which masks the hidden potential of the hardware and software. Amazing things can happen when you tap into the true potential of any complex system. This is correctly called emergent behavior when surprising and perhaps unimagined capabilities arise from the interaction of the various components.

Now let’s suppose you just bought a new ATmega328p chip.

If it doesn’t have the bootloader, you’ll have to burn a bootloader on it!

In this case, you’ll need an ISP (In-System Programmer).

If you want to use a dedicated device, there are some products from Microchip (Atmel owner) to MikroElectronika;

The official Microchip burner seems to be AVR Dragon:

Fig 3. A Microchip official AVR programmer. https://www.microchip.com/DevelopmentTools/ProductDetails/PartNO/ATAVRDRAGON

The AVR Dragon sets a new standard for low-cost development tools for 8-bit and 32-bit AVR devices with On-Chip Debug (OCD) capability.

Some other options are more expensive, like Atmel-ICE, mikroProg for AVR:/

Or other even cheap tools like Tiny AVR Programmer (support for windows still works but usually it takes a lot of finagling to get it works decently); Pocket AVR Programmer (nifty little programmer, but has some limitations that did not allow you to use in productions — file size & speed restrictions) and the list goes on…

Or some other recently new product from Sparkfun: SparkFun Pi AVR Programmer HAT — Awww, this seems to be a robust and very fast solution for a hobbyist! — I will check it out!

Fig 4. I already bought two board of this: I expect it is a promising future solution for hobbyists flash AVR chips: cheap, at least :) https://www.sparkfun.com/products/14747

I have other Chinese board: USBASP USBISP AVR Programmer, but that doesn’t work - at least for me:/

Fig 6. from https://br.banggood.com/10pcs-USBASP-USBISP-AVR-Programmer-USB-ISP-USB-ASP-ATMEGA8-ATMEGA128-Support-Win7-64K-p-1557547.html?cur_warehouse=CN

I already give up for boards like these above, that have drive problem: unsolvable & irritating driving obstacles ”/

But, in fact, you do not really need to buy any ISP Programmer. The cheapest way is to put a little sketch into the Arduino, which turns an Arduino board into ISP (In-System Programmer).

Let’s get it to work!

Remember: Sharing is Caring!

1° Step — The Material you are going to need to complete this tutorial;

- 1 x Arduino AVR ATmega328p chip with Arduino Bootloader;
- 1 x Solderless breadboard with dual bus strips on both sides;
- 1 x Arduino UNO board;
- 2 x 22pF Ceramic Capacitor;
- 1 x 0.1uF Capacitor Ceramic;
- 1 x 16000 MHz Crystal;
- 1 x 10uF Eletrolitic Capacitor;
- 2 x LED 5mm;
- 2 x 220 ohms Resistor
- * Jumpers

Please consider to see my video first to get the big picture:

Video 1: How to Flash an AVR chip easily!

2° Step — Make all the connection like this Fritz schema:

Fritz 1: Arduino As ISP (In-System Programmer)

3° Step — Go to File > Examples > Arduino as ISP and upload this sketch to your board: ArduinoISP.ino, as usual;

4° Step — To tell you that the software ISP is running there is what is called heartbeat; To see it, just connect an LED to pin 9 with a resistor 220 ohms (note: look inside ArduinoISP.ino sketch and see some more information);

5° Step —Ok, now that your board is a really ISP programmer, connect an ATmega328p chip like fritzing schematic above and open another sketch, blink, as an example (set it to Arduino as ISP), and instead of pressing the usual upload button, hit Upload Using Programmer menu (Ctrl + Shift+U) and hope for the best…

fig 5. Everything should work fine! see video for how to make it happens like a breeze!

6° Step —Now if you what to change the bootloader itself you can do it by select Tools > Burn Bootloader.

Fig 6. It is only in case you get some chips without a bootloader…

And this is all for now!

If you are curious about bootloader please consider to see this post:

Arduino’s Bootloader — What is the concept of the bootloader?

Thank you very much!

Check below other #basicTronics episodes (about 555 chip is an awesome topic!).

See you in the next episode. o/

Download All The Files for This Project

Credits & References

Arduino as ISP and Arduino Bootloaders by arduino.cc

Installing an Arduino Bootloader by learn.sparkfun.com

AVRDUDE by nongnu.org

From Arduino to a Microcontroller on a Breadboard by arduino.cc

AVR Tutorial by ladyada.net

Video 2: from Julian Ilett: A really good lesson! Thank you, man! I’m your fun!

Related Posts

00#basicTronic — Battery Monitor Circuit — Zener Diodes & Quad Differential Comparator LM 339

01#basicTronic — LM358 Opamp Electret Amplifier Circuit — Debugging Circuit w/ SoundCard Oscilloscope

02#basicTronic — LM741 as Comparator & Opamp — Single or Dual Power Supply Voltage Config

04#basicTronic — Electronic ScoreBoard v1.0 — 4510 & 4511 Seven Seg Project

05#basicTronic — 555 IC — Monostable Mode — Playing with 555 Timer — Part I — Monostable

06#basicTronic — 555 IC — Bistable Mode — Playing with 555 Timer — Part II — Bistable

07#basicTronic — 555 IC — Astable Mode — Playing with 555 Timer — Part III — Astable

08#basicTronic — Reaction Timer Circuit — Using the 555 in its three modes at once

09#basicTronic — DRV8825 Driver & Stepper Motor 24BYJ48 — Operation & Theory #basicTronics 09

10#basicTronic — Arduino to Arduino — Cheap AVR Programming — How To Flash Your Arduino Using Other Arduino Board (this one:)

--

--

J3
Jungletronics

Hi, Guys o/ I am J3! I am just a hobby-dev, playing around with Python, Django, Ruby, Rails, Lego, Arduino, Raspy, PIC, AI… Welcome! Join us!