Saturday, March 14, 2015

IC Station DS1307 Real Time Clock

In this tutorial, we will be using the IC Station DS1307 Real Time Clock Module. This will allow you to not only build a clock display, but add date and time stamping functions to your projects, so you know when a particular value was recorded by a sensor.


Use checkout code "steveics", and get a 15% discount on the sensors!

Code: steveics Discount Amount: 15% Max Use: 1 No Min Order Started Date: 16th Mar, 2015 Ended Date: 16th May, 2015

This module does not include a battery, or the pin headers. You will need to order those:

LI2032 (rechargeable, non-rechargeable CR2032 will also work)
Right Angle Breakaway Headers (you can never have too many)

Solder the header to the module. I used the 5 hole side of the module. Only 4 pins are used. VCC to Arduino +5, GND to Arduino GND, SCL to Arduino SCL (A5), and SDA to Arduino SDA (A4).

You will need to download a library to use this module. I prefer the Adafruit library:

RTClib

Download and install into your IDE using the Sketch, Import Library, Add Library function.

Now load the File, Examples, RTClib-master, DS1307 example sketch.

Because we are using the Arduino Micro, we need to add the Serial delay in setup:

Serial.begin(9600);
   while (!Serial) ; //needed for Leonardo and Micro

Now you can upload to the Arduino. The time and date will be set from your computer during the compile and upload process.

When you run the Serial Monitor, you should see something similar to this:



We will show you how to use this for data logging and LCD display in a upcoming blog post.

No comments:

Post a Comment