Category Archives: AVR Tutorials


AVR: self-monitoring its own power supply

How would a microcontroller know how it’s own supply voltage is changing? Well, most microcontrollers have built in analog-to-digital converters that can read an input analog voltage and convert it to a digital number. So, it might be suggestive to use a similar technique. But the problem is, any ADC operation requires a reference voltage, which in most cases, is either the source voltage or one derived from it. So, how would you monitor the source voltage through ADC that uses the same source voltage as reference? The following article describes a way to do this without using any additional

Read more

Open Source USB AVR Programmer for Students and Hobbyists

If you cannot afford to buy a USB programmer for AVR, don’t worry, you can make one by yourself. This programmer uses a Atmega8 microcontroller with a few external passive components. The good thing is you don’t need any USB controller because it is implemented in the firmware inside Atmega8. Yes, you are right, you need an AVR programmer once to load the firmware inside Atmega8. You figure out how you gonna manage that. This programmer has been tested under Windows, Mac OS X, and Linux and worked well. It can program a chip at speed up to 5Kbytes/sec. The

Read more

Easy Data Logger with Virtual USB

“V-USB is a software-only implementation of a low-speed USB device for Atmel’s AVR® microcontrollers, making it possible to build USB hardware with almost any AVR® microcontroller, not requiring any additional chip.” For further details on V-USB and licensing, visit http://www.obdev.at/products/vusb/index.html This is a data logger project that reads an analog signal, converts into digital number, and sends it to a host computer using Virtual USB. This is a good example application of V-USB. An 8-pin ATtiny45 microcontroller without an external crystal oscillator is used for this demonstration. The beauty of this project is the ATtiny45 presents itself as a USB

Read more

External Interrupts in Atmega AVR

An interrupt is a process of forcing a microcontroller to temporarily suspend the current job and perform a higher priority task. Once the new request is served, the micrcontroller resumes the original task. Interrupts are powerful tools in embedded system design, and special cares must be taken while implementing them. This tutorial teaches how to use an external and pin change interrupts on an AVR microcontroller. Read

Read more

Using Timer interrupts in AVR

Timers are vital in embedded systems design. Timer module inside a microcontroller can be used to measure time interval, generate exact duration pulse, count external pulses, etc. Their proper use could reduce the overall consumption of available resources. This tutorial from Protostack teaches you about the 8 and 16 bit timers on an ATmega168 microcontroller. The concept of Timer is fundamental and is similar with other microcontrollers too. Read

Read more