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 retain 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 user interface.

3) Display time using nixie tube displays.

Implementation

hberg32 successfully implemented code and wiring for a similar project. 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 nixie tubes to display the time.

Merciless Pi Alarm Clock

Prometheus Program

The UI portion of this project consists of a Golang web server running on the Raspberry Pi which can be accessed on any internet capable browser. The web server serves up the intial index.html page at the site root (e.g. 111.111.111:3000 where 111.111.111 is the wlan0 IP of the Raspberry Pi). Through heavy use of Vue.js, this page acts as a SPA (single page application). It makes heavy use of the AJAX post requests for the switch buttons, file uploads, and time form submit. It populates the values of the alarm times, sound, and vibration buttons with the values stored in alarms.json which holds the configuration data for the 4 alarms. When the user submits the form, the Golang web server handles the request as a put request, reads the data, changes the internally stored values for the 4 alarms, and writes back the values into alarms.json. The only button on the page that requires a hard refresh is the snooze button at the top because the web server needs to compute the value of +10 minutes on the currenly running alarm.

A working demo of the web interface can be found here: Link

When the requested the root, it will expose the public folder containing an index.html file (which browsers automatically load), it loads configurations from the alarm configurations from the file alarms.json. It also loads other configuration details like the name of the sound fileLED enable/disable settingLED color settingIP change email notification enable/disable settingIP change email address destination setting, and the enable/disable custom sound card setting.

Vue.js is used to obtain and parse these values from the client side browser when the page is loaded (and incorporated into the Vue instance's data to to populate the page). Other features of Vue such as two way data binding is used inconjunction with AJAX asynchronous POST to ensure the page doesn't have to reload unless necessary.

User Interface Demo

In addition to serving the user interface, the main program also controls the hardware interfaces (bed vibrator and speakers) for the alarm. The main logic for when to start running an alarm is a cron task that runs once a minute: if an alarm time configuration matches the current time, then run the relevant waking methods (i.e. vibration/sound). 

More specific implementation information is written here.

Hardware Implementation

For nixie cathode display portion, I decided to purchase the NCS314 kit from GRA and AFCH from 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 construct a clock display using dated technology. Their clock definitely did the job. However, in using the clock for an extended period, I realized that the RTC module they used is highly inaccurate and the clock time drifted more than 10 minutes every month. Hence, I connected the clock's Arduino's USB interface to the Pi's USB, and modified my program to send the correct time (which Pi gets via NTP), over serial USB. In addition, since the Pi is sending time every second anyways, I also added the ability to change the LED lighting on the clock.

Next, for the bed vibrator portion, I used the SS12V that came with the alarm clock that I was already using from SonicAlert. In order to control this from the Pi, I ran into two issues: 1) The bed vibrator ran 12V @ 0.5A (peaking at 12V @ 1A), which, if powered by my Pi, would easily fry it and render it useless. 2) The logic pins on the Pi do not explicitly have the means to either enable or disable a electrical circuit. Hence, I decided to use a primitive motor controller, the L293D as well as a separate 12V @2A power supply (separate from the Pi's power supply) to power the bed vibrator as well as the Nixie Cathode Clock portion. Circuit is under /assets/AtomicClockSchematic.fzz (Fritzing Document) on my repository.

My speaker system itself is quite the assortment of parts with a Marshall Stanmore standalone speaker, a Polk Audio Subwoofer, a Polk Audio Floor Speaker, and a Receiver all working together to produce some very loud sound. Hence, outputting sound to this system ensured that even a heavy sleeper like me can wake up with 100% certainty.

If you need more details on the hardware implementation, head over to Github wiki page.

Contact

Feel free to contact me at (leeas@stolaf.edu) if you have any suggestions, or want to contribute to this project. The Github Repo for the project is at (https://github.com/gilgameshskytrooper/prometheus). I have more detailed information here.

Special Thanks

I would like to thank hberg32 for all his help in helping me understand the hardware aspect of this project. I would not have gotten anywhere without his help and I am eternally grateful.

Also, AFCH from GRA & AFCH who produces the nixie clock kit I bought was also monumental in helping me modify his Arduino Sketch and to add serial USB communication functionality between the Pi and the Clock.

The default sound included in the public/assets folder is the song I'm in Love With U Tonight which is released under the Creative Commons license. I would like to thank Kukkovka Hell Studios and Alex Fry, Vadim Bogorodksi, Andrew Bones, and Yaroslav Tregubov for their work.

I am utilizing the Quicksand and Ostrich Sans fonts for this project. I would like to thank Andrew Paglinawan and Tyler Finck for their beautiful work.

Furthermore, I would like to thank Čestmír Hýbl for his work in creating the JavaScript based Nixie Clock used in the front-end of this project.