Introduction: Getting Started With Arduino Yún and ChronoDot (v2)

A quick guide to getting started with the ChronoDot (v2) and Arduino Yún.

Step 1: Insert Battery

The battery is a 3V lithium CR1632 coin cell, one is provided with every ChronoDot purchase. You should install the battery before use, to prevent loss of timekeeping during power off cycles. Simply remove the CR1632 battery from its packaging, and slide into the battery holder. Please ensure the top (marked +) side of the battery is facing the top of the battery holder (also marked +).

Quote from

Step 2: Connect to Arduino Yún

Connect the ChronoDot's pins to the Arduino Yún as follows:

[white] GND to GND (Ground) of the Yún.
[yellow] VCC to 3.3V or 5V (the ChronoDot takes both)
[brown] SCL to SCL
[orange] SDA to SDA

(SDA and SCL should not be connected to A4 or A5 as with Arduino Uno!)

Step 3: Add Some Code

Import the following library by going to: Sketch - Import Library (then choose the .zip file) in the Arduino software.
(Download .zip)

When unzipping the file make sure to remove the "-master" because the Arduino Software doesn't take it. Rename the folder to RTClib and choose it then.

Add the following code to your project (credit to IAquaponics):

I also added the .ino file as an attachment for your convenience.

// Date and time functions using a DS3231 RTC connected via I2C and Wire Lib

#include <Wire.h> #include "RTClib.h" // Credit: Adafruit


void setup() { // Begin the Serial connection Serial.begin(9600); // Instantiate the RTC Wire.begin(); RTC.begin(); // Check if the RTC is running. if (! RTC.isrunning()) { Serial.println("RTC is NOT running"); }

// This is optional: Force timeset. delay(5000); Serial.println("Forcing TIMESET"); RTC.adjust(DateTime(2000, 1, 21, 3, 0, 0));

// This section grabs the current datetime and compares it to // the compilation time. If necessary, the RTC is updated. DateTime now =; DateTime compiled = DateTime(__DATE__, __TIME__); if (now.unixtime() < compiled.unixtime()) { Serial.println("RTC is older than compile time! Updating"); RTC.adjust(DateTime(__DATE__, __TIME__)); } Serial.println("Setup complete."); }

void loop() { // Get the current time DateTime now =; // Display the current time Serial.print("Current time: "); Serial.print(now.year(), DEC); Serial.print('/'); Serial.print(now.month(), DEC); Serial.print('/'); Serial.print(, DEC); Serial.print(' '); Serial.print(now.hour(), DEC); Serial.print(':'); Serial.print(now.minute(), DEC); Serial.print(':'); Serial.print(now.second(), DEC); Serial.println(); delay(1000); }

Press upload and open the serial monitor - you should see the current time.


awilson75 made it! (author)2014-08-31

I thought the yun would just fetch the current time from the internet, making a rtc unnecessary?

sourcez made it! (author)sourcez2014-08-31

Correct, until the Yún looses internet connectivity for a longer amount of time - or of course if you are setting up your Yún where there is no Wi-Fi/Internet.... then what?? An RTC can keep an accuracy of about 1 minute in a year so its a good plan B - hope that helps.

PS: Maybe someone knows more about how the Yún handles the time updates, but I think if you don't have a connection once - there will be no Time available,.. also not from the last execution if disconnected from power in the meantime.

Danger is my middle name made it! (author)2014-07-03

great photos, thanks for posting this tutorial!

macetech made it! (author)2014-07-01

Thanks for the clear tutorial and sharp photos, looks good! I pointed out a small error in an earlier comment and deleted it when sourcez updated this Instructable.

sourcez made it! (author)2014-07-01

Thank you macegr. I have updated the code.