SIGMA MOSFET- Production test rig
This project is about a test rig for one of Smart Armaments products: SIGMA MOSFET -an advanced MOSFET for airsoft electric pistols (AEP). In case you’d like to read more about it, then make sure to check this page. If you’re an engineer interested in developing your own commercial product, then here you will read how I created a budget rig used for product’s programming and quality control.
Table of contents
- Test rig – What is it for?
- Components of the rig
Test rig -what is it for?
After evaluating both hardware and firmware to the point that first customers were satisfied with, there came a time for our first production batch. Having programmed, and tested several boards manually, I quickly got bored with this process and was looking for some optimization (and simply knew that the automated quality control is a must-have). The number of boards we were going to produce was still too small to order pre-programmed MCU’s, and too large to do everything manually. Besides flashing the microcontrollers, we wanted to test (and document) every single board as it was very important for us not to send non-functional boards. Having said that, pre-flashed MCUs didn’t solve our problems anyway as the product still had to be quality controlled.
I decided to design the so-called ‘testing fixture’/‘testing rig’/‘bed of nails’ -a device which will:
- download the latest release firmware from the git repository,
- flash the firmware on the MCU (AVR) using raspberry pi and set its fuse bits,
- run some test scripts to check whether the unit works,
- if successful, set a new serial number so we can identify a product in the future,
- set lock bits to prevent one from reading MCU’s flash memory,
- note down every production stage and update a specific .csv file in our git repository,
- inform the rig operator if there was an error or not.
Components of the rig
The rig was made using some basic tools as well as a 3D printer. A 3mm PMMA plate was used as a base, to which all of the components were mounted. Black blocks that can be seen in each corner are just 3D printed stands screwed to the PMMA plate.
The rig consists of:
- Raspberry PI Model B V1.2,
- Signal distibution PCB,
- DC motor (load),
- Bed of nails,
- User buttons and LEDs (mounted into 3D printed block)
RPI’s role is mainly to automate all of the things the operator normally would have to do and document the production/testing progress of each unit (.csv file). If there is an error, e.g. the MCU can’t be flashed, the operator will be informed with appropriate LED blinking and error codes appearing on the console. All of this is done using python scripts -an easy job :).
Maybe you’ve already noticed that there isn’t any AVR flashing tool. This is because I decided to program our MCU using Raspberry Pi’s GPIO. If you’re interested in this topic, check this excellent tutorial on how to do it.
In a nutshell, testing scripts are responsible for:
- checking if new firmware is available on the git repository and downloading it,
- handling user buttons and LEDs,
- setting fuse bits, then flashing the MCU,
- serial communication (UART) with the MCU: setting new serial number, setting and reading back the firmware’s parameters,
- testing the product’s operation with relays that simulate an airsoft gun with proper sequences of switching power supply and trigger.
As a result, following .csv file will be updated on our git repository:
In the end, the operator is informed with proper LED about the process status: green if OK, red if NOK.
Signal distribution PCB
This PCB was designed not only to distribute all of the signals and power in a clear manner but also to digitally isolate RPI’s signals from the system so it won’t get damaged that easily.
This circuit consists of relays, fuse, power supply (3V3 & 5V LDOs), ESD protection, flyback diodes, and last but not least, digital signal isolation. Gray connectors are used for connecting the power supply (either battery or bench power supply) while blue connectors are intended for the device under test. Minimum 4 wires have to be connected (2 per power and 2 per load) because they are designed to carry high current (tens of amperes). TRIG signals are optional because these signals can be connected through pogo pins on the bed of nails.
It happened to me once, that due to a lack of proper signal protection (flyback diodes in parallel to relays), an induced voltage spike (coming from a dc motor) burnt my raspberry pi. After that, I’ve decided to design this PCB with proper protection, which may seem to be even a little bit more than it should be.
DC motor (load)
An integral part of every airsoft electric pistol (AEP) is a DC motor. It is used for driving the gearbox, which compresses a piston with a spring. Here, this DC motor (which is bigger than motors used by AEPs) serves as a load to test the product’s current measurement and data processing.
Bed of nails
A bed of nails is used for providing electrical contact between PCB’s test points and some controller without soldering or using cables. 9 wires are connected to this module: MISO, SCK, MOSI, RST (for flashing), UART TX, UART RX (for serial communication), and two TRIG signals (to simulating airsoft gun’s trigger).
It was done using two PCBs (one used for positioning) with pogo pins soldered and a 3D printed part that is used for positioning. This has some drawbacks and will get re-designed in near future.
User buttons and LEDs
Not much to say here, just two buttons and two LEDs connected to the Raspberry Pi with some low pass filters on the signal distribution PCB.
The whole process (flashing, testing, and validation) takes ~30 seconds to complete. The bed of nails turned out to bring the most issues and it is still far away from a perfect solution. Some issues simply came from our product’s small test points (1mm). Unfortunately, due to component density and small PCB dimensions, it was not possible to use through-hole test points there. At the end of the day, it’s important to notice that the rig works just fine and automates the work perfectly. The test rig operator’s job is now to:
- correctly place the PCB on the bed of nails,
- connect some high current wires to proper terminals.
It turns out that doing test-rigs can also be an art. Designing it in a clear way with some custom PCBs, PMMA plates, and 3D printed parts provides a lot of satisfaction -unless you burn your Raspberry PI as I did ;).