Last updated on: July 1, 2022, 1:25 a.m.
Ingun is a manufacturer of Test Probes, Fixtures, and various accessories for their fixtures. We use the MA2xxx series from Ingun for most of our designs and have been using the FB-ABF-V-I-MA2xxx Inductive Sensor to automatically detect when a test fixture has been closed.
The sensor outputs a 12V signal when the fixture is closed, 0V when the fixture is open, and this signal needs to be converted to something that can be read by a computer running the test software.
In this tutorial we will :
- Interface an Ingun Inductive Fixture Switch to a SparkFun Pro Micro development board
- Write firmware (using Arduino) for the development board
- Create a python module that can communicate with the device using a USB Serial Port
- Design an enclosure using Fusion360
- 3D print and assemble the Ingun Fixture Switch Reader
If you'd like to follow along or take a look at the design files for the project, they are available on GitHub here: https://github.com/FixturFab/fixture_switch_reader
To interface this sensor with a computer, we will use a SparkFun Pro Micro (3.3V), this development board has an ATmega32u4 processor which makes it easy to implement a USB Serial port to communicate with.
To interface the inductive sensor to the Pro Micro, a voltage divider is used. The sensor outputs 0V when the fixture is open and 12V when the fixture is closed and this voltage needs to be divided down to 3.3V so that the IO on the Pro Micro isn't damaged.
To help indicate if the device is powered and if the switch is closed two LEDs are used. The first LED is controlled by VCC from the Pro Micro. This pin outputs 3.3V when the Pro Micro is powered over USB. The second LED is controlled by Pin-7 on the Pro Micro to show when the fixture switch is closed or open.
To connect the Ingun switch, we used a .1" IDC connector that we already had on hand.
The circuit was prototyped on a piece of perfboard.
After finishing soldering up the prototype, we moved onto developing some simple firmware for it.
The SparkFun RedBoard is compatible with Arduino, which made it extremely fast to get this device up and running. The firmware uses a pretty straightforward processing loop.
The switch state is read and the status LED is updated to the new switch state. The serial command buffer is then checked, and if a command is available it is processed.
To get the switch state, `read_switch` is sent over a serial port, the device will then respond with a '0' if the fixture is open and '1' if the fixture is closed.
After some slight debugging, we are ready to test all of the firmware features.
With the test fixture open, the LED is off.
With the test fixture closed, the LED is on. Let's test the serial port commands work as well.
Serial port works!!
Now that all of the features that are required are working, we are ready to build a Python module to communicate with the device.
Since we use Python for almost all of our software at FixturFab we will build a Python module for controlling the Fixture Switch Reader called FixtureSwitch.
To communicate with the device, the pySerial library is used. A class called FixtureSwitch is created, and within the init method we connect to the serial port.
The 2 commands that are supported by the device are then implemented within their functions in the Python class.
To prevent the device from shorting out within a test fixture, an enclosure will be created. To design this enclosure, Fusion360 was used.
The first step was to create a model of the device. This model doesn't need to look exactly like the perfboarded device but needs to have similar mechanical dimensions so that the enclosure can be designed around the device.
The case will be designed using 2 parts, a bottom half which the device will sit in, and then a top half that will sandwich the device in place. The 2 halves will screw together using M3 heat-set inserts and screws.
The bottom half of the case contains a cutout for all of the leads and solder joints to have clearance along with holes that the heat-set inserts will be inserted into.
The top half of the case contains cutouts for the Ribbon Cable Connector, Power and Status LEDs, and the USB connector. It also has countersunk holes for M3 screws to be inserted into.
The entire case is then put into an assembly to verify that there aren't any clearance issues before 3D printing the enclosure.
Printing the Enclosure
To create the enclosure we will use an inexpensive FDM 3D printer. The STL's of the top and bottom case pieces are exported from Fusion360 and then imported to Cura.
The generated Gcode is then sent to the 3D printer and the parts are printed.
Adding the Heat-Set Inserts
After removing the case pieces from the 3D printer and removing the support material the Heat-Set inserts need to be inserted into the bottom half.
To insert the heat-set inserts, a soldering iron is used. They make special tips for this task, however, we typically just use whatever tip is currently on the iron and then pliers to make sure the inserts aren't pulled out when the iron is removed.
Assembling the Case
The device assembly can now be completed using the top/bottom case parts, the perfboarded device, and 4 M3x10mm screws.
First, the perfboard is inserted into the top half of the case, this makes it easy to align the connectors and LEDs.
Now the top of the case is attached to the bottom of the case using 4 M3x10mm screws.
Adding the Fixture Switch Reader to a fixture
To attach the reader to a fixture, a small strip of VHB will be used. A cable is also assembled by taking a 10 conductor ribbon cable and splicing it to both the Ingun switch (12V, Sig, GND) and the 12V power supply in the fixture (12V, GND).
The reader is then attached to the base in the lower left-hand corner of the fixture, allowing for the status LED to be easily visible.
The switch is then attached to the Intel NUC which runs the test software, which can now read when the fixture has been closed.
This was a pretty straightforward and quick project to complete, we did learn a couple of things along the way:
- Having some 0.100" spaced terminal blocks on hand would be great
- It would have been much easier to connect 12V and the Ingun fixture switch using terminal blocks instead of having to splice wires to a ribbon cable.
- Arduino's are great for quick prototyping, we should always have these on hand
- A larger current limiting resistor on the LEDs would be a good call
- While the LEDs can take 8mA, they are way too bright