Hackster is hosting Hackster Cafe: Open Hardware Summit. Watch the stream live on Friday!Hackster is hosting Hackster Cafe: Open Hardware Summit. Stream on Friday!
sarveshsupe
Published © Apache-2.0

Digital clock USING ARDUINO UNO

It is a simple digital clock made using ds1302 clock module and a LCD screen.

BeginnerFull instructions provided8,501
Digital clock USING ARDUINO UNO

Things used in this project

Hardware components

Jumper wires (generic)
Jumper wires (generic)
×1
Female/Female Jumper Wires
Female/Female Jumper Wires
×1
Rotary potentiometer (generic)
Rotary potentiometer (generic)
×1
Real Time Clock (RTC)
Real Time Clock (RTC)
×1
LCD SCREEN
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Code

CODE

Arduino
This is the code
// DS1302:  RST pin    -> Arduino Digital 2
//          DATA pin   -> Arduino Digital 3
//          CLK pin  -> Arduino Digital 4
 
#include <DS1302.h>
#include <LiquidCrystal.h> 

#define RST_pin 2 //  -> Arduino Digital 2
#define DATA_pin 3 //  -> Arduino Digital 3
#define CLK_pin  4 //-> Arduino Digital 4
DS1302 rtc(RST_pin, DATA_pin, CLK_pin);


#define VSS_PIN // –> GND Arduino
#define VDP_PIN // –> 5V Arduino
#define VO_PIN // –> output potentiometer (potentiometer VCC -> 5V Arduino, potentiometer GND -> Arduino GND).
#define RS_PIN 12 // –> pin 12 Arduino
#define RW_PIN  // –> GND Arduino
#define E_PIN 11 // –> pin 11 Arduino
#define D4_PIN 5 // –> pin 5 Arduino 
#define D5_PIN 6 // –> pin 6 Arduino
#define D6_PIN 7 // –> pin 7 Arduino
#define D7_PIN 8 // –> pin 8 Arduino
#define A_PIN // –> 5V Arduino with 1.2 k resistor
#define K_PIN // –> GND Arduino 




LiquidCrystal lcd(RS_PIN, E_PIN,D4_PIN,D5_PIN ,D6_PIN , D7_PIN  ); 


  

void setup()
{

rtc.halt(false);
  rtc.writeProtect(false);
  rtc.setDOW(WEDNESDAY);       
  rtc.setTime(3, 41,
  
  
  00      );           
  rtc.setDate(17, 9, 2020);    
  rtc.writeProtect(true); 
    
    Serial.begin(9600) ;
 }

void loop()
{
  Serial.println(rtc.getDateStr(FORMAT_LONG,FORMAT_LITTLEENDIAN, '/'));
  Serial.println(rtc.getDOWStr());
  Serial.println(rtc.getTimeStr());
 lcd.begin(16,2); 
  lcd.clear();
    lcd.print(rtc.getTimeStr());
     lcd.setCursor(0,1);  
  lcd.print(rtc.getDateStr(FORMAT_LONG,FORMAT_LITTLEENDIAN, '/')); 

   delay (5000);

   lcd.begin(16,2); 
  lcd.clear();
    lcd.print("CLOCK");
     lcd.setCursor(0,1);  

  delay (3000);
}                                                                            

Credits

sarveshsupe
1 project • 1 follower
Contact

Comments

Please log in or sign up to comment.