This post describes a process for integrating a BCL-AMP capacitive sensor to LinuxCNC. These capacitive sensors are typically used for height sensing in fiber laser cutting systems. The sensors come potted in an aluminum case with a small coax connector to connect to the laser head and a GX16 4-pin circular aviation connector to drive the device. We've been trying to get this working for a while at our hackerspace (sector67.org), and were finally able to get it working.
The amps look like this:
There are a number of capacitive sensors with this same basic form factor. This post covers the “BCL-AMP Amplifier Preamplifier Sensor For Friendess BCS100 Height Controller FSCUT1000 FSCUT2000 System” amp. As of the time this article was written, this amps is available for $56 US at
www.aliexpress.us/item/3256804585924423.html.
Electrical interface to the amp
The functionality of the GX16 4-pin circular aviation connector on the amp seems to be one of the great mysteries of the Internet. As far as we have been able to find, no data sheet or manual for the amp exists, and the circuit diagrams provided by machine integrators do not provide enough detail to determine how to interface with the amp. As a result, we’ve had to reverse engineer the device to determine how to properly interface with it. The results of that experimentation have led us to the following pin functions, with the pins numbered per the GX16 connector spec:
PinFunctionNotes1+5V DC5V DC supplied to the amp2Signal outA ~5V variable frequency pulse train output3GND0V DC supplied to the amp.4SHIELDThis is the one pin that you can find conclusively documented on the Internet. This pin should be tied to the cable shield. Internal to the amp, pins 3 and 4 are tied together to the ground plane, with pin 3 going through an RF choke inside the device.
With this hookup and some capacitive input on the small coax connector you can observe a variable-frequency output on pin 2 of the amp.
Isolating and cleaning up the amp output
The variable frequency output of the amp is unfortunately not a very clean signal. To clean up this signal we used a SN74HC14N schmitt trigger:
which creates a much cleaner square wave. VCC is wired to +5V and per the data sheet all of the inputs except for one are tied to ground so they don’t float. The output of pin 2 on the amp is wired to one of the trigger inputs, and the output of the trigger is wired to our Mesa 5i25 hostmot2 encoder A-phase input. The SN74HC14N also provides a modest level of signal isolation.
Capacitive frequency response
The following values were measured in a bench setup using a variable capacitor:
CapacitanceFrequency85nF2.50MHz123nF2.00MHz166pF1.67MHz210pF1.54MHz233pF1.44MHz
The response is not linear. The closer the metal is to the laser head (the higher the capacitance), the lower the frequency output is. When there was a short the output frequency drops significantly.
Interfacing to LinuxCNC
Because the amplifier outputs a variable frequency signal, the output of the amp can be treated as an encoder input with the velocity representing the value of the signal. This makes it conceptually similar to a THCAD Mesa device. We are using a Mesa 5i25 board for high speed I/O, and so we can configure a hostmot2 encoder (
linuxcnc.org/docs/html/man/man9/hostmot2.9.html#Encoder) via pncconf to read the amp output. Since we are only reading a pulse train and not a quadrature encoder this encoder needs to be in “counter-mode” so that each rising edge of the phase-A input is counted, and the value on phase-B is ignored.
The relatively high frequencies output from the sensor (up to ~3MHz) create some special considerations for interfacing. The Mesa card’s FPGA is fast enough to read the signal, but for the fastest signals of the amps, the “filter” setting of the hostmot2 encoder should be set to “False” since 15 sample clocks at 25MHz is too long to successfully sample a ~3MHz signal. The non-default (filter = false) 3 clocks should be fast enough, and with the schmitt trigger the signal is clean enough to work well with a three clock transition.
(bit r/w) filter
If set to True (the default), the quadrature counter needs 15 sample clocks to register a change on any of the three input lines (any pulse shorter than this is rejected as noise). If set to False, the quadrature counter needs only 3 clocks to register a change. The default encoder sample clock runs at approximately 25 to 33 MHz but can be changed globally with the sample-frequency or muxed-sample-frequency pin.
Your hal file will need something like the following:
setp hm2_5i25.0.encoder.00.counter-mode 1
setp hm2_5i25.0.encoder.00.filter 0
With this configuration in place, you can use Halscope or Halmeter to see the “velocity” response of the encoder change with the distance to the metal. The effective response range is around 0.1 inches.
As of LinuxCNC 2.9.2, pncconf does not enable setting the filter of the encoder, so I’ve created a shell script with the Linux sed tool to fix the generated configuration:
sed -i -e 's/^setp hm2_5i25.0.encoder.00.filter 1/setp hm2_5i25.0.encoder.00.filter 0/' ~/linuxcnc/configs/laser_cutter/laser_cutter.hal
The output of the encoder velocity from a 0.1” Z move can be seen below:
Our next steps are to set up plasmaC and use the capacitive sensor encoder's "velocity" value to hold height over the work piece.