Welcome to the Parallax Discussion Forums, sign-up to participate.

# capacitive distance sensor

Posts: 909
I have a capacitive distance sensor that is used for THC (torch height control) for plasma or fuel/oxygen cutting. It consists mainly of a metal ring that is placed around the torch tip and moves a few millimeters above the sheet metal to be cut. The original sensor uses an analogue circuit and is sold for lots of money (~\$400). I have the feeling that this could be done cheaper and better theese days, digitally and of course with a propeller.

The metal ring (see picture) has around 50mm inner and 80mm outer diameter. I measured the capacitance against the metal surface with an LCR meter. It's between 30pF when nearly touching the plate and 20pF when held 100mm above it. Of course the relation is highly non-linear but that's not the problem. It could be corrected easily with a lookup table.

I have a few ideas for the measuring principle:
1) RC decay. Because of the low capacitance this would need a very high resistance of >1Mohm to achieve reasonable resolution. I think near a source of lots of ionized particles (smoke from the plasma arc) this is not a good idea.

2a) build an LC oscillator and measure the resonant frequency. This can be done very easily with a counter. However, I don't know what influence the parasitic effects have. The ground plate can't be connected with a short cable as the sensor is moving long distances horizontally.

2b) do the same with an RC oscillator.

3) apply a high frequency signal with fixed amplitude and frequency and measure the AC current. If the frequency is high enough and the signal current is well above the leakage current this should work relativey independent of the ground impedance (length of ground return path). However, small HF AC currents are not easily measured accurately.

I know that capacitive sensors are used in scales with amazingly high precision. This is achieved by measuring differentially. The sensor plate moves between two reference plates, both capacitances are measured and the ratio is calculated. This way all unwanted effects like thermal expansion and drift of component values are cancelled out. In my situation this is not possible. But on the other side I don't need high precision. 0.1mm resolution and 1mm accuracy in the range 1..20mm and 5mm accuracy to 100mm distance would be sufficient.

Anyone who has a different idea or knows a schematic trick that could be helpful?

Of course, protection is important. In the case of a crash the arc (up to 200V and 300A) could hit the ring. The ring can be replaced quickly but the circuit should survive this. The arc current is DC so a T-filter with two high-voltage caps and a gas discharge tube (used for lightning protection) should do the job. The caps are effectively in series with the capacitance to be measured. If they are 1nF or greater their influence can be neglected.

• Posts: 150
Not knowing about them, I would worry about the high noise around a torch. Would a Ping-type ultrasonic sensor give enough resolution ? You could measure many many samples to get a running average.
• Posts: 1,465
I believe a torch is very noisy. But a capacitor as part of an oscillator creates a signal of only one frequency which can be isolated by a notch filter from any EM-disturbances
• Posts: 21,233
Sounds like a ping sensor would melt!

• Posts: 190
I'm guessing the torch position needs to be pretty accurate as well as it moves over the metal. I've got a cap distance sensor from Lion Precision on my desk right now that we are testing for some lab measurement applications and it has RMS noise in the 10-100's of nm depending on the range and model. Unfortunately their tech library does seem to say much about the signal conditioning approach. I'm wondering if they make an oscillator and tune it with a control loop? That could be too slow though.
• Posts: 1,465
edited August 2016
What if the ring is split into two halfs. Both show an offset. As capacity goes one over distance, as long as the distance is relatively large, two oscillators should create the same frequency. Coming closer, one oscillator (the closer one) lowers frequency faster than the other, so the beat frequency goes up fast, what should be to detect simply
• Posts: 150
Heater. wrote: »
Sounds like a ping sensor would melt!
The ping can work at larger distances, so it wouldn't need to be placed near the torch. Plus it is intrinsically linear.

• Posts: 190
With a ping the speed of sound deviation with temperature near the torch would need to be considered.
• Posts: 909
There are reasons that none of the plasma THCs I've seen use ultrasonic sensors.
* the cutting arc produces lots of hot air and smoke. Speed of sound changes with temperature and density of the gas.
* to blow out the molten metal in the cutting gap compressed air or even special gases (nitrogen, argon...) are used. Changing "side winds" and turbulences are bad for ultrasonic devices and cause noise in the signal.
* you can't center the measuring spot to the torch tip center unless you'd use a "ring" speaker or multiple sensors around the torch. Then you'd have to use an averaging or voting strategy. That doesn't work well, we already tested that. If you cut near the edge or corner of the sheet metal there's one or two sensors giving false signals or none at all. With the capacitive ring sensor you only get a small deviation.

