Pages: [1]   Go Down
Author Topic: RTC without hardware  (Read 739 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello, I'm new to arduino. I would like date and time stamp into the serial output.how can this be done without any extra hardware. if not possible, please do recommend me any rtc that i can use to do this.
Logged

Central MN, USA
Online Online
Tesla Member
***
Karma: 74
Posts: 7256
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello, I'm new to arduino. I would like date and time stamp into the serial output.how can this be done without any extra hardware. if not possible, please do recommend me any rtc that i can use to do this.

DS1307

Arduino has no integrated RTC.
Logged


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

Quote
DS1307

Arduino has no integrated RTC.

I have purchased the DS1307 from sgbotics.
http://www.sgbotic.com/index.php?dispatch=products.view&product_id=366
can i know how must i write the code in order to print the date and time? is there any sample code available?
« Last Edit: December 19, 2012, 12:13:13 am by Jeremytan » Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 545
Posts: 27357
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

There is sample code in the Playground:
http://playground.arduino.cc/Main/InterfacingWithHardware%23Communication
Use "Edit: Find on this Page" to find DS1307 in the Time section.
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
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
how can this be done without any extra hardware.

It can be easily done with a timer counting cpu pulses. No need for extra hardware. And you can program in error correction (to compensate for crystal's tempco), making it potentially far more accurate than non-tempco corrected rtc.
Logged

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 95
Posts: 4092
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The Time library is a software RTC. Additionally, it can be interfaced to a hardware RTC, but this is not required. As noted, without additional hardware, accuracy is dependent on the system clock.

A feature of the ATmega328 et al is a "Real Time Counter with Separate Oscillator", which does require an external 32.768kHz crystal. Using this feature, an RTC can be implemented that continues to run while the rest of the chip sleeps. See the datasheet, sections 9.5, 18.10.
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

UK
Offline Offline
Shannon Member
****
Karma: 223
Posts: 12630
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello, I'm new to arduino. I would like date and time stamp into the serial output.how can this be done without any extra hardware. if not possible, please do recommend me any rtc that i can use to do this.

I assume that the serial output is going to a PC of some sort and that the output will consist of ascii text.

The Arduino can measure elapsed time but without an RTC or a network interface it has no way of knowing what date/time it is starting from. You could use the serial link to send it the initial date/time, but you'd need to do that every time the Arduino was restarted and to me that does not seem feasible. It is far more sensible to prefix the output with a timestamp on the PC side. What operating system is the PC running, and what are you trying to do with the serial data once it reaches the PC?
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Pages: [1]   Go Up
Jump to: