I'm using an external ADC with I2C, because the signal I have is a differential signal. The ADC I'm using is a sigma-delta type (ADS1110) and I'll be sampling at 60 sps.
My aim was to take ONE reading/sample then compare that reading to a set value. If the reading is too high do one thing, if it's too low, do something else.
Now a little dicky bird told me that I need to sample at a very high rate to avoid errors. So a bit of Googling and I learn about aliasing and sampling at least 10 times the signal frequency, etc.
This is the thing. I'm measuring the voltage of an electric plasma jet stream (from a plasma cutter) so I'm not measuring a frequency. I'm measuring a DC voltage which has lots of switching noise on it.
Would anyone say I'm in the ballpark if I focus on low pass filtering of the signal. The signal is already attenuated and filtered via an LCR circuit, but it's not my circuit and I have no idea what its characteristics are. With a resistor network I'll be attenuating the signal further to about a max of 2v at full scale.
60 readings per second should be more than enough for me, but like I say I'm hoping to be able to take just one ADC reading/sample each time (not multiple readings and averaging). Would a low pass filter work in this situation.
Hi,
You do your averaging using maths in the arduino?
What model arduino do you have?
Take 10 readings, add them together, then divide by 10, bingo, average input reading.
The more readings you use in the averaging, the heavier the filtering.
I know how to do that but that's not what I'm asking. I don't want to average spikey noise readings with "normal" readings.
I'm wondering is it possible to filter the noise out before the ADC, so I end up with a fairly smooth DC signal.
Then my HOPE is I can take just one ADC reading and use the result to compare against my set value. I want to do that 60 times per second, i.e. with the ADC running at 60 sps, I am comparing against my set point 60 times/sec and setting the O/Ps accordingly 60 times/sec.
So in a nutshell, with good enough signal filtering, could I expect to be able to use just one conversion or would I still need take multiple conversions and average them.
I was thinking perhaps an active op amp low pass filter before the ADC input.
If i'm not wrong, a complete theoretical approach to your problem would require a Fourier trasform of your signal (the one you want to measure). The whole matter is beyond my skills.
I would try a simpler solution: your noise have to have a "typical" frequency (clevest people in the forum please pardon me -CPITFPPM) and signal another one (CPITFPPM). You need to measure the speed of variation of both (volts/sec) and then place a RC filter according to them: the speed of variation might be raughfly converted to a frequency (CPITFPPM). The RC filter has to have the cut-out frequency higher than signal lower than noise.
I'm wondering is it possible to filter the noise out before the ADC, so I end up with a fairly smooth DC signal...
...So in a nutshell, with good enough signal filtering, could I expect to be able to use just one conversion or would I still need take multiple conversions and average them.
I was thinking perhaps an active op amp low pass filter before the ADC input.
That can work. The "smoothness" of the filtered output will depend on the nature of the noise and the characteristics of your analog filter.
[u]Smoothing[/u] (averaging) IS low-pass filtering. I'm not sure what kind of electrical or digital filter is equivalent to a moving-average filter, but I know that low-pass digital filters do use averaging (maybe weighted averaging?).
FYI - Aliasing is "false frequency" information, and it happens when the signal frequency is more than half the sample rate. It does not apply to DC.
Well, at this point in time I think I'll go for a 2 pronged attack. I'll try and hunt down a suitable low pass filter, plus I'll take multiple samples and average them in the Arduino. I have no idea about what is the ideal filter circuit, and I don't have an oscilloscope to check, so I'll assume I'll at least be left with some ripple on the smoothed signal. Then hopefully the averaging will take care of the ripple.
For averaging calculation speed, I'll make my number of ADC samples a binary number (e.g. 16, 32, etc) then I can use bit shifting to do fast division after I've added the samples together.
Quote
If i'm not wrong, a complete theoretical approach to your problem would require a Fourier trasform of your signal (the one you want to measure).
Sadly though you are wrong.
How would you do it? (Let's assume you have a sufficiently precise description of signal plus noise).
The easiest form of low-pass filtering is adding a huge cap (try out).
In case you need to separate the circuits, take an opamp with high impedance and smooth the signal beyond.
In case you need more precise frequency filtering, you may create a suitable hardware-bandpass - however, is is a little more advanced.
In my opinion, applying some kind of digital filter is the easiest way to go. This also may easiliy be changed via a software update.
=> The key question is how fast the filter is supposed to respond to changes (!).
Then, there are different possibilities for this with different characteristics. Linear filters like a simple avg, or a low pass gauss, bandpass diff of gauss or some non linear ones like a median filter; For time critical applications, too large FIR filters may be undesired.
Maybe an exponential filter is a better idea...
vffgaston:
If i'm not wrong, a complete theoretical approach to your problem would require a Fourier transform of your signal (the one you want to measure). The whole matter is beyond my skills.
Grumpy_Mike:
Sadly though you are wrong.
vffgaston:
How would you do it? (Let's assume you have a sufficiently precise description of signal plus noise).
To design a proper filter analytically, be it analog, digital, or some combination, one would have to know the spectral properties of the signal plus noise being sampled. Without this, one doesn't know the level of noise to be suppressed by the filter while retaining a reasonable facsimile of the part that one wishes to monitor.
It could be argued that one can get the spectral properties of the signal using Fourier transform techniques, which would be a charitable interpretation of your statement. On the other hand your initial post could be read as "using Fourier transform techniques as part of real-time digital filter processing". Technically that is a possible approach, but is not something that makes sense in this context. I'm assuming Mike had the latter interpretation of the statement as I did on a first reading.
Generally, noise components at frequencies above half the analog to digital converter sampling rate cause issues that are not easily dealt with in the digital domain and should be suppressed to tolerable levels by analog "anti-alias" filtering before the A/D.
Basically in order to design a suitable filter you need to know what sort of interference you want to filter out and how quickly you want the filtered signal to respond to any change in the raw input.
The faster you need it to respond and the closer this response speed is to the interference frequency the more complex your filter has to be.
A huge cap, while taking out interference will leave the filtered signal sluggish in its response.
One of the problems I have is I don't even know what unwanted signals, noise spikes, etc are on the DC line.
The machines are plasma cutters so I'm guessing most have inverter electronics switching power electronics like transistors, etc, to give the controlled DC output. They are normally plugged in 50/60hz single or 3 phase supplies, but as for the inverter switching frequencies I have no idea. Perhaps they vary quite a bit across different manufacturers.
I was working on the theory of a low pass filter not allowing anything else above that frequency through, hoping that would cover a whole range of unwanted signals outside of that range, and therefore I wouldn't need to know what unwanted signals are even there. But maybe it's not that simple.
I'm still waiting on some recommendation for maximum needed readings per second but I'm guessing even as low as 30 per second may suffice, perhaps a bit higher. Then I'll probably multiply that by 16 to give my ADC samples/sec, so I can average those sets of 16 samples.
So you're looking to filter out all frequencies above 15Hz, as your sampling frequency is 30Hz. Picking a resistor and capacitor for that should be pretty simple with all the online calculators available.
Note that a low pass filter does not remove all signal components above a certain frequency but it attenuates them. By how much depends on the filter and how high the frequency is.
Grumpy_Mike:
Note that a low pass filter does not remove all signal components above a certain frequency but it attenuates them. By how much depends on the filter and how high the frequency is.
Exactly Mike,
that's why I'm looking into multi-pole active filters.
I'm a beginner to all of this but from what I've studied so far a multi-pole filter is going to give me more "brick wall" characteristics and give better attenuation outside the cut off frequency, than what a simple passive RC filter will. I want to get as close as possible to the sampling frequency then sharply cut off everything above that as much as possible. I'll have to watch the phase shift though with a multi-pole filter to check it won't add too much delay to the measured value.
I don't know if I'm going overboard but just want to cover all my bases.