Full text
Corresponding author: GIRISH CHANDRAPPA Copyright © 2025 Author(s) retain the copyright of this article. This article is published under the terms of the Creative Commons Attribution Liscense 4.0. Design and implementation of a digital twin for a line-follower robot GIRISH CHANDRAPPA * Student, Department of Adaptronics, Faculty of Computer Science, Information Technology and Energy, Riga Technical University, Riga, Latvia, LV-1658. World Journal of Advanced Research and Reviews, 2025, 26(03), 941-950 Publication history: Received on 29 April 2025; revised on 07 June 2025; accepted on 09 June 2025 Article DOI: https://doi.org/10.30574/wjarr.2025.26.3.2275 Abstract This project leverages a digital twin in Unity 3D to replicate and enhance the navigation capabilities of a three-wheeled line-follower robot operating on a 2-meter closed-loop track with a narrow path. The robot is equipped with two DC gear motors, a front caster, and three infrared sensors, utilizing an ESP32 for control. MATLAB facilitates communication between the digital twin and the physical robot via WiFi, employing UDP and TCP protocols, while a PID controller optimizes navigation accuracy, particularly on challenging surfaces. The line-follower serves as a case study to evaluate MATLAB’s capability in controlling digital twins, with a scalable framework adaptable to other robotic systems like robotic arms, enhancing real-time testing and analysis over WiFi. Experimental testing on a large white surface with a black path mirroring the digital twin revealed minor delays at sharp turns and slight reductions in motor efficiency. Dual-mode test runs confirmed the digital twin’s reliability in accurately replicating the robot's movements. An HTTP-based web dashboard was developed to enhance real-time monitoring, enabling seamless access to data from both models. Inspired by a vision to empower future students with a cutting-edge robotics learning environment, this project provides an integrated, open-source model and controller for hands-on exploration. By bridging theoretical learning with practical application, it contributes to scalable navigation solutions for warehouse and laboratory environments, with prospects for future enhancements Keywords: Digital Twin; MATLAB Control; WiFi Synchronization; UDP/TCP Protocols; Real-Time Testing; HTTP Dashboard; 1. Introduction 1.1. Topicality and Motivation Digital twin technology is increasingly vital in robotics, offering a transformative solution to address real-world challenges faced by systems like line-follower robots, particularly those limited by hardware such as the ESP32 [4]. This project focuses on designing a digital twin for a three-wheeled line-follower robot with a 15 cm x 10 cm chassis, tailored for practical applications such as navigating busy warehouse floors or serving as an educational tool in laboratories [9]. The initiative leverages a Unity 3D digital twin, synchronized with the physical robot via a unified MATLAB controller using UDP/TCP over WiFi, to enable real-time testing and parameter analysis across diverse robotic configurations, including robotic arms [16]. This approach tackles engineering hurdles like dim lighting affecting IR sensors or uneven surfaces causing instability, which are prevalent in industrial and educational settings. The motivation stems from the technology’s potential to enhance navigation reliability and reduce prototyping costs through virtual simulations, aligning with industry trends where companies like Siemens and the KION Group have improved robot performance in factories and warehouses [8]. Additionally, the project aims to empower future students by providing an open-source, adaptable framework that bridges theoretical learning with hands-on practice, minimizing
World Journal of Advanced Research and Reviews, 2025, 26(03), 941-950 942 physical setup time and fostering multidisciplinary engineering skills [14]. This drives the development of a scalable, cost-effective platform for real-time robotic innovation as of June 2025. 1.2. Research Problem Developing a digital twin for a three-wheeled line-following robot with a 15 cm x 10 cm chassis presents significant engineering challenges, particularly given the ESP32’s limited processing power, which hampers real-time performance [4]. The primary issue is achieving seamless synchronization between the physical robot equipped with DC motors, IR sensors, and a front caster and its Unity 3D digital twin, ensuring stable navigation under demanding conditions like dim lighting or uneven surfaces, while maintaining affordability for educational labs [9]. These obstacles complicate path adherence, whether for warehouse navigation or classroom demonstrations, revealing gaps in the current physical-virtual integration. Environmental factors exacerbate the problem. Reflective surfaces in Unity 3D simulations introduce inaccuracies in IR sensors, while physical tests on uneven floors cause wobbling [13]. High temperatures and humidity further strain the ESP32, leading to increased processing delays and sensor drift, which disrupt navigation reliability in dynamic settings such as warehouses [13]. Synchronization between the ESP32 and the MATLAB controller over WiFi also falters, with delays during sharp turns affecting motor adjustments that are critical for automated guided vehicles (AGVs) or lab setups [16]. Additionally, the ESP32’s memory constraints limit its capacity to handle real-time sensor data and complex physics simulations, reducing precision across both models. High prototyping costs of around $200 per iteration contrast with the digital twin’s savings of $50, underscoring the need to overcome hardware limitations, minimize delays, and enhance simulation accuracy for a scalable, cost-effective solution [4]. 1.3. Research Goal and Objectives The primary goal of this research is to design and validate a digital twin for a three-wheeled line-follower robot with a 15cm x 10cm chassis, using Unity 3D to replicate the physical system and enhance navigation performance under challenging conditions while operating within the ESP32’s hardware constraints [4]. The system aims to enable realtime synchronization between the physical and virtual models via a unified MATLAB controller, facilitating testing and parameter analysis for applications in warehouse navigation and educational labs [9]. This approach seeks to create a scalable framework adaptable to other robotic systems, such as 4-axis robotic arms, reducing prototyping costs and supporting hands-on learning [14]. To achieve this goal, the following objectives are defined: First, build a physical robot prototype using IR sensors, DC motors, an L298N driver, and an ESP32 microcontroller to navigate a 2-meter closed-loop track [12]. Second, develop a digital twin in Unity 3D, modeling the robot’s chassis, sensors, and motors with 1:1 scale and physics alignment [12]. Third, establish real-time UDP/TCP communication between the ESP32, MATLAB, and Unity 3D, targeting a synchronization latency below 10 ms for seamless data exchange [16]. Fourth, implement PID control logic to ensure stable navigation, adjusting for environmental variations like uneven surfaces [10]. Finally, test and validate the system under various conditions, comparing physical and virtual performance to confirm reliability and adaptability for broader applications, including educational setups and industrial AGVs [9]. 2. Research Methodology This study employs a structured approach to develop and validate a digital twin for a three-wheeled line-follower robot, integrating hardware, virtual simulation, and unified control for reliable navigation across lab and warehouse scenarios [9]. The methodology outlines the construction and synchronization of physical and virtual models, supported by a MATLAB controller, to enable real-time testing and scalability. The physical robot features a 15cm x 10cm chassis with two rear DC gear motors (3V-6V), a front caster wheel, and three TCRT5000 IR sensors (5V) for line detection on a 3 cm wide path. An ESP32 microcontroller, paired with an L298N driver, manages sensor inputs and motor control, powered by a 6V-1.3Ah battery, with an HC-020K speed sensor providing feedback [17]. The digital twin, built in Unity 3D, mirrors this setup with a 1:1 scale model, virtual motors, and raycast-based IR sensors on a 2-meter virtual track, simulating realistic physics [12]. A unified MATLAB controller facilitates real-time communication using UDP/TCP over WiFi, linking the ESP32 (sending IR data on ports 5000-5001) and Unity 3D (sharing simulated data) with motor control signals on ports 8000-8002 [16]. PID-based control logic processes sensor inputs to adjust motor speeds, ensuring stability across varied conditions. An HTTP-based web dashboard, hosted via ESP32, logs real-time data from both models for monitoring and analysis [13].
World Journal of Advanced Research and Reviews, 2025, 26(03), 941-950 943 Figure 1 System Flowchart Figure 2 PID Control Diagram This design supports independent yet synchronized model execution, enabling comparative testing and adaptability for applications like 4-axis robotic arms, laying the groundwork for validation [9]. 2.1. Literature Review Digital twin technology has emerged as a pivotal tool in robotics, enabling virtual simulations that mirror physical systems for enhanced design and operation [4]. Recent studies highlight its application in line-follower robots, which serve as effective platforms for testing navigation and control strategies. For instance, Zhang’s 2023 research combined IR and optical sensors with machine learning, achieving high accuracy on complex tracks, though it increased power demands [23]. Similarly, Patel’s 2024 work integrated an MPU6050 with an ESP32 for real-time tilt correction, improving stability but at the cost of higher energy consumption [23]. These advancements underscore the potential for improved navigation, yet highlight challenges with resource-constrained microcontrollers. On the software front, Unity 3D has been widely adopted for digital twin simulations. Smith’s 2024 study demonstrated its efficacy in reducing development time through virtual control adjustments [26]. Control strategies have also evolved, with Kim’s 2023 MATLAB-based PID tuning enhancing sensor noise mitigation, a critical factor for line-follower robots [10]. Additionally, Lee’s 2022 work on deep reinforcement learning showed faster navigation adaptations, though it demanded significant computational resources [10]. Despite these strides, gaps remain in achieving seamless real-time synchronization over WiFi using UDP/TCP, particularly with limited hardware like the ESP32, and in maintaining cost-
World Journal of Advanced Research and Reviews, 2025, 26(03), 941-950 944 effectiveness for educational applications [4]. This project addresses these gaps by developing an integrated, scalable digital twin framework for practical and academic use. 2.2. Concept and Evolution Digital twin technology establishes a virtual counterpart to a physical system, enabling continuous data integration for monitoring and optimization [4]. In robotics, it comprises three core elements: a physical entity, such as a line-follower robot with IR sensors and DC motors; a virtual model, simulating real-world dynamics; and a data link, often using protocols like UDP, to ensure real-time synchronization [13]. This concept facilitates lifecycle management, from design to operation, by allowing virtual adjustments to sensor placement or motor behavior before physical implementation, minimizing hardware wear and costs. The evolution of digital twins traces back to the 1970s, with static CAD models used for design, lacking real-time capabilities [23]. In 2002, Michael Grieves formalized the concept for lifecycle tracking, linking physical and virtual systems via data streams, a foundation later applied to robotics [20]. NASA’s use of spacecraft twins in the 2010s introduced real-time telemetry, inspiring applications in autonomous robots [20]. By the mid-2010s, IoT advancements enabled edge computing, reducing latency in systems like the ESP32 for line-follower robots [14]. Recent trends focus on predictive analytics, with studies exploring motor wear simulation, though simpler physics models remain practical for resource-limited setups [26]. This evolution underscores the growing role of digital twins in enhancing robotic navigation and scalability, particularly for educational and industrial applications. Figure 3 Conceptual Structure of a Digital Twin
World Journal of Advanced Research and Reviews, 2025, 26(03), 941-950 945 Figure 4 Evolutionary Timeline of Digital Twin Technology 2.3. Application in Robotics The developed twin control model, validated through extensive testing across diverse scenarios, extends its utility beyond the line-follower robot to enhance various robotic applications. This integrated system, combining a physical robot and its Unity 3D digital twin synchronized via MATLAB, offers a robust framework for real-world deployment and experimentation in industrial and educational settings. Its adaptability stems from rigorous testing with multiple configurations, ensuring reliability across different operational demands. In warehouse logistics, the model supports 4-axis robotic arms for precise material handling, leveraging the twin’s ability to simulate motor adjustments and sensor feedback for optimal performance. Automated sorting systems benefit from real-time data synchronization, enabling efficient object classification and routing based on virtual testing outcomes. The model also applies to packing track processes, where it optimizes conveyor navigation, and assembly line quality control systems, ensuring consistent product inspection through virtual validation. Additionally, automated storage and retrieval systems utilize the twin to streamline inventory management, reducing errors in dynamic environments. In educational contexts, this versatility fosters hands-on learning, allowing students to explore robotic control strategies across these applications without extensive hardware modifications. The model’s proven scalability, tested through repeated iterations, positions it as a cost-effective solution for advancing robotic automation and training, bridging theoretical design with practical implementation. Figure 5 Applications of Developed Twin Control Model
World Journal of Advanced Research and Reviews, 2025, 26(03), 941-950 946 2.4. Challenges and Limitations The development of the digital twin system for the line-follower robot faces several challenges that impact its performance and deployment. One key difficulty is maintaining consistent data flow between the physical and virtual environments, where network congestion or WiFi interference can disrupt real-time communication, leading to occasional control mismatches [13]. This requires robust error-handling mechanisms, which add complexity to the MATLAB controller design. Another hurdle is the differing operational dynamics, where physical wear on motors or sensor misalignment over time introduces deviations not fully captured by the Unity 3D simulation, necessitating frequent recalibration [12]. Environmental adaptability poses additional constraints. Variations in ambient noise or electromagnetic interference can affect sensor reliability, particularly in industrial settings with heavy machinery, challenging the system’s robustness [9]. Power management also presents a limitation, as the ESP32’s battery dependency limits operational duration, requiring strategic energy allocation that may compromise processing speed during extended tests. Furthermore, the current framework lacks advanced predictive features, such as anticipating motor fatigue, which restricts its long-term reliability in high-intensity applications [14]. For educational use, the complexity of configuring the twin system may overwhelm beginners, potentially hindering its adoption without simplified interfaces. These challenges highlight the need for ongoing refinement to enhance system resilience, scalability, and user accessibility across diverse robotic contexts. 3. Design of the line-follower robot 3.1. System Architecture The system architecture integrates a physical line-follower robot, its digital twin in Unity 3D, and a MATLAB controller to enable synchronized operation and testing across diverse scenarios [9]. The physical layer comprises a 15cm x 10cm robot chassis with two DC gear motors and a front caster, controlled by an ESP32 microcontroller via an L298N driver. Three IR sensors detect the path, while a speed sensor monitors motor performance, all powered by a 6V battery [17]. This setup interfaces with the MATLAB controller over WiFi, exchanging sensor data and control commands to ensure precise navigation. The digital layer, hosted in Unity 3D, replicates the physical robot with a virtual model, simulating motor dynamics and sensor inputs using raycasts to mimic path detection [12]. The MATLAB controller serves as the central hub, processing inputs from both layers and applying PID logic to generate unified motor commands, transmitted via UDP/TCP protocols for real-time synchronization [16]. An HTTP-based web dashboard, hosted on the ESP32, provides a user interface to monitor system performance, displaying live data logs from both the physical and virtual models [13]. This architecture ensures cohesive operation, enabling validation of navigation strategies and scalability for applications like automated sorting systems or educational labs. Figure 6 Unified Simulation Control System in MATLAB
World Journal of Advanced Research and Reviews, 2025, 26(03), 941-950 947 Figure 7 Circuit Wiring Diagram for the Line Follower Robot 4. Experimental setup and methodology 4.1. Physical and Virtual Testing Environments The testing environment for the line-follower robot encompasses both physical and virtual setups to evaluate navigation performance and synchronization accuracy. The physical setup features a 2-meter closed-loop track drawn on a white sheet with a 3 cm wide black path, designed to simulate real-world scenarios like warehouse floors or lab courses. A laptop interfaces with the robot, displaying Unity 3D simulations and control interfaces, while the physical robot, equipped with IR sensors and DC motors, navigates the track, connected via wires for real-time data exchange. The setup is arranged on a desk, ensuring a controlled space with minimal external interference for initial trials. The virtual environment mirrors this track in Unity 3D, rendered on the same laptop, with a digital twin replicating the robot’s movements based on simulated sensor inputs. A unified MATLAB controller links both models, processing data from the physical robot’s IR sensors and adjusting the virtual twin’s path in real time. The environment supports dualmode testing, allowing simultaneous observation of physical navigation and virtual simulation to assess alignment and response to path variations. This integrated setup facilitates comparative analysis, ensuring the digital twin accurately reflects physical behavior under controlled conditions, laying the foundation for broader application testing.
World Journal of Advanced Research and Reviews, 2025, 26(03), 941-950 948 Figure 8 Physical vs. Virtual Model with Controller Figure 9 Physical Testing Environment Setup 5. Results and Discussion Testing demonstrated that the physical line-follower robot achieved 96.7% navigation accuracy across 10 runs on the 2-meter track, while the digital twin in Unity 3D reached 99.7%, benefiting from the absence of physical constraints like sensor noise. The physical model averaged 35 seconds per run, compared to the digital twin’s consistent 32 seconds,
World Journal of Advanced Research and Reviews, 2025, 26(03), 941-950 949 reflecting smoother virtual dynamics. Sharp turns slightly challenged the physical robot, resulting in minor path deviations due to motor response lag, while the digital twin maintained steadier performance. A 3% accuracy gap underscores the influence of real-world factors like battery degradation on the physical model, yet this difference supports the twin’s role in pre-deployment optimization, reducing the need for hardware adjustments. The system’s adaptability was confirmed through scalability tests, successfully simulating navigation for a 4-axis robotic arm, suggesting potential for industrial applications like sorting systems. An HTTP-based web dashboard, powered by the ESP32, provided real-time monitoring by displaying sensor and motor data from both models, enhancing comparative analysis for educational use. These results validate the digital twin’s reliability as an efficient testing tool, paving the way for scalable robotic solutions in academic and industrial contexts. Future enhancements could explore predictive analytics to mitigate physical wear over time. Figure 10 Path Accuracy Graph 6. Conclusion This project successfully established a real-time synchronized system for a three-wheeled line-follower robot, integrating a physical model with a Unity 3D digital twin through a MATLAB controller. The framework demonstrated effective navigation across a 2-meter track, showcasing the potential of digital twins to enhance robotic performance in educational and industrial settings. The system’s adaptability was proven through its successful application to diverse configurations, such as 4-axis robotic arms, highlighting its scalability for broader robotic applications. The development underscored the value of virtual testing in reducing physical prototyping efforts, offering a costeffective solution that bridges theoretical learning with practical implementation. The web dashboard’s real-time monitoring capability further enriched its utility, providing a valuable tool for students and engineers to analyze system behavior. Looking ahead, future enhancements could incorporate advanced sensors like the MPU6050 to improve stability, simulate battery dynamics in Unity 3D, and optimize communication protocols to minimize delays. This work lays a solid foundation for advancing robotic automation and fostering hands-on education, with promising implications for warehouse logistics and lab training environments. References [1] J. Wimmer and T. Braml, “Digital Twins for Engineering Structures: An Industry 4.0 Perspective,” Struct. Concrete, vol. 25, no. 6, pp. 1–15, Oct. 2024, doi: 10.1002/suco.202400683.immer & Braml, 2024) [2] K. M. Alam and A. El Saddik, “C2PS: A digital twin architecture reference model for the cloudbased cyber-physical systems,” IEEE Access, vol. 5, pp. 2050–2062, Jan. 2017, doi: 10.1109/ACCESS.2017.2657006.(Alam & El Saddik, 2017) [3] A. Rasheed, O. San, and T. Kvamsdal, “Digital twin: Values, challenges and enablers from a modeling perspective,” IEEE Access, vol. 8, pp. 21980–22012, Jan. 2020, doi: 10.1109/ACCESS.2020.2970143.(Rasheed et al., 2020)