This is a computer vision based alarm clock that does not turn off until it detects a significant amount of motion. This is useful for people like me who cannot resist the snooze button and need a more forceful way to get out of bed.
The program utilizes a raspberry pi and the OpenCV library to perform the motion detection tasks. To use this program, the camera should be pointed towards the user's sleeping location (i.e. their bed), and the raspberry pi should have some audio output abilities set up. The user can run the program with arguments for their wake up hour, minute, and their wake up audio file. When selecting an audio file, it is important to note that this program can only play the first half second or so of the file, so one should choose a beep or similar audio. You won't wake up to something pleasant, but you will wake up. In a future update to this project, this will be fixed such that any audio file can be played. To ensure that the alarm clock is effective, one should configure the variables in the program for their camera setup and personal preferences. To better visualize the results of editing variables and to view what the camera is pointed at, one should set show_video to True so that they can see the results of their modifications on the video feed.
As for the mechanics of the system, motion is detected by comparing the previous frame with the current one, and if there are enough differences between the two, then a motion counter is incremented. If the motion counter passes a threshhold (should be modified based on user preference), then it is assumed that the user has left their bed and the program ends.
In making this program, numerous tutorials were consulted, with the most useful of the bunch coming from pyimagesearch.com. There is a fantastic two part series on basic home surveillance and motion detection using a raspberry pi and opencv. The code in the program draws from these tutorials, but has been modified for use as an alarm clock rather than home surveillance.