Embedded Systems Conference
Breaking News
Oldest First | Newest First | Threaded View
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.




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
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
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/5/2014 7:11:20 AM

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

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.


As data rates begin to move beyond 25 Gbps channels, new problems arise. Getting to 50 Gbps channels might not be possible with the traditional NRZ (2-level) signaling. PAM4 lets data rates double with only a small increase in channel bandwidth by sending two bits per symbol. But, it brings new measurement and analysis problems. Signal integrity sage Ransom Stephens will explain how PAM4 differs from NRZ and what to expect in design, measurement, and signal analysis.

Datasheets.com Parts Search

185 million searchable parts
(please enter a part number or hit search to begin)
Like Us on Facebook
Special Video Section
The LTC®6363 is a low power, low noise, fully differential ...
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 ...
Chwan-Jye Foo (C.J Foo), product marketing manager for ...
The LT®3752/LT3752-1 are current mode PWM controllers ...
LED lighting is an important feature in today’s and future ...
Active balancing of series connected battery stacks exists ...
After a four-year absence, Infineon returns to Mobile World ...
A laptop’s 65-watt adapter can be made 6 times smaller and ...
An industry network should have device and data security at ...
The LTC2975 is a four-channel PMBus Power System Manager ...
In this video, a new high speed CMOS output comparator ...
The LT8640 is a 42V, 5A synchronous step-down regulator ...
The LTC2000 high-speed DAC has low noise and excellent ...
How do you protect the load and ensure output continues to ...