Can about $50 of parts and a Raspberry Pi Pico measure movement smaller than the wavelength of red light?
Short answer: yes, with a catch
YouTuber Breaking Taps built a laser displacement encoder that tracks a moving target with an average error of 129 nanometers and a peak error of 291 nanometers. For scale, the red laser light it uses has a wavelength of 650 nanometers. The catch is that the hardware turned out to be the easy half. Hackster covered the build at https://www.hackster.io/news/nanometer-precision-on-a-50-budget-26b5b6f7c3dd.
How does a laser diode measure distance by itself?
A classic interferometer splits a beam in two, keeps one path as a reference, and counts the bright and dark fringes when the beams recombine. With a 650 nm laser, each fringe equals 325 nm of travel.
Breaking Taps used self-mixing interferometry, which drops most of the optics. Light bouncing off the target goes back into the laser diode’s own cavity and interferes with the light already inside. The laser’s output power wobbles slightly as the target moves, and a photodiode picks that up. Under the right conditions the wobble is a sawtooth, and the direction of the slope tells you which way the target is moving.
What does the circuit look like?
- Laser driver: an analog constant-current stage, built on bare copper-clad board.
- First amplifier: an op-amp wired as a transimpedance amplifier, turning the photodiode’s tiny current into a voltage.
- Second stage: more gain plus a DC offset shift, so the signal sits inside the range the Pico‘s analog input pin can read.
- Raspberry Pi Pico: digitizes the signal and streams it to a computer over USB, with a custom delta encoding scheme to keep up with the data rate.
Why was the signal so hard to read?
Early processing gave large errors, partly from a beat pattern that repeated every 1.46 mm of travel. Machine learning and a second optical channel got the error down to about 800 nm, but that version was touchy about alignment and added latency. The real gotcha was the laser diode itself, which was emitting several closely spaced wavelengths at once. Swapping in a single-longitudinal-mode diode and adding a neutral density filter cleaned up the signal enough for ordinary digital signal processing to reach 129 nm. The reference for all of this was a Zaber linear motor stage with 5 nm encoder resolution.
Try it
The full encoder is a tricky build. A good first step for a thesis or lab group is the front end alone: a photodiode, one op-amp and a feedback resistor on a breadboard, read through GP26, the Pico‘s first ADC pin. Once you can see a pocket laser pointer’s brightness change on a serial plot, watch the Breaking Taps video linked from the Hackster article and pay attention to the diode he ends up using.
Frequently Asked Questions
What is self-mixing interferometry?
It is a way of measuring movement with a single laser diode. Light reflected from the target re-enters the diode’s cavity and interferes with the light inside, which changes the laser’s output power. A photodiode reads those changes, so no beam splitter or reference mirror is needed.
What parts does the $50 laser encoder use?
A red laser diode with a constant-current driver, a photodiode, an op-amp transimpedance amplifier, a second gain and offset stage, and a Raspberry Pi Pico that digitizes the signal and sends it to a computer over USB. The final version uses a single-longitudinal-mode laser diode and a neutral density filter.
What will I learn if I build this?
You will practice analog front-end design with op-amps, reading fast signals with a microcontroller ADC, and streaming data over USB. You also learn how interference turns light into a distance measurement, and how much a clean signal source matters before any signal processing starts.
