Dimming an incandescent bulb is easy. Simply adjust the current down using a potentiometer and you are done. Dimming an LED is another story entirely. When you reduce current through an LED there are unintended consequences like color shifts and dropouts. A better way is to use Pulse Width Modulation (PWM). With PWM the LED...
Back in February, we wrote a post on Analogue to Digital Conversion. Many people mentioned that it was a bit light and they would like a more advanced tutorial. Well here it is... In this tutorial we add a second analogue input and use the ADC Conversion Complete interrupt. The circuit we are using is...
Many AVR microcontrollers are capable of doing Analogue to Digital Conversion. The ATmega168 has 6 ports (8 ports on the SMD packages) that can be used for analogue input. This tutorial shows you how. The circuit We'll be building the following circuit on a breadboard. The Breadboard layout is based on the Atmega8 breadboard circuit...
EEPROM (Electrically Erasable Programmable Read Only Memory) Is non-volatile memory, meaning it persists after power is removed. The ATmega168 microcontroller has 512 bytes of EEPROM which can be used to store system parameters and small amounts of data. This tutorial shows you how to read and write EEPROM. Overview Our code examples will be very...
In this tutorial we will show you how to setup an AVR Eclipse development environment on Windows. Installing the AVR-GCC toolchain The AVR-GCC toolchain is a collection of tools which are used to compile and upload firmware to AVR microcontrollers. The toolchain comprises of: GCC - The C/C++ Compiler GNU Binutils - A collection of...
The AVR family of microcontrollers use a modified Harvard Architecture which uses 3 types of memory, most of which are on chip. Flash RAM EEPROM Flash Flash is non volatile memory, which means it perisists when power is removed. Its purpose is to hold intructions that the microcontroller executes. The amount of flash can range...
This tutorial will teach you about the 8 and 16 bit timers on an ATmega168 microcontroller. Because the ATmega168 is very similar to the ATmega48, ATmega88 and ATmega328, the examples should also work on these. For other AVR microcontrollers the general principles will apply but the specifics may vary. What are the 8 and 16...
This tutorial will teach you how to use external and pin change interrupts on an AVR microcontroller. I will be using an ATmega168. The general principles apply to other AVR microcontrollers, but the specific vary greatly. What is an Interrupt? Imagine your are sitting at your computer, reading this post. The phone rings and you...
This tutorial will teach you how to use the I/O ports on an AVR microcontroller. I will be using an Atmega8 but the general principles apply to any AVR microcontroller. Introduction The Atmega8 has 23 I/O ports which are organised into 3 groups: Port B (PB0 to PB7) Port C (PC0 to PC6) Port D...
This tutorial continues on from ATmega8 breadboard circuit Part 1 and ATmega8 breadboard circuit Part 2. So far we've built a power supply, added the microcontroller, added some plumbing to make it work and added the ISP interface, but it really doesn't do anything. The next step is to add some I/O devices and upload...
This tutorial continues on from ATmega8 Breadboard Circuit - Part 1 where we build a small power supply on the breadboard. In this part we will add the ATmega8 microcontroller and an interface to allow it to be programmed. The first step is to orient yourself with the ATMEGA8 microcontroller. Since we are building our...
This is the 1st of a 3 part series where I will describe how to build a basic ATmega8 circuit and program it with a simple program. This tutorial is ideal for first timers, so read on... Breadboards usually have a break or two in the bus strips, so the first thing we will do...