[Arduino #20] JeeLabs RTC DS1340 tutorial for dummies

It may be inappropriate that I write a tutorial for dummies when I myself am also a dummy. Anyway I decided so because there isn’t really any tutorial out there. This tutorial was born thanks to my TA Sakari. Yes, Sakari rocked today!!!

What you need: RTC module, Arduino, four jumpers.

rtc-plug_largeWe are going to use this library from NorthernWidget. Yes the model number is different from the one we are using but it worked for me(or for Sakari). Place it in the right place:

Screen Shot 2014-10-16 at 2.56.45 PM

By putting in the library folder you can use it as the library and also the examples.

Screen Shot 2014-10-16 at 2.58.46 PM

Naturally what you would do first is setting the time. So open DS3231_set. You will see:

Screen Shot 2014-10-16 at 3.01.08 PM

For instance if it’s 2014.Oct.16th Thursday 3 p.m. 3 min 0 second now. You will enter 1410164150300x in the serial monitor. x in the end is to ensure that your given input is a valid input. Small “w” is a day of week, Mon, Tue, Wed, …. Monday is 1, Tuesday is 2 and so on. If you did correctly and everything goes right, then Serial monitor print your input. Remember to set the correct baud rate!!!

Actually the coding part is relatively easier than wiring it because there is no straightforward manual for it.

rtc-plug_large

So back to the module. What the heck are the pins about?

rp1._0000021f

How to connect? Voila!

Screen Shot 2014-10-16 at 3.12.48 PMSo you connect (D – A4), (G – GND), (+ – 3.3v), (A – A5)    || (RTC, Arduino)

SDA(data line) and SCL(clock line) pins are noted here because we use Wire library. Noticed #include <Wire.h>? For more info check the official site.

Screen Shot 2014-10-16 at 3.18.17 PM

If you’ve done wiring and setting then you can check how it works. Open the example “now”, upload it and open serial monitor. Remember that baud rate for now.pde and set.pde is different. When you have set the correct baud rate you will see a good result 🙂 Hope this helped some of you. If you’ve got any question, leave a comment 😉

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: