Home Lab: Building PCB programming / test jigs
Rapid testing of assembled PCBs, and flashing production firmware using 3 simple jigs with spring-loaded pogo pinsIf you assemble your own PCBs you almost certainly want to test the boards, and then flash them with production firmware (for boards with a microcontroller). If you only have a couple of boards, you might use a multimeter to probe each input/output pin, and then plug each board into a USB programmer connected to your PC. But for larger numbers of boards, you really want to make the process as quick and reliable as possible – enter the jig.
jig /dʒɪg/ a device that holds a piece of work and guides the tool operating on it.Oxford English Dictionary
My popular WiFi-controlled stepper motors with ESP8266 board is sold as a kit with all the surface-mount soldering complete, and just the through-hole components left for the customer to solder. I don't produce these in their hundreds, but I wanted to design a simple jig to ensure the part-finished boards were soldered correctly, and then flashed with my firmware.
Three different homemade programming/test jigs using pogo pins
Full credit to Felix Rusu at LowPowerLab.com for his Illustrated guide to making simple jigs for programming and testing article that inspired me.
A) Handheld DuPont programming connector
Many of my designs use a 4-pin header for programming (Rx, Tx, Reset & Flash) that can optionally be soldered with a standard 2.54mm (0.1") pin or socket header. But to program the boards without any soldering, and without having to attach 4 separate crocodile clips, I love this KISS design of threading 4 spring-loaded P75-E2 pogo pins into a 4-way DuPont header:It's easy to connect the other end of the cable to a USB↔FTDI adaptor, breadboard, etc. Power and ground are connected separately, depending on the board: battery, microUSB, etc.
I didn't have a 4-way DuPont header handy, so I glued 4 single headers together, then added a short piece of heat-shrink tube to make it look a little neater. Using the connector hand-held works surprisingly well: I've flashed ESP8266 modules at 921,600 baud (!) and it is as cheap as chips. The downsides are that you need to hold it fairly steady for up to 10 seconds at a time, and that it ties up one of your hands.
B) Handheld jig with custom PCB
A step up from a DuPont connector is a simple jig that remains connected to power/programming/test equipment, and you hold each PCB to be tested in place on top of it. My motor controller board includes a small adjustable voltage regulator module that needs to be set to 3.0→3.6V output before I ship it to customers, because otherwise they may fry the rest of the circuit by accidentally feeding it much higher voltages.Two identical PCBs (white in the above photo) are spaced 6→8mm apart, and joined by 4 spring-loaded P75-E2 pogo pins. The pins are soldered to both PCBs for stability, and the PCB drill holes need to be at least 1.0mm diameter in order to fit the pogo pins. I use some spare PCB hex spacers to get the gap between the PCBs correct while I do the soldering, and you might like to glue at least one spacer in place for added strength, as the thin pogo pins are quite fragile.
On the left side of the jig is a power supply connector (8→28V) to feed into the voltage regulator module, while the right side is connected to a multimeter to read the output voltage. The module only needs to be held in place for a few seconds, lightly compressing the pogo pins, while you adjust its potentiometer (screw) to the desired output.
The jig has space for an optional through-hole load resistor (R1), although the MP1584 modules I use don't require a load in order to provide a stable output voltage. The jig PCBs were deliberately made over-sized for some added physical stability when using it on a bench, plus there wasn't any cost saving to be had by making them any smaller.
Another handheld jig I’ve made is described in my article ESP8266 testing jig/breakout board combo.
C) Clamped jig with custom PCB & pass/fail LEDs
For more complicated boards like my WiFi-controlled stepper motors with ESP8266 that need to be held in place for tens of seconds while flashing firmware, or which require many pogo pins, then a jig with one or more mechanical clamps is much easier to use. Rather than use a separate microcontroller (such as an Arduino) for running the test sketch, a simpler design was to run everything on the microcontroller of the board under test.Two identical PCBs (white in the above photo) are bolted together using four M3 nylon hex spacers in the corner holes of the bottom PCB (with nuts underneath), and then another four spacers screw through the top PCB. This makes the jig rigid, as well as providing a hard limit when clamping the PCB under test (instead of fully compressing the pogopins which would load their solder joints). Only one of the PCBs has the LEDs, capacitor, etc. Finally 24 spring-loaded P75-E2 pogo pins are soldered to both PCBs for stability.
The PCB design was quick using the free KiCad application. Keeping just the through-holes to be tested with pogo pins, all the components & traces were stripped from the production board design. As well as the through-holes, there are four square pads on the underside of the board that also need testing, but pogo pins can be used for these in exactly the same way. The only other components on the test jig PCB itself are some SMD LEDs (with a current-limiting resistor) for visually indicating a test pass/fail, a 100µF power-smoothing capacitor, and a 6-pin connector for 3.3V power & data.
The ESP motors board needs a lot of I/O channels, which is why there are so many pogo pins on the test jig. As well as the ESP8266 module itself, the board uses a 16-port GPIO expander chip with 28 pins at only 0.65mm pin-pitch. This is about as small as I can reliably reflow solder in my home lab (article coming soon), so every pin needs to be tested for a good solder connection, and that there are no solder bridges between adjacent pins. Pins are connected together in pairs by the test jig, one output while the other is input: see Sketch for testing a PCB below for more detail.
Rather than bolt the clamps directly to one of the PCBs (which would require larger & more expensive PCBs), the cheapest option is making a frame from a few bits of scrap wood screwed/glued together, or perhaps 3D-printing one. This also lets you potentially re-use the same frame & clamps with different programming jigs. I decided to make my frame from four horizontal slices of 6mm laser-cut acrylic (perspex) that are then glued together. The central slices are transparent acrylic to make the pass/fail light more visible. Holes for attaching the clamps are pre-cut in the top slice, slightly over-sized so that M3 brass threaded inserts can be melted into the acrylic to provide strong attachment points for the two clamps:
I used the free Inkscape application for 2D design, ready for exporting to the laser cutter. Each colour is a different pass of the laser, at different power/speed levels, so the green lines are cut first to make holes for the brass inserts and blue cuts the outside of each piece. Download files for laser cutting (requires approx 230×190mm) on a 6mm thick sheet:
Future improvements? the pass/fail LEDs could be brighter, but I was limited to 12mA source from an ESP8266 pin. An alternative would be adding 2× MOSFETs switched by the ESP8266, to drive the LEDs directly from the power supply.
It is tricky to perfectly align the PCB onto the pogopins, but adding thin pieces of cardboard as guides to butt the PCB against fixed this problem.
Separating the USB Programmer
Rather than integrating USB↔FTDI adaptor circuitry into every test jig I build, I use the 6-pin ESP Programmer from MottramLabs which can be plugged directly into this jig and provides enough power to flash firmware and run test programs on the ESP8266. Of course you could use a different USB↔FTDI adaptor instead, with a set of 6 individual DuPont wires to get the correct pin order.
The MottramLabs board came with a blindingly-bright green LED that was always-on: not ideal for seeing the green/red LEDs for pass/fail on the test jig! So I swapped their 0805 green LED (D2) with a blue LED and reduced its brightness by changing their 0603 current-limiting resistor (R4) from 120Ω to 1KΩ.
Bill of Materials
Every jig is going to be unique to a given project, but just as an example here is the cost of my clamped jig with a laser-cut frame. It’s even cheaper if you make your frame from scrap wood!
| PCB 50 × 50 × 1.6mm (2 from 5 pack) | £4.20 |
| Angled 2.54mm pin headers (6 from 40 strip) | £0.13 |
| P75-E2 Pogo pins (24 from 100 pack) | £1.49 |
| Green 0805 SMD LEDs (3 from 100 tape) | £0.03 |
| Red 0805 SMD LEDs (3 from 100 tape) | £0.03 |
| 0805 SMD resistor 275Ω (1 from 10 tape) | £0.04 |
| 6mm+6mm M3 nylon hex spacers (8 from a 50 pack) | £0.16 |
| 1206 SMD capacitor 100µF (1 from 100 tape) | £0.03 |
| M3 nylon nuts (4 from 50 pack) | £0.03 |
| Total for PCB, inc P&P | £6.14 |
|---|---|
| 60 lbs toggle clamp (2 pack) | £1.22 |
| 6mm perspex 230×190mm (extruded or cast) | £2.20 |
| Laser cutting charge | n/a |
| Acrylic cement | n/a |
| M3 steel screws 5mm (8 from 25 pack) | £0.95 |
| M3 steel washers (8 from 50 pack) | £0.53 |
| M3 brass threaded inserts 5mm (8 from 10 pack) | £0.51 |
| Total for everything, inc P&P | £11.55 |
Compressed transfers for faster flashing
Prior to ESP8266 core v2.6.0 in 2019, flashing an ESP8266 could take over 2 minutes per board, which made a jig with clamps even more critical for getting a stable electrical connection. A typical 1Mb filesystem image would take 1:45 min @ 115,200 baud or 0:26 min @ 460,800 baud, even if the filesystem was mostly empty. Flashing over WiFi instead of serial didn't help as it was still uncompressed and roughly equivalent to 256,000 baud serial. A workaround was to define a custom SPIFFS image that was just large enough for your files. eg, 64Kb.Fortunately compressed transfers for both code and filesystem data now mean a board can be flashed in under 10 seconds.
Sketch for testing a PCB
The sketch to test the board has 5 main steps:- Test that 4× external pulldown resistors have their assocated input pin pulled to ground (good solder connection)
- Test that the MCP23017 chip is responding over the I2C interface
- Toggle the output of each of 16× I/O pins, testing it equals the input of the pin it should be wired to (good solder connection), and no others pins (likely solder bridges)
- Test WiFi connects, sends & receives network traffic
- Display overall result PASSED / FAILED text and light LEDs
Steps 1→3 take 0.4 sec from boot, and if they all pass testing the WiFi takes a further 3 secs.
passed.txt
ESPmotors revB testing jig (c) Climbers.net, 2018 ESP8266 booted... OK MCP23017 device found at I2C address 0x20... OK Pulldown resistors... OK MCP23017 pins... OK Connecting to WiFi network 'NotMy-WiFi'... OK (+2202 ms) Board's DHCP IP address: 192.168.1.234 WiFi signal strength: -64 dBm DNS lookup of 'pool.ntp.org'... OK (+34 ms) Remote server's IP address: 159.87.1.234 board PASSED, ready for flashing production firmware
You can see from the schematic diagram (below) how the test jig connects the I/O pins together in pairs. The sketch cannot report which pin of a pair has the soldering fault, but it's enough to identify the areas that need closer visual inspection or multimeter probing.
failed.txt
... Resistor R5 or MCP pin 22 (MOTOR1) not soldered... FAIL MCP pins 22 (MOTOR1) or 4 (SPEED2_MS2) not soldered... FAIL MCP pins 4 (SPEED2_MS2) or 22 (MOTOR1) not soldered... FAIL MCP pins 25 (SPEED1_MS1) or 1 (DIRN2) not soldered... FAIL MCP pins 1 (DIRN2) or 25 (SPEED1_MS1) not soldered... FAIL board FAILED!
Once a board has passed all its tests, it is ready for flashing production firmware. I use the “board PASSED” serial output from the test sketch to automatically trigger a script that: builds a SPIFFS filesystem image containing a unique password (for the WiFi access point), flash the SPIFFS image to the board, flash the production firmware and finally, print out a label with that unique password.
Download files
- KiCad project, schematic & PCB files (zip archive)
- GERBERS PCB manufacture files (zip archive)
- BOM parts list (CSV spreadsheet)
- Test Jig sketch for Arduino IDE (zip archive)
Low-cost PCB manufacture by ALLPCB.com
To keep costs for these boards as low as possible, I originally planned to etch & drill my prototype jigs at home, but when I found out how cheap it was to get a handful of boards made professionally it seemed far easier to go down that route. I used a PCB comparison shopping site and chose China-based manufacturer ALLPCB.com for the best price: US$5 total for 5 boards, including free expedited shipping (!) It only took 7 days from uploading my GERBERs to the boards being delivered by TNT couriers. Very impressive.
If you’re going to try ALLPCB for your own projects, please consider registering via my ALLPCB affiliate link: your first order starts from just US$1.99, and I’ll also get a voucher to put towards my next open hardware project
Nikki Smith, July 2021.


