![]() ![]() PinMode (minAdjustPin, INPUT_PULLUP) // Minutes adjust switch PinMode (calPin, INPUT_PULLUP) // cal switch connected to pin 7. Int rxTX_ID = 1 //rx indicates remotely received data Number of clock "ticks" in a minutes worth of seconds. Unsigned long smoothSeconds // Used in Ssmooth mode. Unsigned long totalSecondsMinute // Used in smooth mode, current seconds in a minute Unsigned long totalSecondsHour // Used in smooth mode, humber of current seconds in the hour Int displayHours // Actual hours displayed, this is to take care of the 24h mode. Int smoothSelectPin = 15 // Smooth mode select switch connects to A1 Int twentyFourHourPin = 14 // 24 hour mode selct switch connects to A0 Int minAdjustPin = 8 // Minutes adjust button to pin 8. Int calPin = 7 // Calibration push button connects here and ground Int minutesAnaloguePin = 5 // As above for minutes. Int secondsAnaloguePin = 3 // Output pin for the Seconds driver circuit and meter Int masterClock = 0 // Counts rising edge clock signals Int clockInt = 0 // Digital pin 2 is now interrupt 0 Has remote 433 MHz receiver for reception of remote time sync signal from master clock projectįor more information and the circuit diagram. ![]() PWM referenced clock, driving 3 analogue moving coil meters, set up to read hours, minutes and seconds. License: The MIT License (See full license at the bottom of this file) So after a bit of tinkering this was born. So, to correct for this drift, I'll add in a 433MHz radio receiver module, and make it updatable from the GPS Master Clock project. It should keep reasonable time.Īfter running for a day or so, the drift (caused by the 0.36 Hz left over) does become noticeable, but I recon it's no worse than a DS1307 RTC. (Due's/ Mega's etc will vary as the micro/clock frequency is different).Įxcellent, so all we need to do is add a second on every time our counter hits 490 (Let's forget about the 0.36, shall we?). I measured the frequency of the PWM signal, and on a crystal clocked board, with a ATMEGA328P at 16MHz, it's 490.36Hz. So all we need to do is set up an interrupt, so that every time it sees a rising edge of our PWM signal, it increments a counter. So dividing down this 16MHz should give quite a low error. The clock frequency on "posh" arduino boards is generated by a nice crystal (on not-so-posh boards, it may be a ceramic resonator, not so accurate). The PWM frequency is governed by the internal architecture of the ATMEGA328, and is derived by some programmable timers, which divide down the clock frequency of the micro. ![]() We set the PWM output going with a mark to space ratio of 50%. We couple the PWM output of a pin to an interrupt. I must say, whilst the idea is sound, most of the stuff I got hold of and downloaded didn't work for one reason or another. Now, I'd seen several clock designs on the net, whereby the Arduino's PWM signal is used to keep accurate time. There are lots of designs on the net, so here's another. I conceived this daft project a while back, after being given a box of surplus moving coil meters.Īn Arduino driving three analogue meter movements to show hours, minutes and seconds. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |