Go Down

Topic: does the Arduino Duemilanove w/ ATMEGA328 have and RTC onboard? (Read 4054 times) previous topic - next topic

fou2

Hello.

I've been looking for this RTC component for a while so to make an alarm but I cannot find it onboard. All forums i've seen use a DS1377 chip to get the time and date. Is there an onboard RTC and where can I get more information about how to program it?

Thanks!

AWOL

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

bperrybap

But you can use the time library to keep track of time.
You will need a way to set the time in the library but then the library will
track it from there.
http://www.arduino.cc/playground/Code/Time

--- bill


johnwasser

Timer/Counter2 is designed to allow for an external crystal (they mention a 32 kHz watch crystal).  Unfortunately the pins used for TOSC1 and TOSC2 are the same pins used for XTAL1 and XTAL2: the 16 MHz crystal for the system clock.  If you switch to using the 8 MHz internal RC clock for the system clock you can put a high-precision crystal of 2 MHz or slower (less than 1/4 the system clock rate) on TOSC1 and TOSC2 to get a high-precision real-time clock.

You could also use a high-precison 16 MHz crystal for the system clock and just use the existing millis() etc.

In both cases you will have to provide continuous power to maintain the time.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

jluciani

There is on my http://wiblocks.luciani.org/PICO/PICOBEE-index.html  :)
And an XBEE too  :)

I have a RTC library and some example code for the DS1337 on my site.

(* jcl *)
www: http://www.wiblocks.com
twitter: http://twitter.com/wiblocks

liudr

You can add a DS1307 RTC to your arduino. BTW, I have a shield with LCD and RTC etc. Here is my alarm clock project:

http://liudr.wordpress.com/?s=alarm

http://liudr.wordpress.com/shields/phi-2-shield/

You're welcome to take the code.

justjed


You can add a DS1307 RTC to your arduino.


Or a ChronoDot, or a DS3234 (on a breakout board, if you want something simple), or one of a number of RTCs. Or get it from a GPS shield, or from WWV. Lots of ways to skin that cat.
... it is poor civic hygiene to install technologies that could someday
facilitate a police state. -- Bruce Schneier

liudr

GPS works well outside but inside of a building you will have trouble getting a lock. I'm not sure if the clock will be any good from gps.

CrossRoads

My board has an RTC & SD socket as well
www.crossroadsfencing.com/BobuinoRev17
and some sample sketches to read/write the DS137 registers
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

jacksons

Looking at the datasheet, the ATMEGA168 has an internal 32khz RTC, but I think it needs constant power and I'm not sure how to enable it using Arduino code

AWOL

Quote
Looking at the datasheet, the ATMEGA168 has
the ability to configure Counter/timer 2 as a real-time counter.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

mrburnette

@fou2:

The RTC is just a piece of the overall system needed to have a time on a project.  Most of the board manufacturers for RTC reference a sketch that you must load and run to set the clock which is generally backed-up by a lithium battery.  Then you must reflash the Arduino to use your code and read the time from the RTC.  But what if you need to reset the clock? 

Another way to think of a solution is to think about if a RTC will ever need resetting.  Likely.  How... run a sketch?  What about using a TV controller (one of the universal kinds.)  With IR you can then decode the key inputs into numeric entries.  Now, all an Arduino project needs to do is have a little code routine to set the RTC when IR is being received.  A sample sketch is here:
http://forum.arduino.cc/index.php?topic=139907

It is not the only solution, but it is a simple solution and will also get you thinking about doing other off-loading of dedicated processing such as IR or SD data logging.  The uC are inexpensive when attached directly with a sensor and the interfacing is easy.  Plus, once a design is finalized for a sensor, you can reuse that design for other projects.  The IR project is very useful whenever an Arduino needs a numeric input value... not just HH:MM:SS


Ray

johnwasser

If your Arduino is near a window another choice is to use a GPS module to get the time. It's very accurate and never needs setting.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

oric_dan


Looking at the datasheet, the ATMEGA168 has an internal 32khz RTC, but I think it needs constant power and I'm not sure how to enable it using Arduino code

If you check the d/s, you'll see the timing on those internal oscillators tend to not be very accurate.

johnwasser



Looking at the datasheet, the ATMEGA168 has an internal 32khz RTC, but I think it needs constant power and I'm not sure how to enable it using Arduino code

If you check the d/s, you'll see the timing on those internal oscillators tend to not be very accurate.

As I said a year ago (see reply 3) the 32 kHz clock feature requires an external 32 kHz crystal (in place of the 16 MHz resonator).  The 'clock' will be as accurate as the crystal.  You are thinking of the various RC (resistor capacitor) clocks.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Go Up