Comments on: Tweaking the code http://gonium.net/md/2007/04/18/tweaking-the-code/ so much time, so little to do. Tue, 30 Nov 2010 21:05:12 +0000 hourly 1 http://wordpress.org/?v=3.0.1 By: Richard http://gonium.net/md/2007/04/18/tweaking-the-code/comment-page-1/#comment-2422 Richard Sun, 07 Jun 2009 19:02:30 +0000 http://gonium.net/md/2007/04/18/tweaking-the-code/#comment-2422 hi, on ATMega328-based Arduinos, this code is not running. Any idea if the changes for ATMega168 is also valid for ATMega328 ? Thanks a lot for this nice work ! Best regards. hi,
on ATMega328-based Arduinos, this code is not running.
Any idea if the changes for ATMega168 is also valid for ATMega328 ?
Thanks a lot for this nice work !

Best regards.

]]>
By: Richard http://gonium.net/md/2007/04/18/tweaking-the-code/comment-page-1/#comment-2421 Richard Sun, 07 Jun 2009 18:57:44 +0000 http://gonium.net/md/2007/04/18/tweaking-the-code/#comment-2421 hi, Atmega328 this code I am findi hi,

Atmega328 this code

I am findi

]]>
By: passi http://gonium.net/md/2007/04/18/tweaking-the-code/comment-page-1/#comment-2419 passi Sat, 06 Jun 2009 16:15:45 +0000 http://gonium.net/md/2007/04/18/tweaking-the-code/#comment-2419 I have some issues with keeping the time as well but got a rtc clock flying around here, can you drop me a line with the code for this one so I can see how you solved the periodical syncs? Cheers Passi I have some issues with keeping the time as well but got a rtc clock flying around here, can you drop me a line with the code for this one so I can see how you solved the periodical syncs?

Cheers

Passi

]]>
By: koos http://gonium.net/md/2007/04/18/tweaking-the-code/comment-page-1/#comment-2418 koos Thu, 28 May 2009 15:35:08 +0000 http://gonium.net/md/2007/04/18/tweaking-the-code/#comment-2418 Hello Mathias, Firstly, thank you for publishing this nice piece of code ! Due to a faulty DCF board, as I found out later, I needed to take a closer look at it. I discovered a small bug that causes the backup stand-alone clock to lag a few milliseconds/second behind. Furthermore I needed to optimise the code in order to include the clock in other program. Amongst others, the timer interrupt now occurs once per second using the TimerOne library. If you would like I can mail the modified sketch to you to publish a new version. groeten, koos Hello Mathias,

Firstly, thank you for publishing this nice piece of code !
Due to a faulty DCF board, as I found out later, I needed to take a closer look at it. I discovered a small bug that causes the backup stand-alone clock to lag a few milliseconds/second behind. Furthermore I needed to optimise the code in order to include the clock in other program. Amongst others, the timer interrupt now occurs once per second using the TimerOne library.
If you would like I can mail the modified sketch to you to publish a new version.

groeten, koos

]]>
By: ahon http://gonium.net/md/2007/04/18/tweaking-the-code/comment-page-1/#comment-2417 ahon Mon, 25 May 2009 16:01:14 +0000 http://gonium.net/md/2007/04/18/tweaking-the-code/#comment-2417 hallo, I hope you still check this thread. I tried your code, it seems work fine. but it starts always from 0, such as; Time: 0:0:1 Date: 0.0.0 Time: 0:0:2 Date: 0.0.0 i waited for start up for 5minutes. but start it still from 0.. any idea? thanks ahon hallo,
I hope you still check this thread.
I tried your code, it seems work fine.
but it starts always from 0, such as;
Time: 0:0:1 Date: 0.0.0
Time: 0:0:2 Date: 0.0.0
i waited for start up for 5minutes.
but start it still from 0..
any idea?
thanks
ahon

]]>
By: md http://gonium.net/md/2007/04/18/tweaking-the-code/comment-page-1/#comment-2398 md Wed, 28 Jan 2009 19:31:55 +0000 http://gonium.net/md/2007/04/18/tweaking-the-code/#comment-2398 Hi Jan, I am sorry to hear that the code has these hiccups. I don't have an Arduino any more (I gave it to my brother) so I can't reproduce it now. If I remember the code correctly it simply measures the time between two signals as received by the DCF77 module. Depending on the time between two signals it determines if a "0" or a "1" bit was received. Each second a bit is transmitted. The 59th second does not contain a bit and is used to synchronize the beginning of a new minute. I think here lies the problem: there is no signal for longer than a second, so the code resets the second count. I would guess that you have an electrical problem: either the DCF signal is to weak where you are or the connection between the Arduino and the receiver is not solid. Try a different location and different pullup resistors (e.g. 10k vs 4k7). HTH, -Mathias BTW: In another (unpublished) project I use the DCF77 receiver only to synchronize time periodically. I rely on a RTC to keep the time, in my case the DS1307. It also allows you to have a backup battery that keeps your time even if the power goes down. Reminds me that I could blog about this project ;-) Hi Jan,

I am sorry to hear that the code has these hiccups. I don’t have an Arduino any more (I gave it to my brother) so I can’t reproduce it now. If I remember the code correctly it simply measures the time between two signals as received by the DCF77 module. Depending on the time between two signals it determines if a “0″ or a “1″ bit was received. Each second a bit is transmitted.

