← All projects

B.Sc. thesis · University of Stuttgart · sole author · Sep 2025

Optical position sensing — from circuit to test rig

Comparing infrared and time-of-flight sensing for a floating steel ball.

Maglev systems and pick-and-place robots need an object’s vertical position quickly and to the millimetre. The institute’s original sensor, a halogen lamp and a solar cell, reacts slowly because of the lamp’s thermal inertia and draws about 30 W. I built an infrared photodiode system and compared it with two time-of-flight sensors.

The vertical test rig with labelled parts: IR LED and photodiode boards, steel ball, time-of-flight sensor on an Arduino Mega, height gauge, and the inactive original lamp and solar cell.
My IR LED and photodiode boards, the steel ball, a time-of-flight sensor on an Arduino Mega and the height gauge used as reference. The institute’s original lamp and solar cell was not active here; its data comes from earlier work.

My contribution

Sole author, from parts to measurements.

I designed and hand-soldered the sensor boards, integrated the ToF readout, and carried out the comparative measurements.

Sensor boards

Chose the IR LEDs and photodiodes, calculated the expected photocurrent and simulated the receiver chain in LTspice. Laid out two boards in KiCad and soldered them by hand: an LED driver with five IR LEDs, and a receiver with a photodiode strip and a four-stage amplifier and filter chain.

ToF readout

Firmware for the VL6180X and VL53L0X sensors on an Arduino Mega, and a Python interface for logging.

Measurements

Ran every comparison on the same rig against the same height gauge: linearity, accuracy, response time and robustness.

KiCad 3D render of the LED driver board with five IR LEDs.KiCad 3D render of the receiver board with the photodiode strip mounted above it.
KiCad 3D renders of my two board designs: LED driver (left), receiver with the photodiode strip (right).

How I approached it

Define, build, test, decide.

Every system was judged on the same criteria, on the same rig and against the same reference.

This is “Measure, don’t guess” from my homepage, in practice.

Define

Four criteria for every system: linearity, accuracy, response time, and robustness to room light and reflections.

Build

Before laying out any board, I calculated the expected photocurrent and simulated the receiver chain in LTspice. I put the photodiodes on a separate plug-in board so that taller parts on the main board could not shade them, then laid out and hand-soldered both boards in KiCad and wrote firmware for the ToF sensors.

Test

One rig, a height gauge (±0.01 mm) as reference and the same calibration steps for each system. Runs with and without room light and with a 50 Hz lamp as interference; response time from step responses on an oscilloscope.

Decide

Robustness tests under three conditions (ball alone, lamp alone, both) showed that reflections from the metal ball cause most of the scatter in the IR signal.

Results & trade-offs

IR is fastest; ToF is more linear.

For a fast control loop, the IR signal is the better input; for an absolute distance, ToF is. Together they point to a hybrid.

≈ 19 µs

IR photodiode system

Practically unaffected by room light.

10.1 ms

VL6180X (ToF)

Most robust and linear, up to about 200 mm.

33.7 ms

VL53L0X (ToF)

More range, but more sensitive to reflections and lamp light.

Response time from step responses, measured with and without room light.

Line chart of voltage change against distance from 0 to 45 mm for the IR photodiode system and the original lamp-and-solar-cell system.
Voltage change over distance, 0–45 mm. My IR system (orange) stays flat up to about 30 mm, then rises steeply: very sensitive, but less linear. Blue: the original lamp-and-solar-cell system, data from earlier work.

Reflection

Fast, but not yet linear enough.

Reflections from the metal ball and overlapping light from the five LEDs bend the IR curve.

Known limits

The IR system is fast, energy-efficient and compact, but does not yet reach the linearity of the original system. The ball was positioned by hand and held still, so dynamic effects were deliberately left out.

Next steps

Lenses and apertures to reduce overlap and stray light, a control loop to shape the characteristic, and a hybrid: IR photodiodes for fast control, ToF for absolute distance.

Full case study

B.Sc. thesis · University of Stuttgart · Institute of Power Electronics and Electrical Drives · presented 12 Sep 2025

Measuring a floating steel ball with light

Original title: Vergleich von Sensorsystemen zur vertikalen Positionsbestimmung eines Körpers im Raum, a comparison of sensor systems for the vertical position of a body in space.

Test rig: a steel ball on a threaded rod between the sensor housings; the white housings hold the IR LED and photodiode boards.
Test rig: a steel ball on a threaded rod between the sensor housings; the white housings hold the IR LED and photodiode boards.

Why

Maglev systems need the air gap between vehicle and track with millimetre precision at high speed, and pick-and-place robots need vertical position too. The goal was to build alternative sensor systems and compare them with an existing one for linearity, accuracy, response time and robustness.

What I compared

  • My IR photodiode system: five IR LEDs (VSLY5940) and photodiodes (PDB-C607-2) on two custom PCBs. The photocurrent passes a transimpedance amplifier, an inverting amplifier and a summing amplifier, with offset compensation for ambient light and filtering of the 50 Hz lamp flicker.
  • Two time-of-flight sensors: VL6180X for short range (about 5–200 mm) and VL53L0X for longer range, read out with an Arduino Mega.
  • The institute’s existing system: a halogen lamp and a solar cell. It was not rebuilt; its comparison data comes from earlier work.

My part

Sole author: component selection and photocurrent calculation, LTspice simulation of the receiver chain, KiCad design and hand-soldering of both PCBs, ToF firmware and a Python logging interface, and all measurements.

Results, with context

  • Response time: about 19 µs for the IR photodiode system, 10.1 ms for the VL6180X and 33.7 ms for the VL53L0X, measured with and without room light. The IR system is practically unaffected by ambient light.
  • Linearity: the IR system is very sensitive but less linear than the existing lamp-and-solar-cell system. The deviations come from reflections off the metal ball and overlapping light from the five LEDs.
  • ToF: the VL6180X is the most robust and linear at short range (up to about 200 mm); the VL53L0X covers more range (tested to about 500 mm, linear to about 300 mm) but reacts more to reflections and lamp light.

Outlook

Lenses and apertures to reduce overlap and stray light, a control loop to shape the characteristic, and a hybrid: IR photodiodes for fast control and ToF for absolute distance.

Ask me for the thesis →