Girk Ideas

How to Make an Eye Tracker: Easy DIY Guide

Eye tracking technology has evolved dramatically over the past few years. What once required dedicated labs with five-figure budgets can now be approximated with hobbyist-grade hardware. Building your own eye tracker is a rewarding project if you care about human-computer interaction, accessibility, or user research. This guide walks through the core concepts, component choices, and practical steps for creating a functional eye-tracking system from scratch.

How Eye Tracking Works (High-Level)

Eye tracking is, at its core, a geometry problem. A light source—usually infrared—illuminates the eye, and a camera records the reflections. By locating the pupil and one or more corneal reflections (often called "glints"), a simple trigonometry pipeline estimates the point of gaze on a screen or in the environment.

Two main variables drive accuracy: temporal resolution (frames per second) and spatial calibration (mapping eye features to screen coordinates). A tracker running at 60 Hz with careful calibration can achieve around 0.5–1° of visual angle, which is good enough for many research and accessibility tasks. Going beyond that—sub-0.1°—generally requires constrained head positions, near-IR illumination, and specialized lenses that a DIY setup rarely provides.

Eye Tracking - Biometrics | MM Marketing Mind

Bill of Materials

You do not need exotic parts. Most off-the-shelf components will work:

  • Camera: any USB webcam or Raspberry Pi camera module; near-IR sensitivity improves robustness in varying light.
  • Illuminator: 850 nm or 940 nm infrared LEDs. Ring mounts around the lens are easiest to align.
  • Diffuser: a small piece of tracing paper or 3D-printed light pipe to soften the LED pattern and reduce hotspots.
  • Computer: modern laptop or desktop running Windows, Linux, or macOS.

Recommended Sensors

SensorWhy it Works
PlayStation 3 Eye CameraCheap, high-frame-rate (up to 120 Hz), and easy to remove the IR-cut filter.
Raspberry Pi Camera v2 (NoIR version)Integrates well with Python/OpenCV pipelines and supports hardware-timed captures.
Industrial Machine Vision Camera (e.g., Basler)Delivers deterministic timing and global-shutter frames for demanding applications.

Optical Assembly

Mount the camera roughly 4–8 cm below the screen and angle it toward the users' eyes. The IR LEDs are arranged in ring around the lens to produce a symmetric illumination pattern. Filter the visible light spectrum with an IR-pass filter so the camera sees mostly reflections and the pupil, not the room.

Key geometric principles: the pupil appears as a dark disk surrounded by a relatively bright sclera. Corneal reflections—bright glints on the corneal surface—stay fixed on the cornea but appear to move with the eyeball. By computing the vector from glint to pupil center you obtain a direction vector that can be transformed into a real-world or screen coordinate.

The World Leader in Eye Tracking Technology - Nanalyze

Software Stack

OpenCV is, unsurprisingly, your best friend. Use the camera feed as input, then:

  1. Threshold the infrared-enhanced image to isolate glints and pupil blobs.
  2. Fit ellipses to both features using contour-based or gradient-based methods.
  3. Calculate the relative displacement (center-to-center) between glints and pupil.
  4. Map this displacement to screen coordinates via a calibration routine.

For a quick and dirty implementation, the Pupil Labs module in Pupil provides an excellent starting point. More advanced methods, such as deep-learning-based pupil segmentation, trade latency for robustness under occlusion or glasses.

Calibration

Calibration is the bridge between raw eye features and meaningful gaze points. The simplest approach is a 5- or 9-point calibration: the user looks at known screen positions while the system records corresponding eye vectors. A polynomial regression (usually second-order) maps the eye features to screen coordinates.

Head movement is the enemy of accuracy. If the user shifts their head, the glint-pupil vector changes even though the gaze direction remains the same. Solutions include:

  • Using multiple glints to estimate head pose.
  • Employing a chin rest or bite bar.
  • Continuously re-calibrating with a moving target.

