Programming the ATtiny85 from Raspberry Pi

These instructions tell you how to setup and program the ATtiny85 microcontroller from a Raspberry Pi via the SPI interface. Lots of people use the Ardiuno to do this (then you can use the Arduino IDE and simplified C commands), or you can use a USB based programmer. I do not have an Ardiuno and don’t want to buy a dedicated programmer. I do have a Pi, so I was pleased to learn I could use it as a way to get into microcontroller programming.
Programming the ATtiny85 from Raspberry PiYou will need:
Raspiberry Pi
ATtiny85 chip
5 x 1K resistors (or similar)
LED of your choice
A connection to the GPIO of the Pi, and a breadboard and wire.

Based on…

Step 1: Setup the Raspberry Pi

At the terminal of the Pi:

Download and build avrdude

sudo apt-get install bison automake autoconf flex git gcc
sudo apt-get install gcc-avr binutils-avr avr-libc
git clone
cd avrdude/avrdude
./bootstrap && ./configure && sudo make install

Setup SPI on the GPIO

sudo raspi-config
and Enable SPI device in the Advanced Options (see picture)
You can check this at the command line with lsmod, no need to reboot. (Maybe need to sudo modprobe spidev)

Download and build WiringPi for the gpio commands
cd ~
git clone git://
cd wiringPi

Programming the ATtiny85 from Raspberry Pi Schemetic

Step 2: Electrical Connections

Connect up the ATtiny85 to the Raspberry Pi GPIO (wire colours from the picture are given for reference):

GPIO pin ATtiny pin Comment
15            1                GPIO22 to Reset (through 1K, Blue wire)
17            8                3.3 V (Green wire)
19            5                MOSI (through 1K, Yellow wire)
21            6                MISO (through 1K, Orange wire)
23            7                SCLK (through 1K, Red wire)
25            4               GND (Brown wire)

(I could not find a way to do a nice table in instructables)


For more detail: Programming the ATtiny85 from Raspberry Pi

Scroll to Top