Improvements for the ubiquitous alarm clock

Similar projects worth following
An alarm clock that gets rid of the annoyances associated with standard alarm clocks.
Some of the annoyances are:
* Only one alarm time for all days of the week. Everyone encounters being woken because you forgot to turn off the alarm for the weekend.
* The alarm time is not visible by default. You have to push some buttons to see it.
* The digits are too bright at night, preventing me to sleep.
* The digits are too small. The designers might have forgotten that people don't wear glasses at night.
* A little dot showing AM/PM. What is what?
* Setting the alarm doesn't turn it on.
* It takes two hands to set it. Was that a safety precaution?
* The buzzer sound is annoying as hell. Who wants to start a day like that?
* In some countries power blackout occur frequently, during these, the clock will not work.
* Some people complain that the standard alarm clocks are not loud enough.
* In case of power outage, the alarm doesn't sound.


  • Sunrise simulation
  • USB charge port (automatically identifying required charge protocol using TPS251x)
    • It should be discouraged to take a smartphone or tablet to your bedroom.  Give your mind some rest.
  • Large LED display
    • readable without glasses
    • Independently configurable display brightness settings for day & night
    • User configurable level to switch between day & night mode.
  • Light from LED-array and buttons can be fully turned off at night.  Waving at the clock will turn them on again.
  • Rubber feet (so it doesn't slide from your closet)
  • Wake-up sound from MP3 (2.5W in a 4ohm speaker)
  • One-handed configuration
  • Backup supply in case of power outage, powerful enough to sound the alarm.
  • Powered by USB adapter.  These are easy to get.
  • USB-B connector for power.  Even your grandma will be able to plug this in.  The same can not be said from a USB micro connector, used on the Blaupunkt BT16CLOCK (that's not the only reason to avoid this clock.  Try to turn on the FM radio without using the manual.  Good luck...  The UI is not very intuitive.) 
  • Update (Feb 12 2019) : Micro USB of BT16CLOCK has bad connection.  It's no longer possible to charge the clock.

Apparently Craig Bonsignore had about the same annoyances with standard clocks, that's why he built his own version.  I'll start off from that design: adding features I miss and scraping off costs where needed.

Future extensions (unplanned)

  • Wake up module, to be placed under the pillow.  Its vibrations will wake you, even if you're deaf.  It's a nice alternative to a very loud alarm which you're bed partner is not likely to appreciate.
  • Wireless functionality to sync slave clocks around the house.  Bluetooth GATT CTS (Current Time Service) may be of some use here.

Block diagram

Top level diagram of the clock

  • DCF77 decoder

    Christoph Tack04/13/2019 at 12:50 0 comments

    Assembled unit (lid removed to show internal construction)


    Schematic design and PCB layout can be found on EasyEDA.


    The DCF antenna doesn't work well when it's in proximity to EM-noise sources.  Possible noise source are the rest of the electronics of the clock or a laptop.  The solution is to put the DCF-antenna and the decoder in a separate housing.  It might not be necessary to use the separate housing once the clock is properly designed instead of using the breadboard and flying wires.

    Steps to follow:

    Main components


    It should be easy for the customer to find a suitable cable assembly to connect the box.  The connector should also be small and low profile.

    • Stereo audio jack cable :
      • flexible, cheap, readily available
      • user might be tempted to connect headphones.  This must be avoided.  At the least, the headphones shouldn't be damaged.
    • Modular jack cables :
      • 4pins, 6pins, 8pins, common use in POTS telephony and ethernet. 
      • Ethernet cables are not that flexible.
      • Big connector.  Might not fit inside the housing

    The initial idea was to mount a TRRS audio headset socket directly on the PCB,  Doing this would make it hard to correctly drill the needed hole in the front panel.  Moreover, such a connector, which needs to be placed against the wall of the housing would require a longer PCB than stated in the datasheet of the box.

    Two JST XH connectors will be used instead.  One connects to a panel mount TRRS audio headset socket.  The other connects to a panel mount LED.

    Cable assembly

    Many audio cables are constructed as two pairs of two wires.  So the left and right channel each have their ground wire in close proximity.  The ground wire is connected to the sleeve.  To take advantage of that cable configuration, the GND signal is here also connected to the sleeve.

    JST XH
    SignalAudio jack

  • Firmware

    Christoph Tack01/26/2019 at 21:10 0 comments

    Test hardware

    Big mess o' wires : don't repeat my mistake, instead put the antenna and the DCF receiver on a separate breadboard.

    This setup has the BluePill on the breadboard, connected to a Nucleo debugger (white PCB on the left).  The 7segment module on top connects to two GPIOs of the BluePill.  The BluePill receives its DCF-pulse info from a DCF-receiver on the breadboard.  That DCF-receiver is connected to a DCF-antenna, attached with rubber bands to the breadboard.

    DCF-signals are very weak.  Making breadboard connections with relatively long wires as done here, makes the BluePill a fairly good RF noise radiator.  So with the setup as shown here, it's nearly impossible to get a correct DCF-reading.  The picture was actually taken around 9PM.  The DCF-library makes a best guess of the data it receives.  There's no reliability threshold, so wrong data might be shown in the event of a useless signal.  Most of the times, even with a bad signal, the clock recovers and finds the correct time.

    I faced the same problems with the BluePill when trying to receive FM-RDS.  Using a Nucleo, results were a little bit better, even with the same mess of wires.

    Code can be found on Github.

    DCF signal quality for the same setup the next day, on Sunday, about the same time of day was much better.  No easy explanation about what caused such an interference on Saturday night.

    Parameter setup

    This design has quite a lot of parameters that can be set.  It's challenging to find a way to set these all up easily using only a 32x16 display.  The display can only show 10 characters at a time.

    Menu input would be limited to using a rotary encoder or a few switches.

    I have tried a few menu libraries for Arduino : Arduino Menu System, Arduino_LCD_Menu and ArduinoMenu.  They all suffer from the same problems:

    • Requiring a lot of key presses for setting up parameters
    • Difficulty of displaying the menu hierarchy in a way that is simple to grasp.  E.g.  setting the weekdays for the alarms are four levels deep in the menu.  Without a menu overview, it will be hard to keep track of what you're setting up.

    Let's take the Google clock app for Android as a reference.  This app allows to setup more or less the same parameters as listed below.  Using the app, an alarm can be setup in less than 30s.  This would be nearly impossible to do with a 32x16 LED array and four buttons.


    Parameter setup will be done using physical switches.  A combination of DIP switches and rotary switches will be used. 


    • Each parameter can be set without having to browse through the other parameters, speeding up the parameter setup process
    • Parameter status is indicated by the physical state of the switch.  This doesn't require power and doesn't cause undesirable light output at night.
    • Depending on the target audience, the switch functionality can be implemented using DIP-switches and rotary switches or with panel mount toggle switches and rotary switches that allow for older people to control the device.


    • Adds cost, because it requires a lot of extra hardware
    • No other means for setup of parameters (e.g. through bluetooth) because the switches would no longer reflect the current settings.  A way to circumvent this, would be to replace the rotary switches by rotary encoders & 7segment displays and replacing the dip switches by momentary switches and LEDs.

    The input panel will be implemented on a separate PCB, allow for upgrade, changes in a future stage.

    Menu structure

    • Alarm 1 (Alarm 2 has the same menu structure).  The menu item is dynamic.  An icon shows if the alarm is enabled or not, followed by the alarm time
      • Activation
        • On
        • Off
      • Time
        • HH:mm
          • minutes can only be set in 5min. steps.  It allows to set up time faster.  Nobody...
    Read more »

  • Housing

    Christoph Tack01/20/2019 at 11:50 0 comments

    Main housing


    Because of the sunrise simulation, the housing, or a least a major part of it must be translucent or transparent.  Translucent materials are preferred as the diffusion of the light will make the housing light up as a whole.  It's an option to use transparent materials for the housing and stick a translucent film onto it.

    • Acrylic : can be laser cut



    Antenna enclosure

    There's a chance that the electronics of the generate too much EM-noise, so that the antenna and receiver need to be placed in a separate housing.

    A suitable housing is the Hammond 1593NBK (Farnell €2.75).

    If you want to build a really cheap enclosure for your antenna with hot glue and some scrap piping, have a look here.

  • Clock IO Panel

    Christoph Tack01/11/2019 at 21:04 0 comments

    Block diagram

    First layout idea
    IO panel with two times two concentric LED rings

    Nothing to be really happy with.  This design is too large.  There are three rotary encoders with an internal switch.  The high switch actuation force of these switches prevents the panel from being used in a vertical position.  You would top over the clock when you push the switch of a rotary encoder.

    The three rotary encoders will each be replaced by a push button switch.  There will be one encoder for general change of values.  You push the switch to select that functionality.  Using the rotary encoder you can then change the value at will.  This kind of user interface is used on the R&S RTO200O series oscilloscopes.

    The double rings of WS2812B LEDs are also eating up too much space.  Let's replace these by LED bar graphs.

    Second layout idea

    LED rings replaced by LED bar graph

    The space consuming LED rings have been replaced by LED bar graphs.  Each one needs 10 inputs, so it will take some effort to get these routed properly.

    The button for setting the brightness of the LED array and the light sensor are not related to alarm settings, so they have been removed from this module.  Functionality for setting LED array brightness should be physically located near the LED array, not on a separate IO panel.

    So what's left? 

    • A menu button to cycle through the alarm settings (top left).
    • top right: a button to set alarm hour & minutes
    • seven buttons to enable the alarm for certain weekdays
    • a button to set the brightness of the sun rise simulation with the corresponding LED bar graph.
    • a button to choose the song to wake you + LED bar graph
    • a button to set the music volume, with LED bar graph
    • a single rotary encoder to change the value of a setting once the setting has been selected by a push on its button.

    It all doesn't look to well: all those bar graphs...  The rotary encoder is out of place.

    Let's work out another idea...

    Third layout idea

    Why not incorporate the LED bar graph functionality in the LED array?  We have plenty of pixels already there.  Both sides of the LED array can be flanked with buttons.  Alarm settings on the left, LED array settings on the right.  The pixel row next to the button can be used as a virtual LED bar graph.

    The LED array "PCB" and the clock-io-panel have been merged into a single PCB.  This reduces cost and it will mechanical assembly easier.

    Functionality overview at a glance, counter clockwise, starting at top left:

    • setting brightness of sunrise simulation
    • setting volume of alarm / music
    • select alarm tone /song
    • menu button for selecting the settings of alarm1 or alarm2
    • seven buttons to enable/disable the selected alarm on a day of the week
    • setting the alarm time
    • setting LED array night brightness
    • select at what ambient light brightness the day/night switch should occur.
    • setting LED array daylight brightness

    Alarm + LED array functionality merged into one IO panel.  Connectors & ICs...

    Read more »

  • Audio output

    Christoph Tack07/10/2018 at 15:13 0 comments

    Most clocks use sound to wake you up.  This clock is no exception.

    A little "DFPlayer Mini" module does all of that, also MP3 decoding.  It even includes a speaker driver.

    Yuexin YX5200-24SS module

    Works like a breeze with the platformio.  Be careful to connect your module correctly.  I've already destroyed one by wrongly connecting it and nearly killed a second one.  Strange...the polarity is clearly marked on the module.

    • User experience from Markus Wobisch
    • Library:
      • The official library from DFRobot locks up when making too many calls to it.
      • DFPlayer Mini Mp3 by Makuna is a better alternative
    • Before copying music files, normalize their volumes.
      • sudo apt install python-rgain
        replaygain --force *.mp3 

        I have the impression that it works well on a PC, but that the DFPlayer ignores the normalization.  I have also tried to use Audacity using the procedure described here, but also with disappointing results.

    • There are two options for audio output: headphones (stereo) and speaker (mono). 
    • Speaker output is generated by the on-board amplifier.  According to the VCC, GND and speaker connections, the amplifier is a PAM8302A (or LM4871, or XPT4871, or YX8002-8S).  This one can send 2.5W into a 4ohm speaker.  That's certainly loud enough.
    • The speaker output of the module certainly needs filtering to reduce EMI.
    • The speaker sound lacks low frequency content.  The input coupling of the PAM8302A might have a too high corner frequency.  Let's see what other designs are using:
      • Elektor "PAM8302A Audio Amplifier" (issue June 2018) : 180ohm in series with 220nF
      • Adafruit 2130 : 100ohm in series with 1uF
      • DFRobot advises to add a 1K resistor in series with the RX-line (pin 2) to reduce noise.
      • See also Markus Wobisch schematic to reduce noise.
    • EMI precautions : see Elektor "PAM8302A Audio Amplifier" (issue June 2018)

    WTV020 module

    GeneralPlus GPD2846A module

    This module doesn't seem to allow control by a MCU, except through USB.

    GeneralPlus GPD2856A module

    This module doesn't seem to allow control by a MCU, except through USB.

    PWM output

    It doesn't look like there's already an established solution for the STM32 platform.  This will require lots of work.

    The cheapest option would be to generate sound using PWM, but it requires some work.  The sound files also need special conversion before storing them to flash.  An output amplifier is needed for connection to a speaker.

    Arduino Wave shield

    It uses a MCP4921 DAC and an SD-card.  Both are SPI devices, but they're connected to a different bus.

  • Power supply

    Christoph Tack06/28/2018 at 11:41 0 comments


    If no sunrise LED is needed, then the electronics could be powered from a 5W USB wall charger.  The sunrise LED will probably need about an extra 10W.


    The common solution is to use a goldcap as back up power supply.  The limitations of goldcaps are:

    • limited energy storage capacity
    • high internal resistance
    • voltage decreases linearly with respect to the current being drawn.

    All of this makes that in case of power outage the goldcap can't be used to sound the alarm to wake the user.

    An alternative approach will be used here.  A cheap alkaline AA-cell will power a MCP1640 boost converter that will step up the voltage to the required 3V3.  As long as the normal power is supplied, the MCP1640 can be disconnected from the AA-cell.


    DCF-communication is susceptible to noise.  Proper filtering is needed to reduce the risk of bad signal reception.


    USB-C connector

    USB-C allows for a maximum power transfer of 20V/5A.  This would be more than enough for this project.

    The advantage of using a USB-C connector would be that a power adapter with USB-C could be used.  These will probably be quite standard in the near future.  At the time of writing (2018) these are still expensive.

    There are more drawbacks: to get the 20V/5A, the device delivering the power and the device sinking the power must communicate with each other using BMC-coding.  This is implemented in the Richtek RT1715 and the TI TUSB32x family.  These devices are still rather expensive.  The SMD packages are small and hard to solder by hand.

    Using this connector would be a typical case of over engineering.  There's no real advantage is using USB-C only for powering a device.  The exception could be for powering an electric razor.  You could use your phone charger to power it.  It saves you one power adapter in your luggage.

    DC jack

    Cheap, readily available, reliable...  The drawback is that there's no guarantee about the voltage level and polarity.  The user can connect whatever (s)he likes.  It's up to the powered device to cope with this.

  • Sunrise LED

    Christoph Tack06/24/2018 at 16:12 0 comments


    A gradually brighter light can mimic the sun rise.  It will allow for gentle wake-up in the morning.  

    Experience with the Philips HF3463 showed me that you shouldn't count on it to get up on time.  I sometimes find myself waking up by the alarm sound and facing the alarm clock in full brightness.  When you're sleeping on your side and the light is behind you, it won't wake you either.

    Needed output power

    A Philips HF3463 sunrise clock uses a Philps 100W 1200lm Softone lamp.  Replacing the bulb with a 60W 700lm still gives enough light.  So our light should also be able to output about 700lm.

    Selection of the lighting source

    • Lumileds Luxeon 3535L & Lumileds Luxeon 3535L HE Plus
      • LEDs cost about €0.42/pce
      • >180lm/W
      • 300mA max, lowest cost per lumen.  Other 180lm/W devices cost about the same but don't allow such high currents.
      • If driven at 200mA, then 7 LEDs would yield about 800lm.
      • "Could" be soldered to custom Al substrate PCB.  
        • AllPCB : 120x20mm or 100x30mm is $17 / 5pcs
        • How hard is it to solder LEDs on a metal substrate?
    • Bridgelux BXEB-L0280Z-50E1000-C-B3
      • 280x24mm, which is too long for the alarm clock
      • 180lm/W
      • 19.5V, 350mA, 1230lm
      • Digikey €3.12/pce (not available)
    • COB LEDs
      • DopDea DPD-9450-0414, ZF-9450-0414
        • Rectangular 94x50mm, 56 LEDs
        • Dimensions can be found here
        • AliExpress Store No.625859 : $2.84
        • Can be cooled with the same heat sink as the WayJun Epistar 10W
        • 12V, 500mA with 100x60x10 heat sink to keep LED temperature below 50°C.  This is still safe to touch without burning your skin.
    • 5050 LED panel
      • Available on AliExpress
      • Designed to replace incandescent light bulbs for car interior lighting.
      • The LEDs seem to be Seoul Semiconductor STW8T16C-Q0S0-HA.
      • The version with 24 LEDs should be bright enough.
      • Disappointing output : 80Lux at 1m, I=500mA, U=17V
    • GU5.3 Base fitting for MR16 lamps
      • 12V lamps
      • typically 500lm, which is rather limited
      • heatsink is part of the lamp
      • AliExpress has many on offer, very cheap
      • In a local store it was hard to find LED lights with a GU5.3 base.  GU10 (230V) is the most common type of lamp.  The best GU5.3 base LED lamp suitable for this application: 
        • Philips
        • 8W
        • 12V AC/DC
        • €11.95 (no kidding)
        • 630lm
    • Wayjun Epistar 10W
      • available on AliExpress from many vendors
      • commonly used in floodlights
      • cheap : $0.29/pce (cheap version 900mA), $0.94 (real version 300mA)
        • A sample of each has been ordered.  I received both but don't know which is which.  I asked the seller and they replied that the "heavier" one is the real one.  The "real" one is indeed about 4g heavier.  
        • They were both announced as warm white, but the "real" one is cold white.
        • The warm white one has a terrible thermal efficiency.  Without heat sink, the current needs to be lower than 100mA, or the LED will run too hot (>70°).
        • The light output of the warm white one is disappointing too.
        • The cold white LED performs a little better, but it's still disappointing.  Too much of the power is lost in heat.  These LEDs can't be used.
      • AliExpress "specs"
        • limited efficiency : 58lm/W (worst case for the cheap version)
        • 11V, 1050mA, 675lm
      • heat sink needed
    • Backlight panel
      • expensive: 100x100mm = €3.84
      • limited light output
    • 220V light with dimmer
      • requires 220V, which could be dangerous
      • consumes a lot of power because of the inefficient lamps
    • NeoPixel ring
      • No need for color changing the light
    • ...
    Read more »

  • Inspirational clocks

    Christoph Tack05/10/2018 at 20:30 0 comments

    O-Led Morphing clock

    Nice animations


    Harifun's Morphing Digital Clock

    Nice animation, (too) big LED array, too bright, blue color will keep you awake

    Harifun's Morphing Digital Clock

    Craig Bonsignore's Open Clock Project

    Nice clock, but without a manual, you can't properly operate it.  Sometimes digits are green and sometimes red.

    Craig Bonsignore's Open Clock Project, also on

    Xronos Clock

    Xronos Clock
    The idea of the arcade buttons is good, but the menu navigation is quite unusual.  The black button cycles through the menu items of the top hierarchy level.  The red button is used to go from top hierarchy to the level second level.  Then it cycles through the menu items of that second level.  The white button finally is used to change user settings.  As there are only three buttons, you can only cycle in one direction through the items.  For setting the year or the minutes of the hour, that's quite annoying.  A fourth button would have made menu navigation a lot more intuitive: up, down, select & back.

    See how long it takes and how many key presses are needed to set it all up?

    Nice housing

    Matrix Clock

    Nice animations

    Matrix Clock (technical data can be downloaded here)


    Nice animations


    Alpha Clock Five

    • Simple housing
    • Expensive LED display.
    • Acrylic housing (laser cut)

    Alpha Clock Five

    3-Way Display Alarm with 2.2" TFT

    • Has a brightness setting for day, night and allows setting brightness level for day/night transition.
    • It's personal taste, but :
      • I dislike the use of a different color for each digit.
      • Why design & 3D-print a RECTANGULAR housing?  Choose a COTS-housing, design your electronics to fit that housing, make cutouts in the housing where needed.

  • Time sync

    Christoph Tack03/18/2018 at 12:58 0 comments

    There are five options for setting time:

    • Long wave time signal
      • DCF (EU), MSF (UK), WWVB (US)
      • cheap modules only have a few 100km range.
      • more future proof than RDS.
      • signal easily disturbed by electronics in the vicinity (laptop, SMPS, ...) .
    • RDS 
      • no user interaction required
      • indoor use possible
      • EOL in Western Europe
      • Timestamp
        only sent once a minute.  When the reception quality is bad, you might have to wait some minutes to get the correct time.
    • NTP : requires user to type WPA-key in the alarm clock
    • GPS : needs a visible sky
    • GSM : needs a registered SIMCard
    • Manual : annoying
    • Preprogramming time at the production facility : Emerson's patented SmartSet "technology".  The user still has to set the time zone offset.

    Long wave time signal

    Commercially available DCF77 modules

    An evaluation of these DCF77 modules has been done by [Udo Klein] and can be found here.

    Signal quality tests with HKW antenna & receiver

    I hooked up the antenna to the receiver.  The receiver was powered by a Protrinket3V, which in turn was powered by a TTL-232R-3V3-WE.  The DCF output was monitored using a Smartscope.

    At first, there was no useful signal.  I pulled out all the mains plugs to find the culprit.  I found three of them:

    • USBwire lead of the TTL-232R-3V3-WE
    • Asus charger for Asus X550L laptop (only when DC-jack is plugged into the laptop)
    • Power adapter for Fantasia Xaro Desk light (EAN 5414358095390).

    Moving the antenna closer to the window, away from these noise sources solves the problem.

    I also discovered that signal quality can vary strongly during the day.  During programming the signal went very bad.  After a few minutes it turned all of a sudden to a good signal again.  Nothing in my house was switched on or off during that instant.

    The DCF77 Analyzer/Clock v2.also uses an external antenna and receiver.  I also get the best results when the antenna and receiver are on one breadboard and the rest of the electronics are on another breadboard.  There needs to be at least 30cm space between them.  The antenna should also be kept at least 30cm away from the laptop.

    Decoding time

    Visual indicaton

    The problem I quickly encountered is bad signal quality from the module.  Rotating the antenna helps, but you can't ask from users to do this for you.  A solution could be to add a monostable multivibrator to the DCF output that triggers on falling edges.  It could have a 500ms timeout.  If you connect an LED to it, there would be a visual indication of signal quality.  The user should see the LED flashing at a 1Hz rate.  If the LED stays on or off then signal quality is bad.

    Screenshot of DCF signal
    Thijs Elenbaas] uses edge triggering.  In the presence of noise, this is not a good idea.  In the image above you can see why.  There are only three signal pulses (2 times 200ms, 1 time 100ms).  All the other pulses are noise.  I let this library run for 8 minutes without success.

    [Udo Klein] put quite a lot of effort in providing an alternative in his Blinkenlight project.  Unfortunately this project only works for AVR architectures.  I forked the library and added support for the Bluepill.  The other big drawback is that it takes at least 5 minutes to sink.  With a bad signal, this can increase up to 30mins.  The library of [Udo Klein] also requires you to synchronize your clock to the DCF77.  If you don't...

    Read more »

View all 9 project logs

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates