Pages: [1] 2   Go Down
Author Topic: does the Arduino Duemilanove w/ ATMEGA328 have and RTC onboard?  (Read 3644 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 291
Posts: 25874
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There is no on-board RTC on a 2009.
Logged

"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.

Dallas, TX USA
Offline Offline
Faraday Member
**
Karma: 63
Posts: 2649
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 202
Posts: 8716
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Boston, MA
Offline Offline
Edison Member
*
Karma: 0
Posts: 1024
wiblocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

(* jcl *)
Logged


Central MN, USA
Offline Offline
Tesla Member
***
Karma: 72
Posts: 7175
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged


CO, USA
Offline Offline
God Member
*****
Karma: 5
Posts: 711
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

... it is poor civic hygiene to install technologies that could someday
facilitate a police state. -- Bruce Schneier

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 72
Posts: 7175
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged


Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 525
Posts: 26538
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

My board has an RTC & SD socket as well
www.crossroadsfencing.com/BobuinoRev17
and some sample sketches to read/write the DS137 registers
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Newbie
*
Karma: 0
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 291
Posts: 25874
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Looking at the datasheet, the ATMEGA168 has
the ability to configure Counter/timer 2 as a real-time counter.
Logged

"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.

Atlanta, USA
Offline Offline
Edison Member
*
Karma: 53
Posts: 1777
AKA: Ray Burne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@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
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 202
Posts: 8716
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

the land of sun+snow
Offline Offline
Faraday Member
**
Karma: 159
Posts: 2895
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 202
Posts: 8716
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Pages: [1] 2   Go Up
Jump to: