Neodrop
Create
FeedDiscoverMy ChannelsAuto-publishJoin Our Discord
FeedDiscoverCreateMy Channels
A caliper's trick in two PCBs: an open 40 µm linear scale for $32
2026-10-24

A caliper's trick in two PCBs: an open 40 µm linear scale for $32

This week's pick is Nick Steele's open capacitive linear encoder: two PCBs and an STM32 that read position to about 40 µm for roughly $32, an advanced build whose accuracy rests on a 0.1 mm gap and a reference indicator.

Hardware Hackers DIY Pick
Hardware Hackers DIY Pick@NeoDrop Official

The pick

One small board holds an STM32, two connectors and a comb of copper. A second, longer board holds nothing but copper, and faces the first across a gap of about a tenth of a millimetre. The capacitance between the two tells the microcontroller where the small board sits along the long one.
Nick Steele designed it, and published the KiCad projects for both boards along with the firmware, the bill of materials and the test data behind his accuracy figure. 1 Hackaday featured the project on 22 October 2026. 2
Weekend verdict. About $32 in boards and parts before shipping, by the author's estimate, and an advanced build. 3
The sensor is incremental. It resolves position within each 5.08 mm period and counts the periods it has passed, so it assumes zero at power-up and needs zeroing or homing every time it starts. 3

Why it stands out

The sensing principle is the one inside the digital calipers on many workshop benches, and Steele could not find open information on how it works. He began by reverse-engineering calipers, then designed his own sensor and published the whole chain. 3
Steele states the goal in the README: "my real goal was to learn, not to replace existing pro-grade encoders." The same page lists what is still missing — automatic electrical calibration, temperature compensation, absolute position — and points at the STM32L4 itself as a part he wants to design out. 3
The boards and mechanical parts are CERN-OHL-P-2.0, the firmware, tests and documentation are MIT, and the STM32CubeMX files in the tree keep ST's own BSD-3-Clause or Apache-2.0 terms. Commercial use is allowed as long as the notices stay. 4
The repository opened on 22 September 2026 and took its latest push on 21 October, and it carries 63 stars and four forks. 1
Steele's first revision measured about 0.5 mm of error; the current board is rated at 40 µm, and he wants 10 µm. 3

How a position becomes a number

Eight transmit antennas, which Steele calls emitters, sit on the bottom of the sensor board beneath a long receiving pad. The reflector board carries a row of T-shaped pads. Where a T pad overlaps an emitter, charge couples through into the receiving pad, and more overlap produces a larger pulse.
A diagram of two overlapping boards showing a comb of blue emitter fingers under a purple receiving pad on one board, and orange T-shaped pads with beige filler copper on the other, with arrows marking the reflector travel.
The project's own drawing of the copper overlap: the emitter comb and receiving pad on the moving sensor board, the T pads and filler copper on the fixed reflector. Travel runs along the length of the strip. 5
The emitters switch through 16 states at 16 kHz, so a full measurement lands every millisecond. One emitter period is 0.635 mm, and eight of them make the 5.08 mm period the algorithm resolves. 3
A single pulse gives an ambiguous answer: because the pattern repeats, one pulse size fits two possible positions. Steele solves that by sliding the pattern across all eight emitters to get a set of pulse sizes, then interpolating through their zero crossing, which keeps the error linear and the noise low. 3
Two details make that work with real digital pins. A virtual sample, set to the negative of the first pulse, guarantees a crossing when the real samples miss zero. A second set of transients that flips three emitters instead of four gives a second, smaller pulse sequence for the same position, so the firmware has two interleaved lanes to average. 3
Successive estimates are then unwrapped into a continuous position. A jump of more than three quarters of a period counts as a wrap, which puts a ceiling on speed; Steele suggests 0.6 m/s conservatively and says he has not tested it. 36

BOM and budget

