Introduction: Simple Arduino Watch

About: An Electronics engineer and a hobbyist. I love to keep experimenting with microcontrollers.

Hello guys and welcome to a new instructable. Today we will make a simple arduino watch using DS3231 and Nokia 5110 Lcd. This watch will of-course show you time but also it will also show date and temperature.

Most of the tutorials online don't show how to use a lcd other than the 16*2 lcd with the RTC module. So I decided to make one tutorial with the 5110 Lcd.

Let's move further to see how to make this watch.

Step 1: Things You Need

I recommend UTSource.net if you are looking to buy electronics components and modules. They provide all electronics items at affordable rates. They also provide PCB design services for PCB's up to 16 layers. Do check them out.

So the hardware we need is as follows -

1. Arduino Uno Board

2. Breadboard

3. DS3231 Module (RTC Module)

4. Nokia 5110 Lcd

5. Header wires

Libraries you need to install for this project to work -

1. Rtc by Makuna

2. DS3231 by Eric Ayars

You can install them directly using your Arduino Ide. If you are unable to find them, just drop a comment below.

Note : Without these libraries the code won't compile and you will get errors.

Step 2: Circuit Diagram

I have attached a circuit diagram of the project above.

Make sure you connect all the modules as shown above.

If you want to see my other project where I created a Egg catching game using the nokia lcd and joystick module

Click Here

If you want to make this project portable then just add a lipo battery and a charging circuit and you are good to go. I am not yet satisfied with this, so I will wait for some time.

Step 3: Code

The code for this project is given below.

I have also included a .ino file which you can directly open in your Arduino Ide.

#include <SPI.h> 
#include <Wire.h> #include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>
#include <RtcDS3231.h>
#include <DS3231.h>
DS3231 Clock; RtcDS3231 Rtc(Wire); Adafruit_PCD8544 display = Adafruit_PCD8544(13, 11, 5, 4, 3); void setup() { Serial.begin(9600); Serial.print(__DATE__); Serial.println(__TIME__); Rtc.Begin(); RtcDateTime compiled = RtcDateTime(__DATE__, __TIME__); Serial.println(); if (!Rtc.IsDateTimeValid()) { if (Rtc.LastError() != 0) { Serial.print("RTC communications error = "); Serial.println(Rtc.LastError()); } else { Serial.println("RTC lost confidence in the DateTime!"); Rtc.SetDateTime(compiled); } } if (!Rtc.GetIsRunning()) { Serial.println("RTC was not actively running, starting now"); Rtc.SetIsRunning(true); } RtcDateTime now = Rtc.GetDateTime(); if (now < compiled) { Serial.println("RTC is older than compile time! (Updating DateTime)"); Rtc.SetDateTime(compiled); } else if (now > compiled) { Serial.println("RTC is newer than compile time. (this is expected)"); } else if (now == compiled) { Serial.println("RTC is the same as compile time! (not expected but all is fine)"); } Rtc.Enable32kHzPin(false); Rtc.SetSquareWavePin(DS3231SquareWavePin_ModeNone); display.begin(); display.clearDisplay(); display.setContrast(60); display.setCursor(7,3); display.setTextSize(1); display.println("ENGINEER KID"); display.setCursor(35,15); display.println("DIY"); display.setCursor(23,25); display.println("ARDUINO"); display.setCursor(29,35); display.println("CLOCK"); display.display(); delay(1000); display.clearDisplay(); } void loop() { if (!Rtc.IsDateTimeValid()) { if (Rtc.LastError() != 0) { Serial.print("RTC communications error = "); Serial.println(Rtc.LastError()); } else { Serial.println("RTC lost confidence in the DateTime!"); } } RtcDateTime now = Rtc.GetDateTime(); printDateTime(now); } #define countof(a) (sizeof(a) / sizeof(a[0])) void printDateTime(const RtcDateTime& dt) { char datestring[20]; snprintf_P(datestring, countof(datestring),PSTR("%02u/%02u/%04u %02u:%02u:%02u"), dt.Month(), dt.Day(), dt.Year(), dt.Hour(), dt.Minute(), dt.Second() ); Serial.print(datestring); display.setTextSize(2); display.setCursor(0,0); display.println("ARDUINO"); display.setTextSize(1); display.setCursor(0,20); display.println("Date:"); display.setCursor(30,20); display.println(dt.Day()); display.setCursor(40,20); display.println("."); display.setCursor(44,20); display.println( dt.Month()); display.setCursor(54,20); display.println("."); display.setCursor(59,20); display.println( dt.Year()); display.setCursor(0,30); display.println("Time:"); display.setCursor(30,30); display.println(dt.Hour()); display.setCursor(41,30); display.println(":"); display.setCursor(46,30); display.println(dt.Minute()); display.setCursor(57,30); display.println(":"); display.setCursor(62,30); display.println(dt.Second()); display.setCursor(0,40); display.println("TEMP:"); display.setCursor(30,40); display.println(Clock.getTemperature(), 2); display.setCursor(62,40); display.println("C"); display.display(); delay(5); display.clearDisplay(); }

You do not need to set the date and time for the first time in order to configure the RTC module. The module will just store the compile time as your present time so no need to upload a separate code or comment any lines in the code.

Attachments

Step 4: Working Video of the Project

Like always I have attached a working video of this project below. Watch it to get an idea how this project works.

If you like my work then please share this instructable with your friends.

Also follow me to keep a track on the projects I make.

That's it for today. See you guys soon with another project.