This is a short guide to explain how to program an AVR microcontroller (like what powers an Arduino Uno) directly from the GPIO pins on a Raspberry Pi. Why would you want to program an AVR from a Pi? If you're building up an AVR-based board or product from scratch you'll need some way to program code onto the chip. Typically dedicated tools like the USBtinyISP are used to program an AVR through its in-circuit serial programming (ISP or ICSP) pins, however with the latest version of the avrdude programming tool you can actually use Linux GPIO pins to program an AVR directly--no dedicated programmer required! This guide will walk you through how to install and use avrdude to program an AVR microchip or Arduino through its ISP pins with a Raspberry Pi.
Note that this tutorial is somewhat advanced and targeted at people who are familiar with programming an AVR chip directly instead of using friendlier tools like the Arduino IDE. It will help to be familiar with setting up a breadboard Arduino and loading its bootloader through an ISP programmer. If you're a beginner or new to Arduino, stick with using the Arduino IDE to program your board.
To follow this guide you'll need the following hardware:
- Raspberry Pi - Any model will work, but note that you need 4 GPIO pins free for each AVR that will be programmed at a time.
- An AVR chip & development board or an Arduino board that exposes the ICSP pins (like an Arduino Uno).
- Breadboard and wires to connect the ICSP pins of the AVR/Arduino to GPIO pins on the Raspberry Pi.