arXiv:2608.24742cs.LOAug 2026

Manuscript Offprint

arXiv:2608.24742

Design and Empirical Characterization of a Hardware-Realized Turing Machine with Automated Card-Based Programming

Agrima Regmi, Jenish Pant, Pratistha Sapkota, Sanskriti Khatiwada, Binod Sapkota

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Physical implementations of Turing Machines remain rare, and existing electromechanical demonstrators and mechanical logic games typically require manual operator intervention, either to trigger each computational step or to reconfigure the state table, or both. This restricts prior physical models to short, operator-paced demonstrations and prevents autonomous execution of extended computations. This paper addresses that gap with a hardware Turing Machine that enables autonomous multi-step execution and reprogrammable optical input without manual intervention between programs. The system integrates an Arduino Mega for state-transition logic, dual NEMA 17 stepper motors for bidirectional tape actuation (shown experimentally to eliminate the positional drift seen in single-motor designs), infrared reflectance sensors for symbol detection, and an ESP32-CAM-based optical punched-card reader for automated state-table loading. Hole detection under non-uniform illumination used a Breadth-First Search flood-fill algorithm with local adaptive thresholding rather than fixed global thresholding, driven by the memory and library constraints of the ESP32-CAM's microcontroller environment; this improved card-decoding accuracy from 75% to 90% (100% with mechanical card flattening) on a 20-card test set. Mechanical evaluation showed fabrication accuracy of ±0.15 mm, rack-and-pinion positional error below 0.3 mm across 50 trials, and voltage supply stability within ±0.2 V under full system load. End-to-end computation was validated against a parallel software simulator (tlang), with all hardware outputs matching the simulated reference exactly across multiple test programs. The system advances prior physical Turing Machine demonstrations through autonomous execution, reprogrammable optical input, and quantitative evaluation of its mechanical, optical, and computational performance.

Keywords: Turing Machine, Hardware Implementation, Punched Card Reader, Flood Fill Algorithm, ESP32-CAM, Stepper Motor Control, Automata Theory

1. Introduction

The Universal Turing Machine (UTM), first introduced by Alan Turing in his groundbreaking 1936 paper On Computable Numbers, with an Application to the Entscheidungsproblem [1], is a foundational concept in computer science that serves as a theoretical framework for understanding the boundaries of computation and the principles governing algorithmic processes. The UTM formalizes the notion of computation by using an abstract machine that consists of an infinite tape, segmented into discrete cells capable of holding symbols, and a movable head that reads, writes, and transitions between states based on a defined set of rules. These rules dictate the machine's behavior by associating the current symbol being read and the machine's state with specific actions, such as writing a symbol, moving the head, or changing states.

Formally, a Turing machine is defined as a 7-tuple [2]:

M=(Q,Σ,Γ,δ,q0,ϕ,F)\mathbf{M}=(\mathbf{Q},\Sigma,\Gamma,\delta,\mathbf{q}0,\phi,\mathbf{F})

which specifies the machine's states, symbols, transition rules, initial configuration, a blank symbol and accepting conditions.

Despite profoundly influencing the theoretical underpinnings of modern computing, the abstract representation of the machine as well as the absence of practical and interactive learning tools able to bridge the gap between theory and application posed significant challenges for students attempting to

  • Corresponding author

comprehend its operation and relevance. The absence of interactive, hardware-based tools that bridge theory and practice has been widely noted in computer science education.

While Turing Machines are commonly studied through software simulators, their physical implementation introduces a different set of requirements. A software simulator can execute a transition table directly, whereas a hardware implementation must translate each transition into coordinated physical actions such as moving the tape, detecting the current symbol, writing the next symbol, and changing state. Existing physical demonstrations have shown that these operations can be realized mechanically or electronically, but they often depend on manual intervention or simplified forms of program configuration. This limits their ability to demonstrate continuous, reprogrammable computation in a single physical system. The motivation of this work is therefore to develop a physical Turing Machine in which the transition table can be changed without rebuilding or manually reconfiguring the machine, while computation can proceed through multiple transitions without operator intervention.

This work makes several contributions to the physical realisation of programmable Turing Machine computation. On the hardware side, we present a complete UTM implementation using low-cost electromechanical components and demonstrate that a dual stepper motor configuration is necessary and sufficient to eliminate tape positional drift that single-motor designs cannot avoid. On the software and sensing side, we contribute a BFS-based flood fill decoder running on the ESP32-CAM for optical punched card reading, paired with local adaptive thresholding to handle real-world illumination variability. A custom Turing machine simulator (tlang) was developed in parallel as a pre-hardware verification environment, enabling transition rule validation before physical execution. Finally, we provide a systematic empirical characterisation of all subsystems, mechanical, optical, and electrical, offering a performance baseline for similar low-cost embedded hardware implementations.