Seminar Topics & Project Ideas On Computer Science Electronics Electrical Mechanical Engineering Civil MBA Medicine Nursing Science Physics Mathematics Chemistry ppt pdf doc presentation downloads and Abstract

Full Version: AVR182: Zero Cross Detector ppt
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
AVR182: Zero Cross Detector

[attachment=34263]

Introduction

One of the many issues with developing modern applications is to keep the spikes and
EMI at a minimum, especially when switching AC mains in and out. Most of today’s
new applications are controlled by one or more microcontrollers and this gives the
possibility to prevent this noise in a simple and cost efficient way.
Noise produced during switching is dependant on the amplitude of the AC sinus at the
actual switching point. To get this noise as low as possible the ideal switching would
be when the amplitude is 0 volt. The amplitude is crossing 0 volt at the sinus “zero
crossing”. Switching mains in and out at the zero crossing requires a way of detecting
when the next crossing will be and launching a switching action at the crossing. This
raises the need for a cost efficient way to detect the zero crossing. This application
note explains how to do that.
Zero cross detection can also be used for other purposes, such as frequency calculation
and relative phase measuring.

Application Example

This application note shows the user how to implement a zero cross detector with a minimum
of external components. It should be noted that this solution will not give any
galvanic isolation for the microcontroller against the AC mains. The zero cross sense
resistor can be a way for electronic noise to get into the system.
This will not be described in this application note. Please see “AVR040: EMC Design
Considerations” for further details about this.
The application uses ATmega16, but the code can be recompiled for any AVR device

Hardware

To protect the device from voltages above VCC and below GND, the AVR has internal
clamping diodes on the I/O pins (see Figure 1). The diodes are connected from the pins
to VCC and GND and keep all input signals within the AVR’s operating voltage (see Figure
2). Any voltage higher than VCC + 0.5V will be forced down to VCC + 0.5V (0.5V is the
voltage drop over the diode) and any voltage below GND - 0.5V will be forced up to
GND - 0.5V.
By adding a large resistor in series, these diodes can be used to convert a high voltage
sinus signal down to a low voltage square wave signal, with amplitude within the AVR’s
operating voltage ± 0.5V. The diodes will thus clamp the high voltage signal down to the
AVR’s operating voltage.
Note that the series resistor and the pin input capacitance form an RC filter that will
introduce a small phase difference between the square wave and the AC mains signal.
The phase difference is insignificant in the current example, see “RC Filter and Delay
Between VCC/2 and the Actual Zero Cross” on page 7 for more details.
As the square wave signal is in phase with the AC mains, using the falling edge will tell
very accurately where the zero crossing happens. By using this signal the AVR can be
programmed to be a very accurate zero cross detector with a very small and interruptdriven
code