Tutorial 36: ATMEGA328P AVR (Arduino) Programming via GPIO (SPI)

The ATMEGA328P is the heart of the popular Arduino Uno. The Uno is traditionally programmed via a USB cable. If you want to go embedded - that is use the MCU in a project without the Uno PCB or secondary ATMEGA8U2 - you will have to program the chip without the USB interface. This is possible with the Raspberry Pi's GPIO header using the SPI communication pins. In this tutorial I show you how to compile and upload a sketch to an ATMEGA328P using your Raspberry Pi.


DIFFICULTY
EASY
LINUX UNDERSTANDING
LITTLE
CIRCUITRY KNOWLEDGE FAMILIARITY
LITTLE
ABOUT
0
MINUTES
  • How to connect an ATMEGA328P to a Raspberry Pi’s SPI bus
  • How to build a circuit around an ATMEGA328P to work off a 16MHz oscillator
  • How to program an ATMEGA328P using SPI
You shouldn’t really need help with the code.

Here’s that wiring schematic I show in the video:

Connecting an ATMEGA328P to a Raspberry Pi