Noise is definitely a problem. The LC or RC oscillator approach would have the advantage that we could switch to a different "channel" (frequency range) by exchaning the R or L component if one channel is too noisy. Counting many periods (for example a 50..100MHz signal over a 10ms interval) also helps averaging out noise. BTW, an LC oscillator is a narrow bandpass filter by nature. An RC oscillator might be sensitive to overtone ringing depending on the type of circuit used.

Method 3 should also give stable results if a good current measurment startegy is used. A wideband AC current meter would be useless because it would also measure the noise. But a synchronous rectifier locked to the oscillator frequency should cancel out all other frequencies (except for the even overtones). How do we build a good current measurement circuit with narrow passband? This is effectively an AM receiver. I'm not very good in designing HF circuits. Wasn't there an app-note about building radio receivers with the propeller somewhere?

The THC uses a control loop to keep the torch distance constant even if the sheet metal is not perfectly flat or buckles up due to local thermal expansion. The nozzle normally moves a few millimeters above the surface. No higfh accurary is required but it would be good if the tip to workpiece distance could be kept within +/-10%. A sample period of 20ms or faster would be good to get quick response. (20ms translates to 1mm horizontal movement with 3m/min cutting speed).
• Posts: 909
BTW, most plasma cutting machines measure the arc voltage to "guess" the torch height. This is relatively simple (voltage divider) and works as long as the current, the gas flow, the cutting speed and the surface quality is constant and the electrode tip condition is good. However if...
* the nozzle wears out and the gas flow rate changes,
* the cutting speed can't be kept constant due to slow-down in corners,
* oil, rust or dirt is on the sheet metal surface or
* the electrode wears
the THC needs to be re-adjusted (or deactivated at corners). A THC using a capacitive sensor doesn't have this disadvantages. It measures height inpdependently of the arc and even works when the arc is off (starting height before ignition) or if there's no electrical arc at all (fuel/oxygen or waterjet cutting).
• Posts: 909
I've re-read the Propeller Education Kit Labs article about metal detection. Now I think, all measuring methods using the C of the sensor in a resonant circuit is not usable. If a coin near a 2" wire loop has so much influence on the resonant frequency then a machine moving several meters over a big metal plate has even more. The parasitic L component of the ground return path changes much more than the capacitance to measure, I fear.

So here is idea #4: Build a capacitive voltage divider out of the C of the sensor and a reference capacitor. Apply a square wave to the divider input and measure the AC voltage (via synchronous rectification) at the divider output. The square wave frequency should be well below the resonant frequency of the parasitic LC circuit, but high enough so that leakage currents don't disturb much. I'll try something between 100kHz and 1MHz. I think with a clever circuit the rectification can be done completely in software so that the input is purely linear and passive. This would avoid accidentally de-modulating RF noise or saturation effects (clipping if noise peaks are outside the DC input range).
• Posts: 190
What about an LVDT type sensor with a small caster on it? Trailing behind the torch it might survive. It should be very accurate, relatively cheap, and not subject to material changes.
• Posts: 909
An LVDT sensor (linear variable differential transormer) needs physical contact to the surface, I'd think. You'd either need many sensors around the torch or some complicated mechanics. Watch those videos to see why this won't work:
http://plasmacut-cnc.de/index.php/home/hoehenregelung
The picture "Gleitring" at the top of the page shows the possible arrangement of multiple sensors. The two videos at the bottom demonstrate how the THC works and how a collision could happen.

There is dross around the cut behind the torch. Small pieces fall out of the material and leave a hole. Medium sized pieces can tilt after being cut out. Please believe me that a contact-less distance sensor is superior to other methods and stop suggesting alternatives. Lets focus on how this could be implemented with a propeller.

