Everyone of us wants to control a bulb, a fan etc at some point in time. We will look at driving single phase AC devices with a Relay using Atmega32.

Basics

Hookup

The Ultra AVR Dev board comes with Relays on board. You simply need to hook up the relay inputs with the the port pins as shown in the figure below.

Code

The code turns ON and OFF the relays, every 5 seconds.

Demo

Demo

Schematic

Schematic AVR Interfacing Relay.JPG