Breaking News
Newest First | Oldest First | Threaded View
Max The Magnificent
User Rank
Re: Noise Filtering
Max The Magnificent   8/5/2014 2:48:32 PM
@Elizabeth: I've used averaging to reduce the noise on an anlog signal but the way I usually do it is to capture sets of samples 2 or 4 times as fast as you need them...

I can't wait to get the main display up and running, and to hen start playing with differenmt filtering techniques to see which works and looks best on the display.


User Rank
Re: Noise Filtering
Wnderer   8/5/2014 7:11:20 AM

Okay, I see what you're doing now. Thanks.

User Rank
Re: Noise Filtering
elizabethsimon   8/5/2014 12:15:58 AM
Yes you are right about the first example I gave being a moving average FIR filter of order two. And it would be mroe efficient to do it using a circular buffer..

In the second example I was trying to show an IIR filter. I think it would work as written but might be clearer if it was broken into steps like this


   newSpectrumLeft[i] = analogRead(channelLeft) / 4; // new sample

   spectrumLeft[i] = (spectrumLeft[i] + newSpectrumLeft[i]) / 2; average


The difference between this example and the first one is that it's always influenced by ALL previous samples although the older samples have much less influence.

As an example, say you had the following values for newSpectrumLeft and you started with everything at zero

32 32 0 0 0 0 0

with the first example that I gave you would have

16 32 16 0 0 0 0

the second example should give

16 24 12 6 3 1

At least that's the idea I was trying to get across


User Rank
Re: Noise Filtering
Wnderer   8/4/2014 6:46:32 PM

I don't think that's exactly right. I believe your first example is a moving average filter of order 2 which is an FIR filter. I think your second example keeps getting bigger.  See the Wiki page.

I'm not sure the way he is averaging now is doing anything beneficial since he just averages short bursts of values. Implementing a moving average filter might improve the signal, but Max would need to implement a circular buffer for the spectrum values in between channel reads.


Some Notes on moving average filters, that seem to be missing from the Wiki.

A moving average filter implements a sinc function

H[f] = |sin(pi *f *M)/(M*sin(pi*f))| where M is the order of the filter. 

The full sampling frequency is divided into M humps.

The peak at the center of sampling frequency has an amplitude of 1/M for odd M. The peaks near the center will be close to this value for even M.

The amplitude of the second hump that occurs at 1.5/M approaches 1/1.5pi as M gets large.



User Rank
Noise Filtering
elizabethsimon   8/4/2014 4:44:17 PM
I've used averaging to reduce the noise on an anlog signal but the way I usually do it is to capture sets of samples 2 or 4 times as fast as you need them.

so in main you would have





while in your subroutine you would have


   oldSpectrumLeft[i] = newSpectrumLeft[i];

   newSpectrumLeft[i] = analogRead(channelLeft) / 4;

   spectrumLeft[i] = (oldSpectrumLeft[i] + newSpectrumLeft[i]) / 2;


This is the simplest form of FIR (Finite Impulse Response) filter


Or if you wanted a "running average" you could use something like


   spectrumLeft[i] = (spectrumLeft[i] + (analogRead(channelLeft) / 4)) / 2;


If you do this though, you need to make sure that you initialize spectrumLeft[i] to zero in your startup code. This is the simplest form of IIR (Infinite Impulse Response) filter.

The averaging technique your friend Steve showed you is most useful if you have a lot of noise on the analog signal which might occur if you had long wires or you were using adjacent signals to run PWM to a motor or something similar.


User Rank
waveform hardware
Sheepdoll   8/4/2014 2:59:11 PM

Your timing diagrams look similar to the ones I have for my pipe organ playback and paper roll conversions.  May be some similarity here as music is recorded as discreet 'events' which relate to frequency (pitch) and duration.

My preference on the Arduinos when dealing with sample and hold type shift registers, is to cascade the hardware timers.  This is how the USB scanner I showed at EELive! works.

One timer is set to the width of the clock pulse.  This toggles the clock line through the output compare. The cascaded timer (which can be done through the timer configuration) counts the clock pulses and can toggle the output compare pin automatically to generate the strobe.  This keeps the ISR routines small.  The overhead plus a shift of the bit in or out. 

For really tight constraints, Unrolled loops work well.  This is a code space/clock speed tradeoff.  AVRs have a lot of code space.

  Parts Search

185 million searchable parts
(please enter a part number or hit search to begin)

What are the engineering and design challenges in creating successful IoT devices? These devices are usually small, resource-constrained electronics designed to sense, collect, send, and/or interpret data. Some of the devices need to be smart enough to act upon data in real time, 24/7. Are the design challenges the same as with embedded systems, but with a little developer- and IT-skills added in? What do engineers need to know? Rick Merritt talks with two experts about the tools and best options for designing IoT devices in 2016. Specifically the guests will discuss sensors, security, and lessons from IoT deployments.
Like Us on Facebook
Special Video Section
LED lighting is an important feature in today’s and future ...
The LT8602 has two high voltage buck regulators with an ...
The quality and reliability of Mill-Max's two-piece ...
Why the multicopter? It has every thing in it. 58 of ...
Security is important in all parts of the IoT chain, ...
Infineon explains their philosophy and why the multicopter ...
The LTC4282 Hot SwapTM controller allows a board to be ...
This video highlights the Zynq® UltraScale+™ MPSoC, and sho...
Homeowners may soon be able to store the energy generated ...
The LTC®6363 is a low power, low noise, fully differential ...
See the Virtex® UltraScale+™ FPGA with 32.75G backplane ...
Vincent Ching, applications engineer at Avago Technologies, ...
The LT®6375 is a unity-gain difference amplifier which ...
The LTC®4015 is a complete synchronous buck controller/ ...
The LTC®2983 measures a wide variety of temperature sensors ...
The LTC®3886 is a dual PolyPhase DC/DC synchronous ...
The LTC®2348-18 is an 18-bit, low noise 8-channel ...
The LT®3042 is a high performance low dropout linear ...