A ring shaped sensor has the advantage that it protects the torch. As soon as it touches the workpiece it signals "short circuit = infinite capacitance = zero distance". As consequence, the vertical axis motor moves the torch up as fast as it can. If this is not enough to avoid a collision then the torch mounting frame held by magnets or spring couplings detaches and triggers an emergency stop of the horizontal drives.
• Posts: 909
First trial:

With the scope I get a stable signal from 730mV (distance 1mm) to 860mV (100mm). the difference is lower than expected because the input capacitance of the probe dampens the signal.

The second circuit uses a counter of the propeller in feedback mode as sigma-delta A/D converter. I get readings from 170,000 @1mm to 240,000 @100mm. So at least it works. Unfortunately, the output is very noisy even without the plasma arc. I think I have to try out a real ADC.
``````              mov CTRA,modeAdc
mov FRQA,#1
mov t,CNT
mov l,loopCnt
mov dcnt,#0
posOut
waitcnt t,time1us
sub dcnt,PHSA
mov PHSA,#0
negOut
waitcnt t,time1us
mov OUTA,#0
mov PHSA,#0
djnz l,#posOut
wrlong dcnt,PAR

time1us       long      80
modeAdc       long      %01001<<26 + pinFb<<9 + pinIn ' POS w/ feedback counter mode
loopCnt       long      10000                   ' 20ms = 10000 * 2µs
``````
• Posts: 190
ManAtWork wrote: »
First trial:
Unfortunately, the output is very noisy even without the plasma arc. I think I have to try out a real ADC.

Would you be opposed to buffering with an instrumentation amp, low pass filtering, then amplifying the output so you have a larger output voltage range? If you put the buffer amp pretty close you might kill a bunch of the common mode noise when the torch is on.
• Posts: 909
I think the reason for the noise is not the low signal level but from the imperfect design of the sigma-delta ADC with synchronous rectification in software. Each time the square wave changes state an unknown amount of charge in the 1nF capacitors is carried over to the opposite phase of the add/sub to dcnt.

And IMHO an instrumentation amp does not help much in this special situation. The ground level of the sensor capacitance is meters away from the ground of the circuit and a large current (>100A!) flows through the machine base so we have a real awful ground-bounce. But any offset or common-mode noise does not hurt as long as the frequency is not equal to that of the square wave.

We must also be careful that the input amplifier is not saturated by noise spikes. Example: there is a +10V 1µs spike followed by a -5V 2µs spike. They would normally cancel out each other to an average of zero. But if the higher positive spike gets clipped away by input range limitation the resulting average (low pass filtered) output is different from zero. Therefore I'd like to put the passive filter before any input amplifier.

Because of the low sensor capacitance and the high input resistance the whole thing is very sensitive to HF noise. The sigma-delta ADC has the advantage that it virtually has a current input and no voltage input. the two 1nF capacitors form a low pass and are clamped to an almost constant voltage level by the counter feedback.
• Posts: 1,981
A capacitive sensor can work with gas/oxygen cutting, it cannot possibly work with an arc welder, don't
even think it! That's a harder detection problem than direct imaging of ex-planets I suspect...

An inductive proximity sensor would be more robust, but still probably out-matched by a heavy nearby arc.

Sub-mm radar then suggests itself (does such technology exist even? Unclassified I mean)

My vote is for something like a ceramic spring loaded physical probe or probes. You can get zirconia ball bearing
races these days, high tech material in a low-tech sensor.
• Posts: 909
Mark_T wrote: »
A capacitive sensor can work with gas/oxygen cutting, it cannot possibly work with an arc welder, don't
even think it! That's a harder detection problem than direct imaging of ex-planets I suspect...

Come on! Difficult does not mean impossible. I know that it can be done. Why? As I said in the first post: I own one that works. Anybody who does not believe can buy one here: http://www.agelkom.com.tr/prod02.htm Look at the pictures, watch the videos. And I've been in Turkey personally back in 2005 and saw an earlier version with my own eyes. It works, believe me.

