Optoelectronics and FPGA

LaserRangefinder.

Two frequencies, one beam and an open research bench

Cyclone IVAD9959VerilogPython

Explore the source on GitHub ↗

Artistic illustration of LaserRangefinder — an instrument with a red beam, a target and an oscilloscope
Artistic illustration · not a photograph of the device

From light to distance

LaserRangefinder is an experimental dual-frequency phase rangefinder. We investigate how to obtain distance from the phase shift of reflected light when signal levels change, interference appears and phase crosses a full-cycle boundary.

The bench lets us vary DDS frequencies, amplitudes and phases, observe signals with an oscilloscope and compare FPGA calculations against a separate laser distance meter. Sources and results are open: readers can follow the path from a schematic to a particular oscilloscope capture.

A second life for the optics

The starting point was a faulty LE-200 PROFIBUS. Sergey reused its optical system with a lens and collimator, and its receiver assembly with SA612 mixers. Damaged original boards gave way to custom electronics.

According to the author’s record, faulty PIN photodiodes were replaced with BPX65 devices and the laser diode with a QL67D7SA, for red light around 670 nm. The new board and enclosure were designed for convenient debugging: an oscilloscope can be connected to analogue signals and comparator outputs. Restoration story and photographs.

How we worked together

Sergey restored the optics, designed and assembled the hardware, connected instruments, clarified actual connections and moved the target. AI helped interpret documentation, write Verilog and the desktop application, prepare tests, manage builds and collect measurements.

Work proceeded in stages: DDS control → synchronous ADC reading → analogue and digital phase meters → COM protocol → frequency and amplitude selection → calibration → a separate verification series.

On the bench, the process was straightforward: the agent recorded a point and requested a target move. Sergey repositioned the tripod, confirmed that it had stopped and waited for recording to finish. Distance-meter readings, FPGA data and two oscilloscope screenshots were saved for every point.

Not every option proved useful. According to the author’s observations, an FIR filter before phase calculation brought no noticeable improvement; it is absent from the current firmware. We preserve those results too, so the next participant knows what has already been tried. Experiment history.

The signal path

  1. AD9959 generates two laser modulation frequencies and two local oscillators. All four channels are configured from the desktop application and applied with one common IO_UPDATE.
  2. Two photoreceivers receive different light: the reference receiver gets it directly from the emitter through optical fibre, while the measurement receiver gets the target reflection.
  3. Four SA612 mixers shift the signals to intermediate frequencies of a few kilohertz. Each frequency has its own reference and reflected sine wave.
  4. The Cyclone IV FPGA reads eight ADS8681 devices synchronously. Four channels provide analogue phase measurements; the other four monitor detector levels. Digital-signal phases after the comparators are measured in parallel.
  5. The desktop application receives phases over UART, displays plots and calculates distance using calibration.

The analogue phase meter uses least-squares fitting: it estimates sine, cosine and DC components at the known IF. Changing amplitude does not change phase in the ideal model. Noise, saturation and distortion still require measurement checks.

Low frequency helps select the complete high-frequency cycle, while high frequency provides phase that is more sensitive to distance. The current cal2 uses a fourth-degree polynomial correction. Distance is currently calculated on the PC; the FPGA transmits phases, levels and diagnostics. Architecture · UART v3.

The bench: three views of one target

The Vector60 distance meter reports distance, the RIGOL DS1104Z shows waveform shape and relative timing, and the FPGA reports calculated phases and levels. These instruments have independent clocks, so stationary intervals are selected for comparison. This is not a hardware-synchronised recording of three devices.

In the latest series, the oscilloscope channels were connected as follows: X9/CH1 and X11/CH3 are the HF reference and reflected signals; X10/CH2 and X12/CH4 are the LF pair. Differences are reflected minus reference.

Below are two real captures at 1958 mm, as measured by the distance meter. Caption IFs are calculated from the read-back DDS settings; the oscilloscope’s unstable built-in frequency-counter display was not used as a frequency measurement.

HF oscilloscope capture: reference CH1 and reflected CH3 at 1958 mm
1958 mm · HF, CH1 and CH3 · IF 6749.993 Hz
LF oscilloscope capture: reference CH2 and reflected CH4 at 1958 mm
1958 mm · LF, CH2 and CH4 · IF 4000.030 Hz

All 20 oscilloscope captures labelled with distance · Bench equipment and connections.

What the 3 November 2026 series showed

The room allowed recording at 10 stationary positions from 762 to 5635 mm. The cal2 model had been fixed beforehand and was not fitted to this verification series.

For the nine points inside the calibration range:

Discrepancy against Vector60 after averaging ADC-based Digital signals
Mean, mm 5.08 4.93
RMS, mm 13.36 13.16
Maximum absolute value, mm 22.96 22.81

These are results from a particular bench, not the instrument’s rated accuracy. The cal2 range is 638–5583 mm. The last point, 5635 mm, is outside it, so no calculated distance was reported there. That point also retains the latched digital-overflow flag diagnostics=4; the event’s cause has not yet been established.

Full report and selection criteria · Excel with formulas and errors.

Materials for your own work

Where to start Contents
Main schematic · Power supply · English labels Hardware PDFs; external SA612 mixers are absent from the main schematic
Bill of materials Component list with English headers
Desktop application Installation, COM, DDS, plots, distance meter and calibration
Quartus and Verilog project Build, tests, QSF/SDC and verified images
Measurement results Excel, oscilloscope captures, phases, levels and limitations
Build verification Application and HDL tests, FPGA resources, timing
Getting started with AI Reading order, project map and context handoff

NeuroEngineer on this page helps locate information about the schematic, channel assignments, firmware modules, protocol and measurements. Answers include links to the prepared sources.

What comes next

The next major stage is testing over a long site and creating a new calibration. The intended 100–200 m range has not yet been verified. Rare phase jumps, operation in motion, temperature drift and behaviour under interference also need investigation.

The enclosure was selected with IP68 in mind, but there is no test report confirming that protection rating for the assembled device. Schematics and photographs do not form a complete manufacturing package: editable CAD/PCB and Gerber files are absent from the published folder.

We publish a working foundation and the history of its verification so that other engineers can continue the experiment with their own AI assistants. Code and original software materials are under MIT; original hardware materials are under CERN-OHL-P-2.0. Exact scopes and third-party terms are in NOTICE.

The cover was supplied by the author as an artistic illustration. Real photographs of the prototype are shown below.

← All workshop projects
WORKSHOP / ASSISTANT

NeuroEngineer.

Check answers against their sources. A short conversation history stays only in this tab’s memory.

Project: LaserRangefinder

Hello! I can help you explore the project materials. Which part are you interested in?

Up to 800 characters · Enter to send