Performance Tuning

Once the basic pipeline works, focus on latency and robustness. Aim for end-to-end latency below 50 ms to avoid perceptible lag. Techniques include:

  • Reducing image resolution to speed up processing.
  • Using region-of-interest (ROI) cropping around the eye.
  • Implementing multi-threading: one thread for capture, another for processing.

Test under different lighting conditions and with diverse eye colors. Dark brown eyes absorb more IR, making pupil segmentation harder; blue or green eyes reflect more, which can confuse thresholding. Adaptive thresholding or machine-learning-based segmentation helps here.

Applications and Next Steps

A functional DIY eye tracker opens doors to numerous projects: gaze-controlled interfaces, attention-aware applications, assistive communication devices, and user-experience research. Once you have a working prototype, consider integrating it with existing frameworks like PsychoPy for stimulus presentation or Unity for interactive 3D environments.

Building an eye tracker from scratch is a blend of optics, geometry, and software engineering. With careful component selection, solid calibration, and iterative tuning, a hobbyist setup can rival commercial systems for many use cases. Start simple, measure everything, and iterate—your first prototype will not be perfect, but it will teach you more than any datasheet ever could.

Eye Tracking - Biometrics | MM Marketing Mind

Eye Tracking - Biometrics | MM Marketing Mind

The World Leader in Eye Tracking Technology - Nanalyze

The World Leader in Eye Tracking Technology - Nanalyze

DIY Infrared Eye Tracker for under $100 - YouTube

DIY Infrared Eye Tracker for under $100 - YouTube

What is Eye Tracking? Definition and Applications | DAC.digital

What is Eye Tracking? Definition and Applications | DAC.digital

Como funciona um Eye Tracker | Blog Neuro & Marketing | Blog Neuro ...

Como funciona um Eye Tracker | Blog Neuro & Marketing | Blog Neuro ...

Eye-Tracking System with Low-End Hardware: Development and Evaluation

Eye-Tracking System with Low-End Hardware: Development and Evaluation

Anatomy of an Eye Tracker [How Eye Tracking Works] - iMotions Blog

Anatomy of an Eye Tracker [How Eye Tracking Works] - iMotions Blog

Eye Tracking - Biometrics | MM Marketing Mind

Eye Tracking - Biometrics | MM Marketing Mind

Can you design a typeface with your very own eyes? Julia Schäfer ...

Can you design a typeface with your very own eyes? Julia Schäfer ...

1 Eye tracking setup with participant, screen, and eye tracker ...

1 Eye tracking setup with participant, screen, and eye tracker ...

1 Eye tracking setup with participant, screen, and eye tracker ...

1 Eye tracking setup with participant, screen, and eye tracker ...

Get started with your eye tracker – Tobii Help Center

Get started with your eye tracker – Tobii Help Center

Eye Tracking: What Is It, Usage, Benefits + How It Works?

Eye Tracking: What Is It, Usage, Benefits + How It Works?

Wie funktionieren Eye Trackers? - Ein technisch versierter Rundgang - Tobii

Wie funktionieren Eye Trackers? - Ein technisch versierter Rundgang - Tobii

Testing websites with eye-tracking

Testing websites with eye-tracking

What is Eye Tracking? - Fast, Accurate, Reliable Eye Tracking

What is Eye Tracking? - Fast, Accurate, Reliable Eye Tracking

A Cheap Portable Eye-Tracker Solution for Common Setups

A Cheap Portable Eye-Tracker Solution for Common Setups

How Do you Build an Eye Tracker Without Batteries? - YouTube

How Do you Build an Eye Tracker Without Batteries? - YouTube

Eye Tracking Affiche – Eye Tracking C’Est Quoi – AOSA

Eye Tracking Affiche – Eye Tracking C’Est Quoi – AOSA

Latest in Eye Tracker Technology - Shop now

Latest in Eye Tracker Technology - Shop now

Read Next