Real Time Clock (RTC) With LinkIt ONE

by gulliverrr in Circuits > Arduino

2859 Views, 8 Favorites, 0 Comments

Real Time Clock (RTC) With LinkIt ONE

56779a834fbadefc6a0007aa.jpeg

Ever stuck with a project that needs a real time clock (a clock that tells you the date & time and not just how many (milli)seconds passed since you connected it to power)?

You have 2 options:

  1. Use GPS and get the time off there
  2. Internet (NTP)
  3. Use RTC

but what if your project is your beer brewing logger and it located down in the basement with no access to sky view for GPS and without Internet access not to mention the additional costs these may add to your budget?

You will need RTC my friend!

DS3231

DS3231.jpg

DS3231 is the little guy powered by a tiny (but huge) battery that will outlast your project. Once set with current local time it will tick-tack away and keep it precise on time. There are other chips out there doing similar (or identical) work. Check code compatibility first...

DS3231 is only 1GBP/USD/EUR from your local auction website ;)

Load the Code

Connect your LinkIt and load the attached code to save yourself time.

As you can see in setup section:

rtc.begin(DateTime(F(__DATE__), F(__TIME__)));

this line sets the current date and time at compilation time from your computer - make sure you have the time set correctly. You only need to do this once.

You are now ready to wire things up.

Downloads

Wiring

IMG_20151221_083747795 (1).jpg
IMG_20151221_083808993 (1).jpg

Wiring is pretty simple. Typical I²C (SDA/SCL) wires are needed.

So connect as below:

DS3231's Vcc to LinkIt 3.3V

DS3231's GND to LinkIt GND

DS3231's SDA to LinkIt SDA

DS3231's SCL to LinkIt SCL

Check the photo to confirm

Add Power!

IMG_20151221_083845845 (1).jpg
serial_out.jpg

Add battery or USB and fire away your serial monitor!

You can test if everything went well by checking the time printed on the serial monitor.

You are now ready to use the date and time in your project!