◈   SCANNING ENVIRONMENT   ◈

LIDAR
Distance Gauge

A fully synthesized FPGA instrument — no processor, no firmware. The Garmin LIDAR Lite v3 sends a PWM pulse; 8 RTL modules later, a gauge needle moves to the exact position.

SystemVerilog RTL Cmod A7 35T Garmin LIDAR Lite v3 TB6612FNG H-Bridge x27.168 Stepper Xilinx Vivado
847
cm measured
12 MHz
FPGA clock
945
total steps
0
scan points
HOMING
FSM state
↓   SCAN TO EXPLORE   ↓
← ALL PROJECTS
SCAN REGION 01

Mission Brief

8RTL Modules
945Stepper Steps
12 MHzFPGA Clock
120Clocks / cm
64×Filter Samples
240Steps / sec

The LIDAR Distance Gauge is a fully synthesized FPGA instrument built in SystemVerilog RTL on a Digilent Cmod A7 35T. It reads real-world distance from a Garmin LIDAR Lite v3 PWM sensor, processes the signal through an 8-module hardware pipeline, and physically drives an automotive-style x27.168 gauge needle — no processor, no firmware, only synthesized logic.

The project evolved through three milestones: proving motor control on a Basys3, migrating to the Cmod A7 with live LIDAR input, and combining both into a fully calibrated real-time instrument. The Cmod A7's 12 MHz clock required recalculating every timing constant that the 100 MHz Basys3 had established.

Team: Mouhameth Ba · George Alabi · Denver Hoj   |   Course: ECE Digital Systems Design / FPGA Lab   |   Submitted: April 30, 2026

SCAN REGION 02

Signal Pipeline

GARMIN LIDAR
PWM out
pwm_synchronizer
metastability
pwm_pulse_measurer
pulse → cm
distance_filter
64-sample avg
dist_to_step_mapper
cm → step
top FSM + deadband
homing / run
stepper_driver
position ctrl
tb6612_phase_driver
coil signals
x27.168 Motor
needle position

Every stage is a distinct synthesizable module. The LIDAR's asynchronous PWM is safely crossed into the 12 MHz clock domain by a two-flop synchronizer. A 64-sample moving average removes jitter. A ±2-step deadband in the FSM suppresses noise without masking real movement.

The filtered distance also drives bin_to_bcd → seg7_mux_driver in parallel — the 4-digit 7-segment display shows the numeric distance while the needle tracks position simultaneously.

SCAN REGION 03

RTL Modules

pwm_synchronizer
Two flip-flop synchronizer. Safely crosses the LIDAR's async PWM into the 12 MHz domain. Prevents metastability from corrupting downstream counters.
pwm_pulse_measurer
Counts clocks while PWM is HIGH. Converts pulse width to centimeters: 10 µs/cm × 12 clocks/µs = 120 clocks per centimeter.
distance_filter
64-sample moving average. Accumulates readings in a shift register and outputs the running mean, smoothing reflectivity and angle-induced jitter.
distance_to_step_mapper
Linear interpolation maps 5–1000 cm to 0–944 steps. Below minimum clamps to step 0; above maximum clamps to full scale (944).
stepper_driver
Absolute-position controller. Fires 240 step ticks/sec, advancing one step per tick toward target while tracking the 6-phase half-step sequence.
tb6612_phase_driver
Translates 3-bit phase index (0–5) into AIN1, AIN2, BIN1, BIN2 — the four TB6612FNG H-bridge coil signals for the x27.168 motor.
bin_to_bcd
Double-dabble algorithm converts the binary distance value to 4 packed BCD digits, updated every measurement cycle for the 7-segment display.
seg7_mux_driver
Multiplexed 4-digit 7-segment driver. Cycles digit selects fast enough (>60 Hz per digit) to appear continuously illuminated to the eye.
SCAN REGION 04

Timing Calculations

Critical Migration: The Basys3 runs at 100 MHz; the Cmod A7 at 12 MHz. Every module that counts clock cycles encodes a frequency assumption. Missing a single recalculation produces a gauge that moves the wrong amount for any distance — physically plausible but numerically wrong, the hardest category of hardware bug.

QUANTITYCALCULATIONRESULT
Clock frequencyCmod A7 system clock12 MHz
Clock period1 / 12 MHz83.33 ns
Clocks per µs12 MHz × 1 µs12 clocks
LIDAR scale factor10 µs/cm × 12 clocks/µs120 clocks/cm
50 cm pulse count50 × 1206 000 clocks
100 cm pulse count100 × 12012 000 clocks
Step tick divider12 MHz / 240 sps50 000 clocks/step
POR hold time8 cycles × 83.33 ns~667 ns
SCAN REGION 05

Hardware Gallery

Photos and demo video of the physical build will live here — Cmod A7, LIDAR sensor, TB6612FNG driver, gauge assembly, and wiring. Replace the placeholders below with your actual files when ready.

🎬
DEMO VIDEO
Replace with <video> tag pointing to your recording
Recommended: MP4, autoplay muted loop, border-radius:12px, width:100%
📷
PHOTO 1
Full system wiring / breadboard assembly
📷
PHOTO 2
Cmod A7 + TB6612FNG + gauge motor
📷
PHOTO 3
Garmin LIDAR Lite v3 sensor close-up
📷
PHOTO 4
Gauge needle at multiple distance positions
SCAN REGION 06

Project Log

🔬
MILESTONE 1
Motor Proof-of-Concept — Basys3
Proved stepper motor and x27 gauge movement using Basys3 switch inputs at 100 MHz. Validated the TB6612FNG driver, 6-phase half-step sequence, and homing behavior. Confirmed 945 steps covers the full gauge arc cleanly.
📡
MILESTONE 2
LIDAR Integration — Cmod A7 Migration
Migrated to Cmod A7 (12 MHz). Integrated the full LIDAR path: PWM synchronizer, pulse measurer, and 64-sample moving average filter. Recalculated all timing constants — 120 clocks/cm at 12 MHz vs 1 000 clocks/cm at 100 MHz.
KEY ENGINEERING LESSON
Every Clocked Module Encodes a Frequency Assumption
The deadliest FPGA bugs are physically plausible but numerically wrong results. Naming timing constants as parameters (CLK_FREQ, STEP_RATE) instead of magic numbers made the design portable across boards and safe to recalculate. The deadband further protected the system from jitter without masking real motion.
🏁
FINAL SUBMISSION — APRIL 30, 2026
All 10 Demonstration Requirements Met
Complete pipeline verified: POR + homing, Cmod A7 bring-up, real LIDAR PWM, pulse timing, homing sequence, real-time tracking at 50 / 100 / 150 cm, moving average smoothness, close-range clamping, and full system explanation. Black-box FPGA test passed.