The idea was to have a clock that does everything. The 3 main things I want to integrate in this project are:
1) Connect the clock to a bed shaker so my alarm clock can wake me up discretely without waking up my roommate, but also the ability to wake me up in a super noisy fashion by playing an alarm tone through my speaker system for when I really need to wake up.
2) A way to set the alarm via my phone, iPad, or Browser through a polished and intuitive web-interface controller.
3) Display time using nixie cathode tubes displays.
hberg32 has already successfully implemented some of the code as well as the hard wiring for a similar project of his. My project however, will add a full RESTful web server as the control mechanism for the alarm clock, JSON files to store the configuration of the alarms, and a nixie cathode tube clock to display the time.
Hardware Control Program
The hardware control portion of the clock was implemented in Python 3. The program completely event driven, and uses a library called Pyinotifyer to check for when write/close happens to 3 types of files:
1) Alarm Information
time.json gets updated automatically every minute, and when the program detects this file was changed, it checks to see if any of the alarms share the same time with the current time. If they do not, then nothing happens. If they do, then run the alarm based on the configuration of the alarm configuration. (sound, sound + vibration, or vibration)
If any of the alarm files were modified, then the program would modify the Alarms class variables to match the new information from the JSON files.
When snooze was modified, then the program would see which alarm is currently running, then turn it off, and set that same alarm to run 5 minute from when it was initially set.
The way the alarm plays sound is via the subprocess library, in which it executed the command line program "vlc-nox" to play the sound stored in the web server, and killed when the run alarm loop ended (either snooze it turned on, or the alarm itself is turned off). Next, the program ran the vibration by using the Raspberry Pi GPIO library. (More about that in the hardware implementation section)
For nixie cathode display portion, I decided to purchase the NCS314 kit from GRA and AFCH of Ukraine. They post their source code to Github, and had a good track record of helping people with the software they wrote. Since I was concentrated on the alarm portion of the project, I decided I did not want to get bogged down in the complex details of how to...Read more »