You Are Here: Home » AVR ATmega Projects » Adaptive Cancellation of Periodic 60 Hz Noise using ATmega32

Adaptive Cancellation of Periodic 60 Hz Noise using ATmega32




An active noise canceler to eliminate the 60 Hz noise found in electrical signals due to AC power-line contamination.

60 Hz noise is frustrating for anyone trying to make sensitive measurements of low voltage processes (eg. Electrocardiogram measurements), record audio from electrical instruments (eg. guitar “hum”), or use electronic systems near an AC transformer. The most common way to eliminate the noise is through a 60 Hz notch filter. Because there are inherent variations in the 60 Hz signal, a notch filter is not robust against signal source frequency changes. However, using a microcontroller such as the ATMega32 to monitor a reference signal and output an out-of-phase signal to cancel the noise, we overcome the limitations of a single-frequency selective notch filter and can achieve at least 15 dB cancellation of 60 Hz component in the contaminated signal. Digital Signal Processors (DSPs) or Field Programmable Gate Arrays (FPGAs) can be programmed for this purpose, but are substantially more expensive than the ATMega32.

Adaptive Cancellation of  60 Hz Noise

This project was undertaken during a five-week design lab for ECE 476 with Professor Bruce Land (TA: Adrian Wong) at Cornell University.

Robert Ochshorn (rmo25)
Kyle Wesson (kdw24)

Design

Rationale and Source of Project Idea

The original goal of our project was to adaptively cancel sound noise in a rapidly changing environment such as the interior of a vehicle. We were able to find numerous reference papers that had accomplished similar goals. While we have not given up hope that we can cancel audible noise, several factors (eg. poorly functioning microphones, processor speed) have prevented us from achieving this specific goal to date. However, adaptively cancelling audio is a very similar problem to canceling electrical noise.

Early in the semester, our Professor, Bruce Land, suggested making an adaptive noise canceler to help neurobiology researchers who need to make sensitive, noiseless measurements. He had completed some preliminary simulations of adaptive cancellation in Matlab and created a block diagram of a potential solution. We decided to work on this since it would be an excellent first step to the ultimate goal of (sound) noise cancellation.

Background Math

From the start, we settled on a least mean squares (LMS) adaptive filter design. A LMS filtering approach is well known and well documented (see references). The goal is to continually update a set of weights that change the output of the system. This output (also known as the error signal) is fed back into the filter which modifies its weights according to the ultimate desired signal.

The best description of the LMS filtering algorithm was found in Active Noise Control Systems: Algorithms and DSP Implementations (Sen M. Kuo and Dennis R. Morgan, Wile & Sons, 1996) which we excerpt here:

  1. Choose parameters and initial conditions: l, , and w[0], where l is the order of the filter, is the step size, and w[0] is the initial weight vector at time n = 0.
  2. Compute adaptive filter output:
  3. Compute the error signal: e[n] = d[n] – y[n].
  4. Update adaptive weight vector from w[n] to w[n+1] using the LMS algorithm:

The math to determine our filter characteristics is documented in the implementation section. In order to eliminate any possible aliasing, we need to sample at a rate consistent with the Nyquist theorem. Since we decided to cancel below about 230 Hz signals, our input sampling frequency needs to be at least 460 Hz, and we need to lowpass the contaminated signal.

Logical Structure

In one sentence: our project takes in a contaminated signal, a reference signal, and outputs a “anti-noise” signal that is summed with the contaminated signal to produce a clean “final” signal.

Control Flow

Our software is structured into three primary components:

  1. an output interrupton timer0 that writes to PWM at full clock speed with an interrupt on counter overflow:
  2. an input interrupton timer2 that muxes analog in between the reference and error source, performs the a/d conversion, and sets program state to flag a new value as ready; this runs with a clk/64 prescaler:
  3. finally, the main loop polls state set in the input interrupt and either updates filter weights based on a new error signal, or computes output based on a new input.

 

For more detail: Adaptive Cancellation of Periodic 60 Hz Noise using ATmega32

Leave a Comment

You must be logged in to post a comment.

Read previous post:
How Security Cameras Work
How Security Cameras Work

Types of Security Cameras ­Before you actually invest in a security camera system, you need to think about what you'll...

Close
Scroll to top