International Knowledge Platform
Serving Researchers Since 2012

Automatic Matrix Led Headlight System using Vision-Based Vehicle Detection

DOI : https://doi.org/10.5281/zenodo.20308469
Download Full-Text PDF Cite this Publication

Text Only Version

Automatic Matrix Led Headlight System using Vision-Based Vehicle Detection

Mrs. G. Rajarajeswari

Assistant Professor, Dept of ECE

Co-Author : Naresh. B.

Department of ECE

Praveen. M.

Department of ECE

Shahul Hameed M

Department of ECE

Abstract – Night-time driving safety is severely affected by glare produced from conventional high-beam headlights of oncoming vehicles, often leading to temporary visual impairment and increased risk of road accidents. Most existing headlight systems rely on manual beam switching or basic sensor-based automation, which fails to adapt effectively to complex and dynamic traffic conditions. To address this limitation, this project proposes an Automatic Matrix LED Headlight System that utilizes computer vision and embedded control to achieve real-time adaptive illumination.

The proposed system employs a camera-based vision module to continuously monitor the road environment. A deep learning-based YOLO object detection algorithm is used to identify oncoming vehicles from video frames captured under nighttime conditions. The detected vehicles position within the frame is classified into left, center, or right regions, while orientation analysis is performed to distinguish front-facing vehicles from rear-facing ones using color-based tail-light detection. Based on this analysis, intelligent control commands are generated using Python and OpenCV and transmitted to an ESP32 microcontroller via serial communication.

The ESP32 controls a matrix LED headlight arrangement using pulse-width modulation (PWM) techniques, enabling selective dimming of specific LED segments rather than switching the entire headlight on or off. This approach ensures optimal road illumination for the driver while significantly reducing glare for oncoming traffic. Experimental results demonstrate reliable vehicle detection, smooth LED intensity transitions, and real-time system response with minimal latency.

The proposed Automatic Matrix LED Headlight System offers a cost-effective, scalable, and intelligent solution for adaptive automotive lighting. Its modular architecture allows future expansion such as distance-based dimming, real-vehicle integration, and compatibility with advanced driver assistance systems (ADAS), making it suitable for next-generation automotive safety applications.

I.INTRODUCTION

Road safety during night-time driving remains a major concern due to limited visibility and the glare caused by high-beam headlights of oncoming vehicles. According to traffic safety studies, a significant number of road accidents occur during night hours, primarily because drivers experience temporary blindness or discomfort when exposed to intense headlight glare. Conventional vehicle headlight systems require manual switching between high and low beams, which depends entirely on driver alertness and reaction time. In real-world driving conditions, this manual operation is often delayed or ignored, leading to unsafe driving situations.

To overcome these limitations, modern vehicles are increasingly adopting intelligent lighting systems capable of automatically adapting to surrounding traffic conditions. Adaptive headlight systems aim to provide sufficient road illumination for the driver while simultaneously minimizing glare for other road users. However, most existing systems rely on expensive sensors such as radar or LiDAR, making them unsuitable for low-cost vehicles and limiting their widespread adoption.

Recent advancements in computer vision and deep learning have enabled camera-based vehicle detection systems that offer high accuracy with reduced hardware complexity. Deep learning algorithms such as YOLO (You Only Look Once) allow real-time object detection, making them highly suitable for automotive applications. By integrating vision-based vehicle detection with embedded control systems, adaptive headlight behaviour can be achieved more efficiently.

This project presents an Automatic Matrix LED Headlight System that uses deep learning-based vehicle detection and a microcontroller-driven LED matrix to dynamically control headlight intensity. The proposed system detects oncoming vehicles, determines their position and orientation, and selectively dims specific LED segments to reduce glare while maintaining optimal visibility. This approach provides a cost-effective, scalable, and intelligent solution for improving night-time driving safety.

OBJECTIVES – A key objective of this project is to design the system as a universal and independent product that can be installed on vehicles of different brands and models. Currently, adaptive and matrix headlight systems are available only in selected premium vehicles offered by specific automobile manufacturers, making them inaccessible to a large number of users. This project is intended to overcome that limitation by providing a low-cost, manufacturer-independent solution that can be used as an aftermarket safety enhancement for existing vehicles as well as integrated into new vehicle designs.

II. SYSTEM ARCHITECTURE

