signal-to-noise 10DOF breakout

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
flybozo
 
Posts: 18
Joined: Sun Feb 09, 2014 8:03 am

signal-to-noise 10DOF breakout

Post by flybozo »

I'm building an arduino-based variometer for paragliding using the Uno, the Ultimate GPS shield, and the 10DOF breakout board. Ideally, the variometer will activate a buzzer that will give me audible feedback with a frequency that varies according to my rate of ascent. I'm having good success so far, and I have the 10DOF board sending very sensitive altitude information. Too sensitive, in fact, and just sitting stationary on my desk it is sending values that look like this: -.20 m/s, +.17m/s, -.05m/s, +.37m/s etc... I was able to minimize the variance by averaging 5-10 or more successive measurements. This is very close to being functional for me, but I'm looking for a more sophistocated (and hopefully faster) signal-to-noise algorithm and I'm hoping someone has already written something for the Arduino. My experience with signal-processing is limited...

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: signal-to-noise 10DOF breakout

Post by adafruit_support_mike »

You're on the right track. Let me fill in enough theory to help you choose the kind of average you need.

We define the ability to measure a signal as being able to see it rise and fall within a given amount of time. It's physically impossible to measure signals faster than you can observe them. Taking repeated measurements is called 'sampling', and since you need one 'rise' value and one 'fall' value to count as a measurement, you need two samples per cycle of the fastest signal you want to measure.

We define the resolution of a measurement as twice the expected error in any given measurement. There's no such thing as a 'perfect' measurement, so we stick to having beter than 50% confidence to prefer the value we've chosen over the next higher or lower value.

The improve SNR, we use a technique called 'oversampling and decimation'. Oversampling just means you take more than two samples of the fastest signal you want to measure, and it's a good idea to do that anyway. Decimation means reducing several measurements to a more reliable average.

For any signal that contains noise, the energy contribution from the noise will average out to zero over time. If it didn't, noise would be a source of infinite free energy. Statistically, every time you take the average of two measurements that contain noise, the noise in one measurement will cancel some of the noise in the other measurement. The expected error of the average is half as large as the expected error of the original measurements, but that doesn't help SNR as much as you'd think, because the average is halfway between the two original measurements. Both original measurements are still within 50% the expected error of the average.

If you take the average of four measurements, the expected error is reduced to 25% of its original size. Resolution is twice the expected error though, so you can trust the average of four numbers to twice the resolution of the original measurements.

You can apply that pattern as many times as you want. Each time you quadruple the number of samples in your average, your SNR improves by 50% and you get twice as much resolution.

The downside is that your effective sampling rate gets divided by the number of samples you use for each average. If you want to sample a signal that can rise and fall once per second (1Hz), you need at least two samples per second (2Hz). If you want to improve the SNR by a factor of 16, you need 4 more bits of resolution. That means you need 4^4=256 actual samples per effective sample. To maintain your 2Hz sampling rate, you'd need to oversample at 512Hz and decimate to 2Hz.

flybozo
 
Posts: 18
Joined: Sun Feb 09, 2014 8:03 am

Re: signal-to-noise 10DOF breakout

Post by flybozo »

Thanks, Mike. I also have another issue--I'm having a problem merging the shield_sdlog sketch for the GPS shield with my 10DOF sketch. Just loading in only the included libraries from my 10DOF sketch is enough to break it. The serial output is garbage, like I have the wrong baud, but I don't. If I add the 10DOF sketch into the "parsing" sketch, it works fine--both the GPS and 10DOF board send output to the serial monitor. Any idea what the conflict is between the SD logging drivers and the 10DOF drivers?

flybozo
 
Posts: 18
Joined: Sun Feb 09, 2014 8:03 am

Re: signal-to-noise 10DOF breakout

Post by flybozo »

Nevermind...I found a previous thread that says I was overloading the the SRAM with wire.h and the GPS logger at the same time. Arduino Mega, here I come...

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”