I made this simple program that uses my webcam to detect small movements during my sleep, in an attempt to detect which phase of sleep I am on. (Assuming that during REM your body moves a bit)
I am now trying to use this in combination with the CAN-WILD technique to wake me up just barely enough to then apply an WILD method.
I'm not sure though about the exact timings of this. Should I play the alarm as soon as I detect movement? Or wait a couple minutes?

I've heard about custom alarms that wake you up softly by waking you during REM phase (IIRC), so I thought this could be a good idea.

Any input is appreciated,
Thanks.