Arduino Library for Chronodot
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Arduino Library for Chronodot

by stephanie on Sun Apr 10, 2011 11:26 am

I know the Chronodot can be used as-is with the DS1307 library but the chronodot can also provide temperature data via the i2c in addition to the time, and I wanted to access the temperature data in a sketch I was working on.

So I modified the DS1307 library to add temperature output (in both degrees F and degrees C).

I packaged it back up into its own little Chronodot library and included an example that returns the temperature along with the time.

Hopefully it'll be of use to someone else. Just unzip it and drop it in your arduino/libraries folder.


Example sketch:
Code: Select all | TOGGLE FULL SIZE
// Date, time and temperature functions using
// a Chronodot RTC connected via I2C and Wire lib

#include <Wire.h>
#include "Chronodot.h"

Chronodot RTC;

void setup () {
    Serial.println("Initializing Chronodot.");

  if (! RTC.isrunning()) {
    Serial.println("RTC is NOT running!");
    // following line sets the RTC to the date & time this sketch was compiled
    RTC.adjust(DateTime(__DATE__, __TIME__));

void loop () {
    DateTime now =;
    Serial.print(now.year(), DEC);
    Serial.print(now.month(), DEC);
    Serial.print(, DEC);
    Serial.print(' ');
    Serial.print(now.hour(), DEC);
    Serial.print(now.minute(), DEC);
    Serial.print(now.second(), DEC);

    Serial.print(now.tempC(), DEC);
    Serial.println(" degrees Celcius");
    Serial.print(now.tempF(), DEC);
    Serial.println(" degrees Farenheit");
User avatar
Posts: 295
Joined: Sat Dec 11, 2010 1:17 am
Location: Canada

Re: Arduino Library for Chronodot

by adafruit_support_bill on Mon Apr 11, 2011 6:05 am

Thanks, Stephanie! I'm sure many will find this useful. :D

Posts: 49348
Joined: Sat Feb 07, 2009 10:11 am

Please be positive and constructive with your questions and comments.