This paper proposes a novel algorithm for detecting driver's drowsiness based on head nodding behavior, addressing challenges from slanted head positions and vehicle motion. The algorithm analyzes facial features to identify key parameters that indicate drowsiness, exhibiting a detection accuracy of 96.56% in empirical tests. The study emphasizes the importance of facial recognition in improving driver monitoring systems to enhance road safety.