AVR Programming & Design

The source code is provided for each project. The code is for EDUCATIONAL purposes ONLY. There is no warranty and no support. All these projects are a result of my hobby, so I don't necessarily know what I'm doing! Also note that all code available here carries the MIT License.

VE3LNY's AVR Microcontroller projects

It doesn't take long after being introduced to PICs before you hear about AVR microcontrollers and how wonderful they are. AVRs are 8 bit risc microcontrollers, from Atmel Corporation. (Atmel was bought up by Microchip.)  There are a number of models, from tiny to large, so you can always find a processor to suit your requirements.

When starting off with a new line of microprocessors, you need two things: a development language and a programmer. Microchip provides the Microchip Studio for free, which provides assembler language. Not being a fan of assembler programming, I was excited to discover that there is a free C language compiler available, called WinAVR. WinAVR includes the GCC compiler and LIBC, a library with lots of useful functions, and numerous of other goodies.

NOTE: Atmel was acquired by Microchip in 2016. As a result may of the Atmel links no longer work and take you to Microchip home page. I apologize for this, and will try to fix them as time permits.

AVR Programmers

In the programmer department, I found a really simple one from Sparkfun here (unfortunately now discontinued, but the schematic is here) which I built. It connects to a PC's serial port and may be driven with a program called AVRDUDE, included in WinAVR. (This programmer is known to AVRDUDE as ponyser).  One test showed that that the ponyser took 10 seconds to program an ATmega48 with 3467 bytes of flash data.

Atmel had an inexpensive USB-attached programmer called the AVRISP MK2, which cost about $C36 from DigiKey (P/N ATAVRISP2-ND). (Discontinued!) It programs very fast if you set the ISP clock frequency properly. (If the AVRISP's clock frequency is incorrectly set, which it may be by out of the box, it may be really slow or not work at all. I learned this the hard way. Its easy to check/set the clock speed in the Main tab of the programmer software.) 

A possible replacement is ATATMEL-ICE, at Digikey ATATMEL-ICE-BASIC-ND or ATATMEL-ICE-ND. Unfortunately these are more expensive.

Another interesting approach may be found in Peter Fleury's AVR Starter Kit. 


AVR released another inexpensive programmer called the AVR Dragon. Unfortunately it too is no longer available. My notes on the AVR Dragon here.


In the following projects, I used AVR Studio (versions 4 and 6/7) and WinAVR GCC. After installing both programs, you can create a project with AVRStudio and select GCC as the compiler. I provide all source code but no project files, so you must create your own. Don't forget to specify the processor type in the project properties. Then add the source and header files to the project and build. I also include my hex file which ought to work if your hardware is sufficiently identical.


All my projects have been roll-your-own. Over the years Arduino boards have become very popular, and one like the Uno can save a lot of  design/construction/programming effort. I would encourage anyone who finds my own approach to micro projects tedious to look at Arduino. Many various inexpensive boards and shields are available from numerous sources.


Thermostat Version 2

Here's a thermostat for your furnace with an LCD display and humidity readout using an ATMega88. Uses only a rotary encoder.



A thermometer with an LED display using an ATMega8.

electric blanket

Electric Blanket Controller

A versitile Electric Blanket Controller using an ATtiny461.

Simple Low-Resistance meter

Here's a low-resistance meter using an ATmega168.


Temperature and Humidity Meter

Temperature and Humidity meter using an ATmega164.


KTM-S1201 Serial LCD Driver

A C-code driver for this display.


Appliance Timer

An Adapting Appliance Timer using an ATMega88 and a KTM-S1201 LCD display. (Updated 2012-11-01)

chiming clock

Chiming Clock

A clock that sings like a bird using an ATMega88 and a KTM-S1201 LCD display.

garage door monitor

Garage Door Monitor

Makes sure my garage door does not stay open too long.

usb clock project

USB Clock Version 2

Here is an ATmega48 beeping clock that shows the date and time, driven from the PC. (Updated to add day of week to display.)

esr meter

ESR Meter with LED Display

Manfred Mornhinweg's ESR meter with an ATtiny861 and an LED display

bench supply

Bench Power Supply

With ATtiny861 LED Voltmeter and Ammeter

Nokia clock

Nokia 5110 Display Clock

A clock using the Nokia 5110 display and no dedicated RTC chip.

SLA Charger with Monitor

SLA Charger with Monitor

A UC3906 SLA 2.5Amp charger with an ATtiny461 monitor.
(Software updated 2016-07)

Travel Clock

Travel Alarm Clock

A travel alarm clock using ATmega88 and DS1302.

Thermopmeter Outdoor

Outdoor Reading Thermometer

Read the temperature outdoors.

Timer with Nokia displayr

Timer with Nokia Display

An Adapting Appliance Timer using an ATMega88 and a Nokia 5110 LCD display.


Temperature and Humidity Meter

Version 2, uses HDC1080 sensor

Temperature and Humidity meter using an ATmega164.

space heater therostat

Space Heater Thermostat

ATtiny84P processor, uses I2C sensor and LED display driver

LED alarm clock

LED Alarm Clock

ATmega164 processor, using 4 digit LED display and adaptive brightness

ICOM Commander

ICOM Commander

Handy device for use with ICOM radio to set power level and choose key type.

Frequency Counter

Frequency Counter

An addition to a function generator that has no digital frequecy readout.


Temperature and Humidity Meter

Version 3, uses SHT30 sensor

Temperature and Humidity meter using an ATmega164.


Heating Pad Controller

A versatile 9-step controller for your heating pad, using an ATtiny861A.

Back to VE3LNY's Home Page