If noone here can help me, I'll do it the hard way, tear that thing apart and reverse engineer it.
• Posts: 190
It is a difficult problem - for a one-off the ~\$400 might not be a bad deal comparing the amount of time it will take to work out the kinks/reverse engineer. Without knowing more details about the RFI environment and some test data it's just hard to know.
• Posts: 909
Yes of course, I wouldn't reverse engineer it just to save \$400. I don't have to anyway. As I said, I already own one. But I have a customer who sells 30 plasma cutting machines a year. That's \$12,000.
• Posts: 96
edited August 2016
Mark_T wrote: »
A capacitive sensor can work with gas/oxygen cutting, it cannot possibly work with an arc welder, don't
even think it! That's a harder detection problem than direct imaging of ex-planets I suspect...

An inductive proximity sensor would be more robust, but still probably out-matched by a heavy nearby arc.

Sub-mm radar then suggests itself (does such technology exist even? Unclassified I mean)

My vote is for something like a ceramic spring loaded physical probe or probes. You can get zirconia ball bearing
races these days, high tech material in a low-tech sensor.

I've seen capacitive sensors on the flame cutters. 1500 amp Plasma cutter uses a physical switch to find the initial position, then retracts it and sets Z to maintain constant voltage across the arc. (Underwater)

In a pinch, I made a sensor out of a 556. One side as a free running oscillator (It will work with surprisingly low capacitances if you charge/discharge using a resistor from the output), and the other in the classic 'tachometer' arrangement triggered from the oscillator to give an approximation of 5-8V signal for distance. Don't use the Cmos version, it doesn't work well when operating the capacitor from the output. It can be located on the head to minimize cable capacitance.

Of course, you could just use a 555 and count the frequency also. much more resistant to noise.

I've made some amazing measurements from free running oscillators in a 556. One coupled to the measurement, and one with a reference capacitor running at a frequency somewhat removed from the expected range of measurement (They will 'lock' if frequencies get too close) Count the freqs with the Prop, and compensate for temp etc by the drift of the fixed oscillator.

• Posts: 909
Ok, agreed, the simplest solutions are sometimes the best. I could also replace the old 555 with an equivalent circuit of low leakage analogue switches and a high precision comperator to improve drift. A possible disadvatage of an RC oscillator is that it always triggers earlier if there is noise interference, so the frequency tends to become higher and the error is not averaged out by counting over a longer time period.

I have opened the Agelkom sensor. No complicated circuits inside. Only one LM339, several transiostors, voltage regulators and pasive components. There is a coil near the BNC connector that looks like the adjustable filters in older radio receivers.
• Posts: 909
I've just made a test with the folowing circuit:

It's the capacitive voltage divider aproach with synchronous rectification in hardware, this time. The switch is a 74HCT4053. The two outputs go to sigma-delta ADCs implemented with propeller counters with feedback.

Now, I get very stable results with very little noise.
• Posts: 190
Any idea what a rough calibration/sensitivity is?
• Posts: 909
Err, sorry, I don't understand the question.

Surely, I'll need some calibration. The capacitance to distance relation is non-linear by nature and there's an offset depending on cable length and mechanical arrangement. I hope there's not much temperature drift as the circuit is differential and any drift phenomenons should affect both channels equally.

I plan to implement some auto-calibration procedure. Maybe something like this: Place the sensor 1mm above the material, press a button. Increase the distance to 10mm, press another button. Repeat for 100mm. The propeller calculates a plynomial interpolation table and stores it in the EEPROM.

Absolute accuracy is not that important as long as the results are repeatable. The optimum cutting distance has to by found experimentally, anyway.
• Posts: 8,673
You may want to decrease the step size and increase the number of steps to at least 5. When I was calibrating instruments the usual step sizes were 0, 1, 2, 5, 10, 20, 50, and 100 percent of of full scale.
• Posts: 190
@ManAtWork I was just curious as to how small of a distance change you were able to reliably resolve. The calibration set @kwinn proposed works pretty well for sensors that are linear. Depending on what the curve looks like for this, you may have to do dense spacing in certain areas and less dense in others. Maybe a 0, 20, 40, 60, 80, 100% of full scale would even be enough.
• Posts: 1
hi,
Are you finished this project? Do you have a commercial version?
• Posts: 909
Umm, no, unfortunatelly not. My friend and "test customer" has moved and sold his plasma machine. :-(