I normally get by with lots of Googling and reading but I've been at this one for days and I'm starting to wonder where to look.

I'm trying to design something called a torch height control for a cnc plasma cutting table. For those that don't know, a plasma cutter slices through metal with a high velocity jet of "plasmerized" gas (air in my case). A torch height control monitors the arc voltage, which represents the torch height from the metal surface. If the voltage is too high, a signal is sent to lower the torch, and visa versa. The plasma "arc" is DC voltage, but as you can imagine there's one heck of a lot of noise on the DC lines. You'll have the switching noise (frequency ????) from the inverter, plus whatever nasty spikes get added by the plasma arc itself.

So I need to be able to read this voltage about 30 times per second. My thinking was to use an active low pass filter to filter out everything above this relatively low sampling frequency. Using filter design software I could get a fairly good Butterworth filter BUT the phase delay through this filter was around 40 milliseconds, much more than I'm happy with. I want my closed loop control to be as tight as possible so 40 mS is quite a bit of lag.

Does anyone have any alternative suggestions for how I can extract a "clean" DC voltage measurement 30 times per second without the phase lag. Am I going to have to do something like high speed ADC sampling with averaging.

The plasma voltage will be attenuated with a resistor network so I have a full scale voltage about 2v.



  • 2
    \$\begingroup\$ Without knowing what the input signal looks like it's total guesswork. Post an oscilloscope shot. \$\endgroup\$
    – Andy aka
    Oct 8, 2015 at 10:48
  • \$\begingroup\$ You can't design filters in hardware nor software without defining the nature of the noise first. It is lots of constant jitter, is it occasional spikes, is it occasional jitter etc? \$\endgroup\$
    – Lundin
    Oct 8, 2015 at 11:00
  • \$\begingroup\$ If possible do an FFT analysis - either using a scope, or on your sampled data - to determine the noise power spectrum \$\endgroup\$
    – Icy
    Oct 8, 2015 at 11:13

4 Answers 4


You need to flip the question round the other way. It's quite easy to make a filter to a specification, once you have a spec. What you need is to derive the right spec for your application.

The whole purpose of your system is to maintain the height of your plasma cutting torch, that is, servo its voltage which is a proxy for height. I'm guessing that there exists some sort of motor that can raise and lower the torch.

So what you have is a closed-loop control problem. I think you understand this, I notice your comment about phase lag. I am guessing that you understand this can make the loop harder to design and stabilise. But it is one thing to be nervous about phase lag when trying to design a filter, and quite another to go from the requirements of loop control bandwidth and stability, to arrive at a specification for the filter.

One of the first things to recognise in this control problem is that the noise on the voltage measurement will get through to the torch as a height jitter. However, by designing your loop, you will be able to attenuate this jitter. In a well designed loop, it will be attenuated so much as to be negligible. 'As tight as possible' is not really a specification!

So the first major spec point is, what is the permitted height jitter of the torch at any given jitter frequency? If the frequency dependance of that spec makes it too intractable to arrive at, the total peak to peak jitter in a bandwidth can substitute, but that would need other approximations.

Knowing that permitted torch jitter, and the noise on your voltage measurement, will allow you to specify your closed loop transfer function that will achieve the attenuation. This comprises the system gains, motor lags, acceleration sensitivities, as well as any explicit filters you add.

If this is enough to put you on the control loop path, all well and good. However, it may be completely new to you, and if so, you're not going to become an expert in it overnight. This is probably too complex a situation to learn on.

So as a second best, let's turn the question back to what you asked. I guess once you have a fast enough filter, you can use it to drive a packaged height controller, and hope'n'poke some sort of stable loop.

The fastest filter, the lowest phase lag, will be to use a digital 'box-car' average function, in processing after the ADC. It simply adds all the samples together over the most recent period of time. If you are sampling at 1000Hz, then a 20mS second box-car will add the previous 20 readings together. This filter will have a latency, an average time delay, of 10mS seconds, half the length of the box-car. That time delay will set a limit on the loop bandwidth you can acheive in your loop, it may be acceptable, it may not. It is very easy to adjust.

Where your noise is expected to be periodic, and here I would expect the mains frequency to have a big contribution to the measured noise, the box-car filter will excel, by putting deep attenuation notches at the line frequency. For instance, in 50Hz land where I live, a box-car that is 20mS long (or a multiple of 20mS) will completely remove all mains frequency noise and its harmonics. In 60Hz land, make the box-car a multiple of 16.7mS long.

The ADC will need to be preceded by an analogue anti-alias filter. The bandwidth of this filter is chosen to be just narrow enough for the sampling rate, and no narrower. This means its phase delay will be negligible compared to the digital filter and the mechanical components in the height adjust.

  • \$\begingroup\$ The anti-aliasing bit is interesting. I've read that because I'm measuring DC then it's not necessary. Just like you have suggested though, the boxcar filtering (oversampling and averaging) was recommended. \$\endgroup\$
    – Beefy
    Oct 9, 2015 at 4:50
  • \$\begingroup\$ @Beefy Not quite DC - if your input varies and you have to control stuff, it's a frequency band, just maybe a low one of up to a few Hz. A filter that gives exactly DC would be of infinite length and you'd end up with a const. \$\endgroup\$ Oct 9, 2015 at 6:43
  • \$\begingroup\$ I had never really noticed the boxcar's ability to perfectly cancel the mains harmonics. What other simple filter techniques can maintain the nulls at mains harmonics with better stopband rejection? \$\endgroup\$
    – Mike
    Jun 6, 2017 at 17:28
  • \$\begingroup\$ @Mike You can convolve the boxcar filter with any other filter you like, and the resulting attenuation will be the product of the two filters, so nulls at the harmonics plus the good stopband of your other filter. \$\endgroup\$
    – Neil_UK
    Jun 6, 2017 at 18:29