The 59th second does not contain a bit and is used to synchronize the beginning of a new minute. I think here lies the problem: there is no signal for longer than a second, so the code resets the second count.

I would guess that you have an electrical problem: either the DCF signal is to weak where you are or the connection between the Arduino and the receiver is not solid. Try a different location and different pullup resistors (e.g. 10k vs 4k7).

HTH,
-Mathias

BTW: In another (unpublished) project I use the DCF77 receiver only to synchronize time periodically. I rely on a RTC to keep the time, in my case the DS1307. It also allows you to have a backup battery that keeps your time even if the power goes down. Reminds me that I could blog about this project ;-)

]]>
By: Jan http://gonium.net/md/2007/04/18/tweaking-the-code/comment-page-1/#comment-2397 Jan Tue, 27 Jan 2009 19:32:52 +0000 http://gonium.net/md/2007/04/18/tweaking-the-code/#comment-2397 Hi Mathias, thanks for your DCF-77 code! I've got a question: I've been running version 0.2.1 for about a day on a Diecimila board, and found that it loses about half an hour over a day. Every now and then, it seems to miss a few seconds, and then goes back to the start of the same minute. Here's an example from the serial log with two such hiccups: Time: 19:54:57 Date: 27.1.2009 Time: 19:54:58 Date: 27.1.2009 Time: 19:54:0 Date: 27.1.2009 Time: 19:54:1 Date: 27.1.2009 Time: 19:54:2 Date: 27.1.2009 Time: 19:54:3 Date: 27.1.2009 Time: 19:54:0 Date: 27.1.2009 Time: 19:54:1 Date: 27.1.2009 Time: 19:54:2 Date: 27.1.2009 Time: 19:54:3 Date: 27.1.2009 I'll try to find the bug myself, but any ideas what might cause this? Thanks! - jan Hi Mathias,

thanks for your DCF-77 code! I’ve got a question: I’ve been running version 0.2.1 for about a day on a Diecimila board, and found that it loses about half an hour over a day. Every now and then, it seems to miss a few seconds, and then goes back to the start of the same minute. Here’s an example from the serial log with two such hiccups:

Time: 19:54:57 Date: 27.1.2009
Time: 19:54:58 Date: 27.1.2009
Time: 19:54:0 Date: 27.1.2009
Time: 19:54:1 Date: 27.1.2009
Time: 19:54:2 Date: 27.1.2009
Time: 19:54:3 Date: 27.1.2009
Time: 19:54:0 Date: 27.1.2009
Time: 19:54:1 Date: 27.1.2009
Time: 19:54:2 Date: 27.1.2009
Time: 19:54:3 Date: 27.1.2009

I’ll try to find the bug myself, but any ideas what might cause this?

Thanks!

- jan

]]>
By: md http://gonium.net/md/2007/04/18/tweaking-the-code/comment-page-1/#comment-2028 md Mon, 28 Jan 2008 10:57:28 +0000 http://gonium.net/md/2007/04/18/tweaking-the-code/#comment-2028 Hi Jul, aparently, you don't have the ATMEGA168 flag defined, so the Compiler tries to compile the definitions for the ATMega8 (and the initialization registers have slightly different names...) Try adding the line #define ATMEGA168 to your code. -Mathias Hi Jul,

aparently, you don’t have the ATMEGA168 flag defined, so the Compiler tries to compile the definitions for the ATMega8 (and the initialization registers have slightly different names…)

Try adding the line
#define ATMEGA168
to your code.

-Mathias

]]>
By: julian http://gonium.net/md/2007/04/18/tweaking-the-code/comment-page-1/#comment-2027 julian Mon, 28 Jan 2008 09:57:24 +0000 http://gonium.net/md/2007/04/18/tweaking-the-code/#comment-2027 Hallo Mathias, sorry my fault. My error is: In function 'void DCF77Init()': error: 'TCCR2' was not declared in this scope I have an arduiono diecimile an the atmega168. Jul Hallo Mathias,

sorry my fault. My error is:

In function ‘void DCF77Init()’:
error: ‘TCCR2′ was not declared in this scope

I have an arduiono diecimile an the atmega168.

Jul

]]>
By: md http://gonium.net/md/2007/04/18/tweaking-the-code/comment-page-1/#comment-2025 md Mon, 28 Jan 2008 09:21:33 +0000 http://gonium.net/md/2007/04/18/tweaking-the-code/#comment-2025 Hi Jul, are you sure we're talking about my code above (v0.2.1)? There is no DCF77.cpp in this archive, and the serialDumpTime function starts at line 225. Nevertheless, there is no HardwareSerial.print(..) in Arduino, but a Serial.print(...), AFAIK. Sorry, but try to use this sketch unmodified first. I don't have an Arduino 10 environment here, but since the interfaces weren't changed, the code *should* work. HTH, -Mathias Hi Jul,

are you sure we’re talking about my code above (v0.2.1)? There is no DCF77.cpp in this archive, and the serialDumpTime function starts at line 225. Nevertheless, there is no HardwareSerial.print(..) in Arduino, but a Serial.print(…), AFAIK.

Sorry, but try to use this sketch unmodified first. I don’t have an Arduino 10 environment here, but since the interfaces weren’t changed, the code *should* work.

HTH,
-Mathias

]]>