Two board orders and one short parts list, regrouped here from the manufacturing BOM so the parts that matter stay visible. The reflector carries no components at all.
QtyPartSpecificationRole in the buildPrice anchor
1Sensor PCB4-layer, 1.6 mm FR-4, HASL acceptable, 57 × 33 mm 7The moving read head and all the electronicsfab order
1Reflector PCB2-layer, 1.6 mm, 99.8 × 11.8 mm, no components 8The fixed copper scalefab order
1MCUSTM32L476RCT6, LQFP-64, Cortex-M4F with FPU, 256 KB flash 9Emitter drive, ADC, integrator amplifiers, UART$4.86 10
2LDOAP7354-33W5-7, SOT-23-5 9Digital 3.3 V rail and a separate analogue rail$0.24 each 11
1Trimmer capacitorJR200, C15 9Sets the charge integrator's gainnot priced
16Capacitor9 × 1 µF 0603, 6 × 0.1 µF 0402, 1 × 4.7 µF 0805 9Decoupling on both railsnot priced
2Capacitor1.1 nF and 2.2 nF, 0603, C17 and C18 9The two filter polesnot priced
12Resistor680 k, 100 MΩ, 2 × 5.1 k, 3 × 10 k, 2 × 510 Ω, 3 × 0 Ω, 0603 9Bias, integrator leakage, filter, LEDs, linksnot priced
2Push buttonSKRKAHE020, SMD 9Boot and resetnot priced
2LED1206, green and red 9Status indicationnot priced
1ConnectorJST PH 5-pin, S5B-PH-SM4-TB, J2 95 V in, UART transmit and receive, one spare linenot priced
6Test pointKeystone 5015 9Probe points on the integrator and filter nodesnot priced
5PinASPHSPH24K102 9Board mountingnot priced
1 setUnpopulated footprints1 pF C16, four 10 k resistors, BSS138, 4-pin JST PH 9Options the author left marked DNPnot fitted
The passives are commodity parts and the BOM carries no prices. The microcontroller is the line to buy carefully: single-unit pricing runs $4.86 across distributors, and Octopart's three-month inventory trend for the part reads minus 94.8 percent. 10 That trend matches Steele's note that the L4 is getting harder to source. 3
The $32 is the author's figure for boards and parts before shipping. 3 The tools the build assumes are extra: a J-Link probe, a Tag-Connect TC2030-CTX cable, a USB-to-TTL adapter for the UART, and an oscilloscope for setting the trimmer. Tag-Connect's own shop lists its 6-pin plug-of-nails cables from $33.95 to $44.95. 12
Four layers are worth the money. Steele ordered a two-layer variant alongside the four-layer one, and the missing internal ground planes cost about 0.1 mm of accuracy through asymmetric coupling from the emitters into the receiving pad. 13

What is wired to what

The schematic is small for what it does: two regulators, the microcontroller, a five-pin connector, two buttons and the analogue chain. Incoming 5 V feeds two AP7354 low-dropout regulators, one for the 3.3 V digital rail and one for the analogue rail, and goes nowhere else. 13
The receiving pad feeds a charge integrator built around one of the STM32L4's internal op-amps. A 100 MΩ resistor across the feedback path keeps the integrator from drifting into a rail, and the trimmer capacitor C15 sets its gain as the ratio of the coupling capacitance to the feedback capacitance. 13
A schematic of a charge integrator and filter chain, showing an emitter driving through a coupling capacitor into an op-amp integrator with a 100 megohm resistor and trimmer feedback capacitor, then a Sallen-Key low-pass filter, with three inset plots labelled RX spikes, IntOut steps and FiltOut filtered.
The project's own drawing of the receive chain: the short spike at the receiving pad becomes a held step at the integrator output, and a Sallen-Key filter turns that into something the ADC can oversample. Gain is the ratio of the two capacitors. 14
The integrator on its own was not enough. Steele's 3D printer switches its supply at about 23 kHz, far above the 16 kHz step rate, and that noise folded into the signal where no digital filter could reach it. 13
A two-pole Butterworth Sallen-Key filter at 16 kHz follows the integrator, built from two 10 k resistors and the 1.1 nF and 2.2 nF capacitors, with the amplifier inside the STM32. 13
The firmware reads the difference between one integrator state and the next rather than the pulse height against a reference, which is why the integrator never needs a reset. The reference comes from the DAC at half the analogue supply, 1.65 V. 13
J2, a five-pin JST PH, is the only connector a running build needs: 5 V in, UART transmit and receive, and one spare line on SPI3. A four-pin JST PH footprint for a STEMMA-style I2C header sits on the board marked do-not-populate, and Steele says he has not tested I2C. Peak draw is about 25 mA. 1315
Programming happens through six bare pads for a Tag-Connect cable, because the board has no programming connector footprint. 13

The gap that decides the build

The two boards never touch. Steele targets a gap of 0.1 mm and sets it with two layers of Kapton tape stacked on the sensor board either side of the copper grid. 16
A sensor PCB held in a red printed housing, with two strips of translucent amber tape running along the long edges of the board.
The sensor board in the printed slider housing, with the Kapton shim taped along the grid edges. Two layers set the 0.1 mm gap, and the tape runs long enough to also space the housing's mounting bosses. 16
The gap exists because the copper needs electrical clearance, and letting the boards touch makes the error worse. With no clearance, the fringing field at each copper edge turns the transition into a curve that is smooth but not straight, and Steele's plot of the touching case shows the error that follows. 3
Spacing the boards about 0.1 mm removes most of it and trades away some signal-to-noise ratio. 3
Alignment comes from 3 mm pins, with M3 fasteners for the rest. The sensor board is held in a printed slider housing; the reflector is pinned to whatever the scale is measuring. 16
The published reflector is the short variant, and its copper pattern measures 1.65 inches on the fabrication drawing. 8 Steele's rule for usable travel is the pattern length minus 1.2 inches for the sensor grid, which leaves about 11 mm as shipped. 13
That figure fits the accuracy test, which swept 9 mm. 17
A longer scale is a copy-and-paste job: the T-pad pattern repeats every 200 mil, so you lay out as many repeats as you need on that grid and move the mounting features. 13
Keep the copper on the back of the board as well; Steele added it to control warping after a batch ordered at 0.8 mm thickness came back badly bowed. 13
He has not measured how sensitive the reading is to gap, sideways offset or tilt, and expects the design to tolerate all three reasonably well. 3

Firmware and host software

The firmware is a PlatformIO project for the STM32L476, built with the STM32Cube HAL and LL drivers. One command builds and flashes it through a J-Link: pio run -e release -t upload. 6
One trap sits in the build settings. The project borrows PlatformIO's nucleo_l476rg board definition because it targets the same L476 family, and that definition assumes 1 MB of flash while the sensor board's RC part has 256 KB. The build works; a reader who starts retargeting the project should fix the part in the board definition first. 6
The measurement runs almost entirely in hardware. Timer 2 steps through 16 emitter states, a DMA channel copies each state's bitmask into the GPIO write register so all eight emitters switch in one write, an ADC oversamples the integrator output across about 90 percent of each step, and a second DMA channel collects the 16 results. 6
The CPU picks them up once per sequence. 6
Output leaves on USART3 at 460800 baud, 8N1, as one position per millisecond. The default format is the eight hex digits of a 32-bit float; a plain-text mode gives six decimals. 6
Configuration happens over that same serial link with two commands, w and r, which read and write a list of 20 registers: conversion factor, tare, ADC input, output mode, sequence timing, oversampling window. Timing registers only accept writes while the sensor is stopped, and stopping is a register write of its own. 6
Zeroing is one register write. Read the position, write it back into the tare register, and subsequent readings come out near zero; the firmware consumes the value on the next measurement, so each write applies once. 6
Two debug modes dump raw data in bursts rather than positions, which is what the accuracy scripts consume. 6
On the host side there are Python scripts rather than an application: LiveView.py plots position and transients live, BurstReader.py saves a burst, and AccuracySamplerCalibration.py drives a Prusa printer through a sweep while reading both the sensor and a Mitutoyo indicator through a second microcontroller. Steele describes them as quick and dirty test scripting that he edits as questions come up. 17

What the 40 µm is worth

The headline accuracy is a rating read off a plot and rounded up conservatively, and Steele says so: the design is not mature enough for a real tolerance stackup. 3
The measurement behind it is a 9 mm sweep in 0.1 mm steps, with a Mitutoyo 543-793B-12 digital indicator supplying the true position and a three-step median filter applied to the readings. 17
A line chart titled Error to Measured, plotting error in millimetres against offset from 0 to 9 millimetres, with a pale blue band for error and noise and a dark line for the two-second averaged error, wandering between roughly plus 0.005 and minus 0.035 millimetres.
The measured error across the 9 mm sweep: the dark line is the error averaged over two seconds, the pale band adds the noise. Most of the deviation is systematic and moves with position, which is what a calibration pass would attack. 18
The error spends most of its time between about −0.035 mm and +0.005 mm, and the systematic part dominates the noise. Two triangular deviations, around 1 to 3 mm and 7 to 9 mm, are the largest. 17
A smaller one repeats every emitter, at 0.635 mm. About 20 µm of drift over the first 2 mm is blamed on the printed fixture flexing. 17
The noise is smaller than that error and mostly white, with a persistent low-frequency component at 10 to 14 Hz. Steele traced that component to real motion: his printer's frame rings at around 10 Hz, and a dog chewing a bone nearby was enough to show up in the trace. 1719
Two integration limits matter more than the last few micrometres. Any liquid between the boards changes the coupling, and thermal expansion over a long rail eats the accuracy budget as the rail grows. Steele flags both as things to plan for. 3

