Traffic accidents due to drivers falling asleep while driving is an important cause of death, and effective techniques for coping with this phenomenon are needed. In this paper we present a simple, yet effective algorithm, based on heart rate variability analysis. Results of the experimental validation are reported: two test sessions were performed, one in domestic environments and one in realistic driving environments by using a dynamic driving simulator. The results confirm the results obtained in the previous work (Groppo et al., 2020), and the capability of the proposed algorithm in predicting sleep while driving using a physiological signal that can be collected at the wrist of the driver.INDEX TERMS Drowsiness onset detection, sleep onset, accident prevention.