The proposed Automatic Matrix LED Headlight System is designed using a modular and layered architecture that integrates computer vision, embedded control, and adaptive lighting hardware. The overall system is divided into two major subsystems: a vision-based processing unit and an embedded headlight control unit, which communicate with each other through serial data transmission. This architectural separation ensures flexibility, scalability, and ease of integration across different vehicle platforms, supporting the objective of developing a universal and manufacturerindependent solution.

The vision-based processing unit operates on a computing platform such as a laptop or embedded processor and is responsible for real-time video analysis. A camera module continuously captures road-facing video during night-time driving conditions. The captured video frames are processed using the OpenCV library, which performs frame acquisition, preprocessing, and brightness analysis. Based on ambient brightness levels, the system automatically activates night mode, ensuring that headlight control operations are performed only under low-light conditions. This reduces unnecessary processing during daytime driving and improves overall system efficiency.

Vehicle detection is carried out using a deep learning-based YOLO (You Only Look Once) object detection algorithm. The YOLO model analyzes each video frame and identifies vehicles by generating bounding boxes along with confidence scores. To improve detection accuracy and reduce false positives, confidence thresholds and geometric constraints such as bounding box area and aspect ratio are applied. This filtering helps eliminate nonrelevant objects and smaller vehicles that do not significantly contribute to glare, ensuring that the system focuses on nearby oncoming vehicles that require headlight adjustment.

Once a vehicle is detected, positional analysis is performed by dividing the video frame into left, center, and right regions. The horizontal position of the detected vehicles bounding box center is used to determine the appropriate dimming region. In addition to positional classification, the system performs orientation analysis to distinguish between front-facing and rear-facing vehicles. This is achieved through color-based analysis in the HSV color space, where the presence of red tail-light patterns indicates a rear-facing vehicle. If the vehicle is identified as rear-facing, no headlight dimming is applied, thereby avoiding unnecessary brightness reduction.

Afte determining the vehicle position and orientation, control decisions are generated in the form of simplified commands such as left, center, right, or no dimming. These commands are transmitted from the vision processing unit to the embedded control unit using serial communication at a predefined baud rate. This communication interface ensures low-latency and reliable data transfer, enabling real-time synchronization between software detection and hardware response.

The embedded headlight control unit is implemented using an ESP32 microcontroller, selected for its high processing capability, built-in PWM support, and low power consumption. Upon receiving control commands, the ESP32 adjusts the brightness of individual LED segments in the matrix headlight system using pulse-width modulation techniques. Instead of switching the entire headlight between high and low beam, the system selectively dims only the affected LED segments corresponding to the detected vehicle position. This selective dimming strategy ensures optimal road illumination while minimizing glare for oncoming drivers.

The matrix LED hardware consists of multiple LEDs arranged to represent different headlight zones, each connected through current-limiting resistors. The modular nature of the LED arrangement allows the system to be scaled for real automotive headlight assemblies. The use of standard components and a microcontroller-based design ensures that the system can be easily retrofitted into existing vehicles, reinforcing its role as a universal and cost-effective adaptive headlight solution.

Overall, the proposed system architecture enables intelligent, real-time headlight adaptation by seamlessly integrating vision-based detection with embedded LED control. The separation of software and hardware functions enhances system reliability and allows future extensions such as distance-based dimming, vehicle speed adaptation, and integration with advanced driver assistance systems.

III.ALGORITHM

Step1:

Initialize the system by importing required libraries such as YOLO from Ultralytics for object detection, OpenCV for image processing, NumPy for numerical operations, and time for frame rate calculation.

Step2:

Load the pre-trained YOLOv8 object detection model using the COCO dataset and initialize the video input source for capturing road-facing video frames.

Step3:

Initialize system variables, including previous time for FPS calculation and current headlight intensity, which represents the brightness level of the matrix LED headlight.

Step4:

Define a smooth brightness transition function to gradually change headlight intensity, preventing sudden brightness variations that may cause discomfort to the driver.

Step5:

Start continuous video frame acquisition using a loop and read each frame from the video source. If no frame is detected, terminate the loop.

Step6:

Calculate the frame rate (FPS) using the current and previous timestamps and display the FPS value on the video frame for performance monitoring.

Step7:

Convert the captured frame into grayscale format and compute the average brightness value to determine ambient lighting conditions.

Step8:

If the brightness value is below a predefined threshold, activate night mode and enable the intelligent headlight system. Otherwise, disable the system during daytime conditions.

Step9:

Display the system operating mode (day or night) and FPS information on the video output window.

Step10:

When night mode is active, apply the YOLO object detection model to the current frame to detect vehicles in real time.

Step11:

Filter the detected objects by selecting only vehicle class detections with confidence scores greater than the defined threshold to ensure reliable detection.

Step12:

Calculate bounding box parameters such as width, height, area, and aspect ratio for each detected vehicle and eliminate false detections such as autorickshaws using geometric constraints.

Step13:

Select the nearest oncoming vehicle by identifying the detection with the largest bounding box area.

Step14:

Extract the region of interest (ROI) corresponding to the detected vehicle and initialize the orientation as front-facing by default.

Step15:

Convert the ROI to HSV color space and perform red color detection to identify tail-light patterns.

Step16:

If the proportion of red pixels exceeds the defined threshold, classify the vehicle as rear-facing; otherwise, classify it as front-facing.

Step17:

Divide the video frame into three horizontal regions (left, center, and right) and calculate the horizontal center of the detected vehicle.

Step18:

Left region

Based on the vehicle position and orientation, determine the target headlight intensity:

Center region

Right region

  • Rear-facing vehicle no dimming

Step19:

Gradually adjust the current headlight intensity toward the target value using the smooth brightness transition function.

Step20:

Display vehicle status, confidence level, orientation, and current headlight intensity on the output video frame.

Step21:

Left-side dimming

Maximum dimming

Continuously display the processed video output until the user terminates the program.

IV.HARDWARE & SOFTWARE

Right-side dimming

The proposed Automatic Matrix LED Headlight System is implemented using a combination of embedded hardware and vision-based software components. The hardware unit is built around an ESP32 microcontroller, which is used to control the brightness of matrix LED headlight segments. Highintensity LEDs representing left, center, and right headlight zones are connected to the ESP32 through current-limiting resistors. Pulse-width modulation (PWM) is used to achieve smooth and selective dimming of LED segments based on control commands received from the vision processing unit. Serial communication is employed to ensure realtime data transfer between the software and hardware modules. The modular and independent design allows the system to be installed as a universal product across different vehicle models.

V. RESULTS

The software system is developed using Python and utilizes the YOLOv8 deep learning algorithm for real-time vehicle detection. OpenCV is used for video processing, brightness analysis, and visualization, while NumPy supports numerical computations. The software identifies night-time conditions, detects oncoming vehicles, determines their position and orientation, and generates appropriate dimming commands. These commands are transmitted to the ESP32, enabling automatic and intelligent headlight intensity control.

The proposed Automatic Matrix LED Headlight System was tested using recorded night-time driving videos to evaluate its detection accuracy and adaptive lighting performance. The system successfully identified oncoming vehicles in real time using the YOLOv8 object detection model. Vehicle detection was found to be reliable under varying illumination conditions, and the applied confidence and geometric filtering significantly reduced false detections from non-relevant objects such as auto-rickshaws and distant vehicles.

VI. CONCLUSION

The position-based dimming logic effectively classified detected vehicles into left, center, and right regions. Corresponding LED segments responded accurately by reducing brightness in the affected region while maintaining illumination in the remaining areas. Front and rear vehicle orientation detection using tail-light color analysis performed consistently, ensuring that headlight dimming was applied only for front-facing vehicles and avoided unnecessary brightness reduction for rear-facing vehicles.a Smooth brightness transitions were achieved using PWM-based intensity control, preventing suden changes in headlight intensity and improving driver comfort. Serial communication between the vision processing system and the ESP32 microcontroller showed minimal latency, enabling synchronized detection and LED response. Overall, the experimental results demonstrate that the proposed system provides effective glare reduction, real-time responsiveness, and reliable performance while maintaining a low-cost and universal design suitable for integration into various vehicle platforms.

This project presented the design and implementation of an Automatic Matrix LED Headlight System aimed at improving night-time driving safety by reducing glare caused by conventional high-beam headlights. By integrating computer vision techniques with embedded control, the proposed system automatically detects oncoming vehicles and dynamically adjusts headlight intensity

based on their position and orientation. The use of a deep learning-based YOLO object detection algorithm enabled accurate and real-time vehicle detection under varying lighting conditions, making the system reliable for practical driving scenarios.

The implementation of position-based and orientation-aware dimming ensured that only the required headlight segments were dimmed, rather than switching the entire beam. This selective dimming approach improved driver visibility while minimizing discomfort for oncoming drivers. The ESP32 microcontroller successfully controlled matrix LED brightness using PWM, providing smooth intensity transitions and real-time responsiveness. The serial communication between the software and hardware modules demonstrated minimal latency, ensuring synchronized operation of the system.

VII. FUTURE SCOPE

A key advantage of the proposed system is its universal and manufacturer-independent design. Unlike existing adaptive headlight systems that are limited to specific high-end vehicle models, this solution can be implemented as an aftermarket safety system suitable for a wide range of vehicles. The experimental results confirm that the system is cost-effective, scalable, and efficient in reducing glare during night-time driving. Overall, the Automatic Matrix LED Headlight System offers a practical and intelligent approach to enhancing road safety and represents a promising solution for future automotive lighting applications.

The proposed Automatic Matrix LED Headlight System can be further enhanced to improve performance and real-world applicability. Future developments may include distance-based headlight dimming by estimating the distance of oncoming vehicles using depth estimation techniques or stereo cameras, allowing more precise intensity control. The system can also be integrated directly with vehicle electronic control units (ECUs) through CAN communication for improved reliability and faster response.

VIII. DIFFICULTIES FACED

Additional improvements may involve replacing the standard camera with thermal or infrared cameras to ensure robust detection under adverse weather conditions such as fog, rain, and heavy glare. The LED matrix can be expanded to support higherresolution automotive-grade headlights for finer beam control. Furthermore, the system can be integrated with advanced driver assistance systems (ADAS) and autonomous driving platforms to enhance overall vehicle safety and intelligence.

  • The system relies on camera-based vision, which may be affected by poor weather conditions such as rain, fog, dust, or heavy glare.

  • Vehicle detection accuracy depends on the quality and proper alignment of the camera.

  • Low-light noise or excessive headlight glare can reduce detection performance.

  • Real-time performance is influenced by the processing capability of the system used for vision analysis.

  • The current prototype uses a simplified LED matrix, which may not fully represent real automotive headlight assemblies.

  • Additional calibration is required for different vehicle models and mounting positions.

    IX. REFERENCE

  • The system requires further testing and automotive-grade components for largescale commercial deployment.

  1. J. Redmon, S. Divvala, R. Girshick, and A. Farhadi, You Only Look Once: Unified, Real-Time Object Detection, IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016.

  2. A. Bochkovskiy, C. Y. Wang, and H. Y. M. Liao, YOLOv4: Optimal Speed and Accuracy of Object Detection, arXiv preprint, 2020.

  3. G. Jocher et al., Ultralytics YOLOv8: Real-Time Object Detection, Ultralytics Documentation, 2023.

  4. R. C. Gonzalez and R. E. Woods, Digital Image Processing, 4th ed., Pearson Education, 2018.

  5. Bradski, G., The OpenCV Library, Dr. Dobbs Journal of Software Tools, 2000.

  6. Espressif Systems, ESP32 Technical Reference Manual, Documentation, 2023. Espressif

  7. S. Chen, J. Wang, and Y. Li, Adaptive Headlight Control System for Intelligent Vehicles, IEEE Transactions on Intelligent Transportation Systems, 2019.

  8. R. Bishop, Intelligent Vehicle Technology and Trends, Artech House, 2017.

  9. Microsoft Research, COCO: Common Objects in Context Dataset, 2014.

  10. P. Viola and M. Jones, Rapid Object Detection Using a Boosted Cascade of Simple Features, IEEE CVPR, 2001.

  11. Z. Zhang et al., Vision-Based Vehicle Detection Techniques for Intelligent Transportation Systems, IEEE Access, 2020.

  12. H. Cheng and Y. Chen, Matrix LED Headlight Control Applications, for IEEE Automotive International Conference on Vehicular Electronics, 2018.

  13. S. Thrun et al., Probabilistic Algorithms in Robotics, AI Magazine, 2006. 14. T. H. Cormen et al., Introduction to Algorithms, MIT Press, 2009.

  14. N. Dalal and B. Triggs, Histograms of Oriented Gradients for Human Detection, IEEE CVPR, 2005.

  15. SAE International, Automotive Adaptive Driving Beam (ADB) Standards, SAE Technical Paper, 2021.

  16. Y. LeCun, Y. Bengio, and G. Hinton, Deep Learning, Nature, vol. 521, 2015.

  17. K. He et al., Deep Residual Learning for Image Recognition, IEEE CVPR, 2016.

  18. A. M. Khan et al., Embedded Vision Systems for Advanced Driver Assistance, IEEE Embedded Systems Letters, 2019.

  19. S. Rajendran and P. Kumar, Vision-Based Glare-Free Headlight Control System, International Journal of Vehicle Safety, 202