How-To Articles

These articles are How-To articles intended to show you one or more ways to solve a general problem, or more specific circuits designed to show how something works. Code examples and schematics are included where useful.

If you need an LCD backpack and you can't wait for one to come in the mail, this project is for you. Turn an ATtiny2313 or ATtiny4313 into an I2C LCD backpack. It requires few parts and almost no code.

The ATmega328 has ample analog input pins, but no analog outputs at all. This circuit adds an analog output to the ATmega328 by adding a TI (National Semiconductor) DAC0832 chip.

Every AVR has one, but what does it do? What the analog comparator is and a few easy ways use it in your designs.

The comparator in the ATtiny is essentially the same as the one in the ATmega. We are going to use it to determine the capacitance of an unknown capacitor, and see what can be done to increase the range.

This is a board we made a few years ago to help with development work. It supports the ATmega8, ATmega48/88/168/328 AVRs.

This was our first development board. It supports the ATmega16/32, ATmega164/324/644/1284 AVRs.

When we first attempted this we thought it would be a difficult task. Wrong! Interfacing a PS/2 type keyboard (or, as it turns out, a USB keyboard) is very simple.

Continuing in the series of comparisons between apparently similar yet functionally different AVR microcontrollers, this is a look at the ATmega8 vs the ATmegaXX8 and it's variations. Atmel considers the ATmega48/88/168/328 to be upgrades to the ATmega8.

Do you waffle over a 97⍧ part vs. a $1.32 part with 8x the capacity? Pause and look at the specs and see which one is better all round.

How do the venerable old ATmega16 and ATmega32 stack up against their newer counterparts - the ATmegaxx4 series? The newer parts offer more peripherals and more available memory, but at a higher price.

There is a maximum speed on any ATmega or ATtiny. Not the one the manufacturer guarantees, but the one that applies to this specific device.

How accurate is the crystal oscillator on the ATmega and ATtiny? That is a difficult question to answer. There are many variables, and we will cover a few.

On many AVRs the system clock prescaler can be used to set the clock to a more advantageous frequency at runtime - up for processing power or down for power savings.

If you need to get parallel data from your AVR project back to a PC in a hurry, the conventional method has been to crank up the serial Baud rate to 230k and hope for the best. Unfortunately, the best is a bit over 18,000 bytes per second.

What's the difference? It depends on what you want to do with it. The ATmega328P is a picoPower device, meaning it has a power control register, and individual peripherals may be shut down at will to save power.

This article describes an adventure in power savings using the power control register. Steps are taken to determine the power requirements of each peripheral and try to get total power as low as possible.

How many things can you do with a MAX232 RS232 line transceiver? Here are a few.

Quadrature encoders are commonly used for servo controls, user input, and anywhere rotational speed and distance or position are needed.

This rotary encoder has two phases to allow you to determine both rotary distance and direction. It also has a momentary push switch.

What are the AVCC and AREF pins for? They are support for the ADC system in the ATmega or ATtiny. If you are trying to get accurate readings from the ADC, you need to pay particular attention to these two pins.

If you are trying to get accurate analog readings, it's not as simple as taking the defaults and converting. The defaults work, but they don't work well.

Those devices having analog inputs also have an analog multiplexer which allows you to select the input you want.

Although the AVR devices don't have an analog ground, most have a separate ground pin near the AVCC and AREF pins.

Most 8-bit AVR's have built in EEPROM, ranging from 64B to 4kB. Exceptions are the ATtiny4, ATtiny5, ATtiny9, ATtiny10, all 6-pin devices, and the ATtiny28, which doesn't even have RAM. The EEPROM is easy enough to use given the support in avr-libc.

I2C allows you to communicate over only two wires. I2C hardware functions are performed by the Two-Wire Interface (TWI).

You can run the ADC completely under it's own power by using an interrupt routine and setting the ADC to auto start.

Several AVRs are cpable of interupting on any change of state on any port pin. This is how you implement pin change interrupts in your program.

All AVRs support one or more external interrupts. This is how you handle them (with examples).