You have to first get some idea of the frequency component of the noise. If there is significant noise in the frequency range of signal variations that you want to react to, what you want can't be done at a fundamental level. The slower the control system, the more noise you can reject.

If you want to push this as close to the limit as you can, you should be sampling much faster than the control period and apply digital filtering on the sample stream. Digital filters allow accurately controlling tradeoffs, which get very sensitive to part tolerances as the filter gets more complex. You can trade off group delay with computation to some extent, whereas in analog that would be group delay versus complexity and sensitivity to part values.

  • \$\begingroup\$ I think I see what you are saying. With faster ADCs, digital filters, etc, I'm using there computational speed to reduce the delay from reading to getting an answer so to speak. I'm starting to like the whole idea of replacing analog filtering with digital. \$\endgroup\$
    – Beefy
    Oct 9, 2015 at 4:56

I would avoid using an analog filter. Sample directly with a higher speed ADC, and use a digital filter. You could also consider non-linear filtering (like a median function) if you can characterize the length of the noise spikes.

  • \$\begingroup\$ Thanks everyone, I thought there were no answers because I received no notification in my email. There are generic torch height controllers out there which pretty much work on most plasma cutters. From searching it seems the inverter frequencies are around the 20Khz mark (IGBT) or the 100Khz mark (mosfets), but I'm sure there'll be other variations. \$\endgroup\$
    – Beefy
    Oct 9, 2015 at 4:06
  • \$\begingroup\$ Talking about oversampling and digital filtering I'm trying to get my head around this Sigma Delta ADCs which are supposed to have this built in. The "external" sampling rates are quite low (mine is from 15-240 sps) but I believe the true sampling rate is much higher. I've read that all that may be needed with such an ADC is an external low pass RC filter. \$\endgroup\$
    – Beefy
    Oct 9, 2015 at 4:23

As the other answers say, you have to come up with specifications of all three of the input (noise across the spectrum), the output (control precision across the spectrum) and the stuff in between (control latency etc.) before you can meaningfully choose a filter to use.

One thing to note is that whatever is used to raise/lower the torch, it is a part of overall control loop filter. Mechanical stuff is often low-pass or thereabouts. For some sensible combinations of requirements it might be the only filter you need, and even if you don't, you add extra filtering ontop of this existing "filter".

In theory, you cannot have a filtered signal without phase lag. The lowest frequency the filter can reject depends on it being enough length to see a sufficient part of the waveform of that frequency. Thet being said, there are filters better than averaging (boxcar) and even than successive averaging (multiple boxcar).

Am I going to have to do something like high speed ADC sampling with averaging.

If you do high speed ADC sampling (a route I can recommend) you are effectively replacing a pre-designed "active low pass filter" with a "software low pass filter", which you can construct to be of arbitrary complexity based on actual data you measure in your actual circuit (including ADC noise spectrums and servo latencies). The disadvantage is... well, gotta write the software.

  • \$\begingroup\$ I do know that one manuf. is using high speed ADC with averaging. Here's a YT video of my table in action: youtube.com/watch?v=miQDe4IuCTY and another table using a generic off the shelf THC: youtube.com/watch?v=nY5X3XuuwEk The THC simply gives out an UP signal or a DOWN signal. It only needs to do this about 25 times a second to give enough control so it's relatively low speed closed loop control. I'll also have an adjustable dead band (normally about 1v) to stop overshoot and oscillations in the mechanics. \$\endgroup\$
    – Beefy
    Oct 9, 2015 at 4:29
  • \$\begingroup\$ I'm starting to wonder if I'm worrying too much about the phase lag. In the big scheme of things it may not matter too much. If the system is behind only a few tens of milliseconds the torch voltage should still be kept reasonable close. \$\endgroup\$
    – Beefy
    Oct 9, 2015 at 4:38
  • \$\begingroup\$ @Beefy One thing I would be concerned anywhere near invertors or plasma is high-frequency noise above Nyquist frequency. If you don't filter it and sample it, you might get some low frequencies that are difficult to filter and may affect your control. Raising sampling frequency and thus Nyquist frequency allows for rather simple low-delay RC-filters. For lower sampling frequency you will either build analog filter with longer delay (this might be fine for you) or see aliasing effects (not very nice). \$\endgroup\$ Oct 9, 2015 at 4:58
  • \$\begingroup\$ Thanks Eugene. I forgot to mention my existing system uses a RLC filter to initially attenuate and smooth. I still have to learn how to figure out what frequency it will filter and phase lag it will introduce. It's a differential filter so I first have to find some info on how I work them out, or find an LC filter program that does differential filters. Maybe my manufacturer has this as the analog filter and then used digital averaging after that. I've found a 600+ page DSP book for some light reading LOL \$\endgroup\$
    – Beefy
    Oct 9, 2015 at 21:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.