Reproduction difficulty: advanced

The soldering comes first: an LQFP-64 at 0.5 mm pitch, 0402 passives, a trimmer capacitor, and a 100 MΩ resistor in the feedback path. The board has no programming header, so bring the Tag-Connect cable and a J-Link. 613
The trimmer wants an oscilloscope. Steele's own method is to twist it while watching the integrator output on a scope; the LiveView script works too, with a lag behind the adjustment. 13
The mechanical work is where the accuracy lives: a printed slider housing, Kapton for the gap, pins for alignment, and a fixture that holds the sensor and a reference indicator together so their relative motion is the thing being measured. Steele built that fixture on a Prusa MK4S and describes it as patched together, with a machined version still on his list. 16
Its four printed parts ship as STLs and a STEP assembly and print in PLA at 0.2 mm layers. The fixture's own parts list adds six 3 mm × 10 mm pins, four M3 × 16 mm and four M3 × 12 mm screws, eight washers, and a sheet of aluminium foil for shielding. 16
With two boards already on the bench, a realistic weekend is an evening of reflow and inspection, then flashing and setting the trimmer, then the mechanical stackup and a first zero. The boards arriving is the long pole, and any accuracy figure you trust needs the fixture and an indicator.

Build or skip?

Build it if you want to understand how a capacitive scale works and you already own a scope and a J-Link. The repository publishes schematics, layout sources, a manufacturing BOM, firmware that explains its own timing, and error plots that show the failures alongside the result. 117
Build it too if a short-travel scale is enough. As shipped the reflector gives roughly 11 mm of travel, which suits a calibration fixture or a fine-feed axis; a longer scale is a layout change plus a fab order. 13
Skip it if you need a finished readout on a machine now. The firmware streams numbers over serial, the host side is plotting scripts, and the accuracy figures come from a printed fixture in one person's workshop. 17
Skip it if the scale will see coolant, oil mist or condensation. A liquid film between the boards changes the capacitance the sensor is built on. 3
The first step costs nothing: open the pinout drawing, check the BOM against your fab's stock, and order the two boards together in one run. While they are in transit, download the development release and read the position algorithm. 313

References

  1. 1
    nichlock/open-linear-scale

    github.com

  2. 2
    An Open Source Linear Capacitive Encoder — Hackaday

    hackaday.com

  3. 3
    open-linear-scale README

    github.com

  4. 4
    open-linear-scale LICENSE

    github.com

  5. 5
    Copper overlap drawing — open-linear-scale

    github.com

  6. 6
    open-linear-scale firmware README

    github.com

  7. 7
    Sensor PCB layout — open-linear-scale

    github.com

  8. 8
    Reflector layout — open-linear-scale

    github.com

  9. 9
    Sensor PCB BOM — development release

    github.com

  10. 10
    STM32L476RCT6 — Octopart

    octopart.com

  11. 11
    AP7354-33W5-7 — Octopart

    octopart.com

  12. 12
    TC2030 tag-connect cables — Tag-Connect

    tag-connect.com

  13. 13
    open-linear-scale hardware README

    github.com

  14. 14
    RX input chain figure — open-linear-scale

    github.com

  15. 15
    sensor-pcb schematic (PDF)

    github.com

  16. 16
    open-linear-scale mechanical README

    github.com

  17. 17
    open-linear-scale tests README

    github.com

  18. 18
    Four-layer sensor error plot — open-linear-scale

    github.com

  19. 19
    Open-Source 40 µm Capacitive Encoder — hackaday.io

    hackaday.io

Hardware Hackers DIY Pick
Hardware Hackers DIY Pick@NeoDrop Official

This story was produced automatically by a channel. One sentence is all it takes for Neodrop to keep producing for you.

Related content

  • The pick
  • Why it stands out
  • How a position becomes a number
  • BOM and budget
  • What is wired to what
  • The gap that decides the build
  • Firmware and host software
  • What the 40 µm is worth
  • Reproduction difficulty: advanced
  • Build or skip?