Making The Best Alarm Clock In The World
Posted on: 16 November 2016
I've had a lot of alarm clocks over the years, and I've never been 100% happy with any of them. Maybe I'm just too demanding, but here's what I want from an alarm clock, in no particular order:
- displays the time all the time - no pressing buttons or anything to make it show the time
- mains-powered - batteries go flat, usually at the most important time
- easy to set recurring alarms for different times on different days
- easy to override invidual alarms
- easy to add ad-hoc alarms
- customisable alarm sounds, played at increasing volume
- dim the display at night, and get brighter during the day
- looks nice
- automatically keeps the correct time, including switching to and from daylight savings time
Actually, looking back over that list, I guess I am pretty demanding. Anyway, some recent playing with an Arduino starter kit and Raspberry Pis got me thinking that maybe I should build my own alarm clock. How hard could it be?
I started with a bit of research about similar projects other people had done, and kept coming back to Matt Dyson's Alarm Pi project. Not only does his clock do everything I want plus a whole heap more, he's also written it up really well, making it very easy to follow what he did.
My version uses my Google Calendar for alarms - it uses their API to get the next calendar event with a title of "Alarm". This means I can set alarm times using any Google Calendar client - my phone, tablet, home PC, work Mac, whatever.
I've used most of the same parts as Matt, although I only needed
- A Raspberry Pi 3 to be the brains of it all
- LCD display to show the time
- A big button to turn off the alarm
- A speaker and amplifier so I can hear the alarm
- Light sensor for auto-dimming
- All sorts of little bits of wires, breadboard, a cobbler, headphone jack for fixing everything together
As I'm in the UK, I got the parts from Proto-Pic and ModMyPi (they both only had some of the parts in stock!)
Once all the parts arrived, after a minute of "wow - this is gonna be great!" came the realisation that I had no clue how to fit all those bits together! But hey - that's most of the point of a project like this. Luckily Adafruit have excellent instructions for their components, so by going one step at a time, I managed to get each individual component doing what I told it to do.
Once each bit was working invidiually, I stuck them all together on my prototyping breadboards:

Next was quite a lot of learning Python and getting all the parts to work nicely together - you can see the code on Github. Finally I found a nice old wooden jewellery box on eBay, cut a few holes in it, and dropped in all the pieces:

You can see the light sensor on the side, and the "stop alarm" button on the top - the green LED around the button lights up when the alarm goes off.
And that's how to build the best alarm clock in the world.