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.

The_Clock_Library_Architecture

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.

Advertisement
This entry was posted in Uncategorized. Bookmark the permalink.

27 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 http://arduino.cc/en/Main/ReleaseNotes:

    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)
    http://code.google.com/p/arduino/issues/detail?id=300

    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
          warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

          ~/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
          warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

          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!
    Erik

  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?

  7. Apologies for not replying!
    After trying your code I was busy building my first Arduino project, a DCF77 Analyzer/Clock and forgot to check for your reply…

    But Now I want to get your *amazing* code working but I have only access to a Mac Mini PC with OSX Yosemite.

    For Windows users there is a solution now.
    I want to dive into this to solve the compiler issue for OSX users but how do I do that? Can you give me directions as how to get the IDE to use a recent compiler?

  8. Erik de Ruiter says:

    Oops, with OSX IDE 1.5.8 it does work!

    IDE version ………….. : 158
    GCC compiler version ….. : 4.8.1
    avr-libc version ……… : 1.8.0svn
    Compile date …………. : Nov 12 2014
    Compile time …………. : 15:35:04
    Filename …………….. : CHECK_GCC_en_libc_VERSIONS_.ino
    Compiler major version … : 4
    Compiler minor version … : 8
    Compiler patch lever nr .. : 1

    Initializing…

    Simple DCF77 Clock V1.0
    (c) Udo Klein 2014
    http://www.blinkenlight.net

    Sample Pin: 19
    Inverted Mode: 1
    Analog Mode: 1
    Monitor Pin: 18

    Initializing…
    ……………………………………………………
    ……………………………………………………
    ……………………………………………………
    ……………………………………………………
    ……………………………………………………
    ……………………………………………………
    ……………………………………………………
    ….synced: 2014-11-12 15:32:44+01
    synced: 2014-11-12 15:32:45+01
    synced: 2014-11-12 15:32:46+01
    synced: 2014-11-12 15:32:47+01
    synced: 2014-11-12 15:32:48+01
    synced: 2014-11-12 15:32:49+01
    synced: 2014-11-12 15:32:50+01

  9. I’m located in The Netherlands, Zwijndrecht (near Rotterdam)

    I do have a HKW module with the large antenna but will try your code with 3 other boards I got from old DCF clocks. With those modules I could NOT get descent reception the ‘normal’ way.
    It will be very interesting to see how your code performs under harsh conditions. 😉

    I just got your code working with the newest build IDE as I said. but plan to build your ‘super-filter’ and put it in my cf77 Analyzer clock (see web link). Looking forward to a far better performance!!

    Amazing what you accomplished… Thank you very much!
    I will make a small pcb with the status led’s etc. just to function as a ‘stand-alone’ super filter for many clocks I am planning to build.

    PS: Why is there no Paypal donation button on your site?

  10. Decoded time: 14-11-12 3 19:57:02 CET ..
    results after almost 2 hours: with HKW module:

    Quality (p,s,m,h,wd,d,m,y,st,tz,ls,pm): 17 (5749-0:255)(171-0:24)(248-16:32)(252-20:32)(253-138:16)(252-136:16)(255-138:16)(252-135:16)114,57,57,50

  11. Just donated via Paypal, thanks for an outstanding library! 🙂

    Yes, I have a very good signal with the HKW module. But I want to build an 8×10 cm ‘Gorgy’ bedside Clock and I’m interested to see what happens if I mount the antenna in the clock itself instead of an antenna on a long wire…

  12. Thanks you…! Yes, such an decoding display would be fantastic in one of those beautiful English Cloks! I am looking forward to your design! 😉

    I can spend hours on your site, gazing at your craftsmanship and eye for detail… very, very impressive…

  13. I forgot to say Udo, that thanks to your ‘Super Filter’, I can now use my old EVL DCF86 clock (see photo on my Flickr website) again!
    The old ‘active’ antenna was bad but now I can feed it with a clean signal… 🙂

  14. The super filter was implemented just as an afterthought. Great that you deem it useful. Post a link once you have the setup running. I am always interested in benchmarks before / after.

Leave a Reply to perhof Cancel reply

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

WordPress.com Logo

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

Facebook photo

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

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.