a growing collection of standalone AVR projects for various tasks
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
ATMega328 LEDblink ADC Feb 9, 2017
ATMega328 2015-01-01 USART serial lots of new projects Apr 29, 2017
ATMega328 2016-09-04 SN74LV8154 lots of new projects Apr 29, 2017
ATMega328 2016-09-07 ramp DVM ADC Feb 9, 2017
ATMega328 2016-09-15 CVM ADC Feb 9, 2017
ATMega328 2017-02-07 ADC serial LM35 Update README.md Mar 15, 2018
ATMega328 2017-02-08 i2c LM75A thermometer Update readme.md Sep 3, 2017
ATMega328 2017-02-12 crystal turnover inspector lots of new projects Apr 29, 2017
ATMega328 2017-03-19 i2c LCD backpack lots of new projects Apr 29, 2017
ATMega328 2017-03-19 i2c LCD pressure sensor notes Apr 29, 2017
ATMega328 2017-08-14 action potential generator microcontroller AP generator Aug 20, 2017
ATMega328 2018-02-25 16-bit pwm Update readme.md Mar 14, 2018
ATMega328 2018-02-25 nrf24L01 fixed rx link Mar 9, 2018
ATMega328 2018-04-22 MAX7219 LED matrix Update readme.md Apr 25, 2018
ATMega8 AD9850 DDS receiver Update readme.md Aug 14, 2017
ATTiny2313 LEDblink lots of new projects Apr 29, 2017
ATTiny2313 2015-01-01 USART serial serial reform v2 Feb 12, 2017
ATTiny2313 2016-08-14 clock divider lots of new projects Apr 29, 2017
ATTiny2313 2017-02-01 PWM Update main.c Feb 20, 2018
ATTiny2313 2017-02-02 rotary encoder Update readme.md Feb 3, 2017
ATTiny2313 2017-02-03 pin change interrupt ADC Feb 9, 2017
ATTiny2313 2017-02-04 QRSS VFO controller ADC Feb 9, 2017
ATTiny2313 2017-07-22 shutter controller shutter controller Aug 3, 2017
ATTiny2313 2017-08-02 stimulus generator stimulus generator Aug 3, 2017
ATTiny2313 2018-02-25 ADC Update readme.md Feb 26, 2018
ATTiny2313 2018-02-25 button interrupt Create readme.md Feb 25, 2018
ATTiny85 LEDblink attiny85 LEDblink fixed Aug 20, 2017
ATTiny85 2016-07-24 TTL laser controller AVR clock divider / folder restructure Aug 14, 2016
ATTiny85 2016-07-31 frequency generator Update README.md Feb 3, 2017
ATTiny85 2016-12-30 PWM rotary encoder Feb 3, 2017
ATTiny85 2017-02-05 ADC ADC Feb 9, 2017
ATTiny85 2017-08-19 action potential generator Update readme.md Aug 20, 2017
ATTiny85 2017-09-01 PS4 controller auto run auto fire Create readme.md Sep 2, 2017
Analog action potential generator analog action potential generator Aug 14, 2017
BusPirate 2017-02-04 i2c ms5661 pressure notes Apr 29, 2017
BusPirate 2017-02-04 i2c temperature Update readme.md Feb 10, 2017
BusPirate 2017-03-11 crystal oven lots of new projects Apr 29, 2017
BusPirate Create demo.py Feb 5, 2017
ESP8266 ESP update May 9, 2018
FTDI 2017-04-29 bitbang max7219 7seg Update readme.md Apr 30, 2018
FTDI 2018-05-30 bit bang Add files via upload Jun 2, 2018
FTDI 2018-06-03 ftdiDDS Update readme.md Jun 3, 2018
functions Update readme.md Feb 25, 2018
resources added pics of common chips Aug 14, 2016
tips ADC Feb 9, 2017
LICENSE Initial commit Jul 31, 2016
README.md Update README.md Mar 9, 2018



This repository contains a growing collection of individual AVR project files for various tasks. I personally use these projects as starting points for new microcontroller projects, or reference for common procedudures I would otherwise have to go back to the datasheet for (timers, counters, frequency counting or synthesis, interrupts, UART, I2C, ADC, etc). Each folder is self-contained and has batch scripts to set fuses to change the clock source (internal RC oscillator at 8MHz, div/8 for 1MHz, or external crystal typically up to 20 MHz)

These are some of my favorites:

Programming Setup

I almost always use AVRISPmkII and AVRdude (launched from a batch script) to program my chips. I virtually never use AVRStudio. I typically develop in a Windows environment, but the code (and AVRdude) works the same in Linux.


  • Just install WinAVR and it should install drivers for common programmers.
  • I prefer to edit C code in Notepad++
  • definately check out AVRDudess (a GUI for AVRdude) as an easy GUI to load flash onto chips



Note Picture
AVRISPmkII is a ceap, fast, and convenient AVR programmer. AVRISPmkII
Bus Pirate technically can program AVRs, but it's so slow it's not practical. Here's a post I wrote about it. I like the bus pirate when I need to use software to measure voltages and toggle pins. It's slow though, because the handshake it bit-banged and it takes tens of seconds to program an AVR. For just programming, I prefer an (ebay knockoff) AVR ISP mkII. Definately check out AVRDudess as a GUI for AVRDude. I usually get a standard command for a project and put it in a batch file in the same folder.
AVRDudess can simplify programming of code and fuses. avrdudess

Common AVR Datasheets and Pinouts

chip pinout datasheets
ATMega328 [summary] [complete]
ATTiny2313 [summary] [complete]
ATTiny45 [summary] [complete]

Helpful Links

Misc Code

Reading pins

if(PIND&(1<<PD7)){doSomething();} // runs doSomething() if PD7 is HIGH

Bit flipping in C

PORTD|=(1<<PD6); // sets PD6 high
PORTD&=~(1<<PD6); // sets PD6 low
PORTD^=(1<<PD6); // flips the state of PD6

Memory-Efficient Timers

#include <util/delay.h>
void waitMs1(){_delay_ms(1);}
void waitMs(int ms){while (ms-->0){waitMs1();}}
void waitSec(int sec){while (sec-->0){waitMs(1000);}}