This project aims to address the critical issue of driver fatigue and enhance road safety by incorporating an Anti-Sleep Alarm system. Driving under the influence of alcohol, drugs, and distractions has long been recognized as major risk factor contributing to accidents. However, a recent study has shed light on another significant cause: drowsy driving. In the United States alone, drowsy driving is responsible for approximately 5,500 traffic deaths each year.
In the code, the programmer declares global variables, including the sensor pin, buzzer pin, and motor pin.. The setup function initializes the system by setting the sensor as input, the buzzer and motor as output, and the motor initially high to keep the wheels running. The main loop continuously reads the sensor’s output and executes the corresponding conditions. The sensor detects closed eyes, sounds the buzzer, and lowers the motor to stop the vehicle. If not, a 3-second delay is introduced, followed by lowering the buzzer and keeping the motor high for motion.