The dcf77 Library

Finally I separated my DCF77 decoder into a library. The dcf77 library will give your projects the same extraordinary noise resilence as the clock.


It also comes with several examples.

There is one issue with my library though. With Arduino 1.0 the library is fine. However with Arduino 1.0.1 and higher the compiler bloats the code. The size issue is anoying but not really critical. However it also slows down the code which in turn makes clock synchronization impossible.

If anyone knows that changed and how to fix it I would be very grateful.

About these ads
This entry was posted in Uncategorized. Bookmark the permalink.

13 Responses to The dcf77 Library

  1. perhof says:

    the 1.0.1 issue sounds like a compiler issue. From the Arduino 1.0.1 release notes at

    Added the gcc toolchain to the Linux distribution. (To use the
    toolchain already installed on your system, simply delete the one
    that comes with the Arduino software.) (Paul Stoffregen)

    Could this be what’s causing the mess?

    • I checked the compiler versions. –> Fixing the compiler makes the code behave as it should. Why did they bundle Arduino 1.0.1 with an outdated compiler?

      • perhof says:

        I don’t know and what I don’t understand is how there could be so many big functional differences between the compiler versions.

      • ~/Desktop/arduino-1.5.5/hardware/tools/avr/bin$ avr-gcc --version
        avr-gcc (GCC) 4.5.3
        Copyright (C) 2010 Free Software Foundation, Inc.
        This is free software; see the source for copying conditions. There is NO

        ~/Desktop/arduino-1.5.5/hardware/tools/avr/bin$ ./avr-gcc --version
        avr-gcc (GCC) 4.3.2
        Copyright (C) 2008 Free Software Foundation, Inc.
        This is free software; see the source for copying conditions. There is NO

        So I am running an old version of avr-gcc and Arduino manages to bundle an even older version. Seems these guys did not put to much effort into bundling anything reasonable.

  2. Brett Oliver says:

    I am having problems getting the DCF77 to sync. I just get clock state useless no matter how long I leave it running.
    Quality (p,s,m,h,wd,d,m,y,st,tz,ls,pm): 0 (1139-16:70)(87-17:11)(84-84:0)(95-73:3)(31-25:1)(74-66:1)(58-54:0)(52-46:1)4,14,14,255
    Clock state: useless
    I am using a modded UNO r 3 with a crystal not a resonator a Blinkenlight and an inverted DCF77 signal. I have checked with the DCF77 scope and the drift is very good. I have tried compiling with Arduino v1 as well. The Blinkenlight also shows a good clean signal.

    With my own code the DCF77 syncs in a couple of minutes. Any idea where I am going wrong?

    • Maybe the compiler caused the issue. Would you please set compilation to verbose and copy the The_Clocp.cpp, The_Clock.cpp.hex, The_Clock.cpp.elf, The_Clock.cpp.o into an email and send them to me?

      One more thought: the numbers (1139-16:70) indicate that the clock was running for maybe a minute or that it gets very poor signal quality. The numbers 14,14,255 indicate that it was running for at least 14 minutes. Thus I suspect that you have poor signal quality. On the other hand (1139-16:70) also indicates that it can keep a phase lock to the seconds tick –> leave it running for one or two hours and copy the full log and also send this to me by mail.

      • By now I have run my clock for 14 minutes with a very clean signal and here is the result:

        Decoded time: 14-03-04 2 19:25:20 MEZ ..
        Quality (p,s,m,h,wd,d,m,y,st,tz,ls,pm): 3 (5993-0:255)(163-0:22)(104-78:4)(91-65:4)(39-26:2)(78-65:2)(65-52:2)(52-39:2)28,14,14,50
        Clock state: synced
        Tick: 14

        Conclusion: either your signal is poor or the drift is causing the issue. Would you mind to send me a 30 minute log of the DCF77 scope?

  3. Brett Oliver says:

    I have sent you copies of my files . I have also tried installing Arduino v1 on a Windows 7 machine and uploading The Clock file. I still get the same results. “Clock state: useless”

  4. Thanks for pointing this one out!

  5. Erik de Ruiter says:

    Sadly your outstanding library does not work with my setup. :(
    I use Arduino IDE 1.5.6r2 and a breadboard UNO with crystal.
    DCF Signal is excellent but no sync…

    Thanks anyway!

  6. Brett Oliver succeeded with the instructions by Andy Brown. Why is this no option for you? Or did you fail with these instructions? Which OS do you use?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s