This project was developed and evaluated for ECE-5731 Course at Oakland Univeristy under Professor Dr Ramesh Sethu
A dynamic leveling and cornering headlight system using PIC32MZ2048EFM144 Microcontroller
To design an automatic headlamp leveling system that controls the angle of headlamp such that proper road illumination is achieved. The main objectives of this project are:
- To dynamically control the pitch angle of the headlamp using gyroscope and provide proper illumination angle of the headlamp.
- To control the headlamp angle during cornering and automate the headlamp leveling system.
The hardware components used for this project are as listed below:
- PIC32 board - For the current project PIC32MZ2048EFM144 microcontroller was used.
- Sensors: a. Gyroscope/Accelerometer - MPU6050 Chip was used which includes two sensors - gyroscope that detects the change in the angle and accelerometer that detects the speed of any moving object. For this project, the gyroscope alone was used. b. Photoresistor: Detects the intensity of the light and accordingly allows the flow of voltage.
- Actuators - Stepper Motor Two SG90 stepper motors were used. one for vertical movement and the other for horizontal movement.
- Potentiometer Used as a steer to indicate the direction of the vehicle.ECE 5731 Embedded Computing in Mechatronics Fall 2021 7 Final Project Report
- Relay- Used as a bridge the power difference between the headlamp and the board to avoid damages.
- Headlamp
- 12V power adapter Used to power the headlamp via a relay
- Bench setup
a. 3D-printed structures for supporting the headlamp system bench setup

MPLAB is proprietary free software that enables users to design, configure and debug embedded systems. MPLAB is an integrated development environment that helps to communicate with microcontrollers especially the PIC 32 and dsPIC (digital signal PICs) family line of microcontrollers.
- How Adaptive Headlights Work | HowStuffWorks
- User manual of PIC322048EFM144
- autoENG3: Automatic Headlamp Levelling (euromotor.org)
- PIC32MZ series I2C Tutorial
- PIC32MZ series PWM tutorial
Please feel to contact me on my email geethapoojithan@oakland.edu for any questions/concerns.

