March 2006 This project came about because a friend of mine had something similar as a component for his final year electronic engineering project. We decided that we would have a kind of competition to see who could build an AVR based AC light dimmer the quickest. I was interested because I had always wanted to experiment with AC power control, and this was the perfect, simple little project. AC Dimming TheoryExplanation to go here. Hardware
Software
The code for this project was written in BASCOM AVR - a BASIC compiler for the AVR microcontrollers. The code is
fairly simple and is only two pages long. The main loop just polls the port where the zero crossing detector is connected. If there is a zero crossing, then wait for
a short time to give the voltage on the base of the transistor time to fall to zero instead of 0.7v, and start the timer. The timer interrupt just coverts a brightness based on a 50Hz (or is
it 100Hz due to rectification?) time period and turns the
triac on. The triac will automatically turn off at the next zero
crossing, so the timer is reset to maintain the brightness. References |
Electronics >