Alarm that wakes you up as soon as you fall asleep

I wanted an alarm that would wake me up as soon as I fall asleep.

I sometimes get tired during the day, and falling asleep for as small as 2-4 mins and getting up wakes me up.

Kind of like how Thomas Edison would hold a couple of balls in his hand and as soon as he dozed off, the balls would fall and he would be woken up.

This helps in feeling refreshed, as well as going into diffuse mode after you’ve learnt something.