Arduino LED (RTC) Clock with Seconds and AM/PM indicator , 12/24 hr changing switch
First You have to download following libraries (link is given end of this page)
1. Wire.h
2. RTClib.h
Parts List
Watch the video
This is the RTC clock Module
This is the Arduino Circuit
RTC Wiring Connections
RTC Switches
Circuit Diagram (COMMON ANODE)
IF YOU USE COMMON CATHODE LED DO THE CHANGES AS FOLLOWS
POWER SUPPLY
24/12 clock LED Indicator
Download Code File
Download Library Files
This is the code
AliExpress.com Product - 100Pcs F3 F5 super bright 3mm 5mm Round water transparent green / yellow / Blue / White / red LED Kit
/*
4 digit 7 segment display: http://www.sparkfun.com/products/9483
Datasheet: http://www.sparkfun.com/datasheets/Components/LED/7-Segment/YSD-439AR6B-35.pdf
*/
// modified connexion by niq_ro from http://nicuflorica.blogspot.com
// dataseet: http://www.tme.eu/ro/Document/dfc2efde2e22005fd28615e298ea2655/KW4-563XSA.pdf
// Code modified by BMIAK Basnayaka
// http://www.setnfix.com
int digit1 = 11;
int digit2 = 10;
int digit3 = 9;
int digit4 = 6;
int digit5 = 5;
int digit6 = 3;
//Pin mapping from Arduino to the ATmega DIP28 if you need it
//http://www.arduino.cc/en/Hacking/PinMapping
int segA = 0; //Display pin 11
int segB = 1; //Display pin 7
int segC = 2; //Display pin 4
int segD = 4; //Display pin 2
int segE = 7; //Display pin 1
int segF = 8; //Display pin 10
int segG = 12; //Display pin 5
int segDP =13; // Display pin 3
#include <Wire.h>
#include "RTClib.h"
RTC_DS1307 RTC;
// Date and time functions using a DS1307 RTC connected via I2C and Wire lib
// original sketck from http://learn.adafruit.com/ds1307-real-time-clock-breakout-board-kit/
// add part with SQW=1Hz from http://tronixstuff.wordpress.com/2010/10/20/tutorial-arduino-and-the-i2c-bus/
// add part with manual adjust http://www.bristolwatch.com/arduino/arduino_ds1307.htm
byte SW0 = A0;
byte SW1 = A2;
byte SW2 = A1;
byte SWT = A3;
int Adhr=0;
int Admnt=0;
int D = 0;
int Z =0;
// use for hexa in zecimal conversion
long zh, uh, ore;
long zm, um, miniti;
void setup() {
//Serial.begin(57600);
Wire.begin();
RTC.begin();
// RTC.adjust(DateTime(F(__DATE__), F(__TIME__)));
// if you need set clock... just remove // from line above this
// part code for flashing LED
Wire.beginTransmission(0x68);
Wire.write(0x07); // move pointer to SQW address
// Wire.write(0x00); // turns the SQW pin off
Wire.write(0x10); // sends 0x10 (hex) 00010000 (binary) to control register - turns on square wave at 1Hz
// Wire.write(0x13); // sends 0x13 (hex) 00010011 (binary) 32kHz
Wire.endTransmission();
pinMode(segA, OUTPUT);
pinMode(segB, OUTPUT);
pinMode(segC, OUTPUT);
pinMode(segD, OUTPUT);
pinMode(segE, OUTPUT);
pinMode(segF, OUTPUT);
pinMode(segG, OUTPUT);
pinMode(segDP, OUTPUT);
pinMode(digit1, OUTPUT);
pinMode(digit2, OUTPUT);
pinMode(digit3, OUTPUT);
pinMode(digit4, OUTPUT);
pinMode(digit5, OUTPUT);
pinMode(digit6, OUTPUT);
//Serial.begin(9600);
pinMode(SW0, INPUT); // N.O. push button switch
pinMode(SW1, INPUT); // N.O. push button switch
pinMode(SW2, INPUT); // N.O. push button switch
pinMode(SWT, INPUT); // N.O. push button switch
digitalWrite(SW0, HIGH); // pull-ups on
digitalWrite(SW1, HIGH);
digitalWrite(SW2, HIGH);
digitalWrite(segDP, LOW);
}
void loop() {
DateTime now = RTC.now();
long HR = now.hour()*1000;
long timp = (HR*10)+now.minute()*100+now.second();
Adhr = now.hour();
Admnt=now.minute();
int DIM = 0;
if (timp >=250000)
timp=timp-240000;
//------------------------------------------------------
//12/24 hours shitching
//------------------------------------------------------
if (timp < 130000){
digitalWrite(segDP, LOW);}
if (digitalRead(SWT)==0){delay(300);
if (D == 0) {
D =1;delay(200);}
else{
D =0;}
}
if (D == 0){
if (timp>=130000){
timp=timp-120000;
digitalWrite(segDP, HIGH);}
}
if (timp>=130000){
digitalWrite(segDP, LOW);
}
if ((D==1)& (timp <130000))
digitalWrite(segDP, LOW);
//------------------------------------------------------
//int timp = (now.minute(), DEC);
// displayNumber(12); // this is number to diplay
for(int i = 100 ; i >0 ; i--) {
if (timp >= 100000) displayNumber01(timp);
else displayNumber02(timp);
}
for(int i = 100 ; i >0 ; i--) {
if (timp >= 100000) displayNumber03(timp);
else displayNumber04(timp);
}
for(int i = 100 ; i >0 ; i--) {
if (timp >= 100000) displayNumber05(timp);
else displayNumber06(timp);
}
if (digitalRead(SW0)==0){delay(100);Z=1; set_time(); }// hold the switch to set time
}
void set_time() {
byte minutes1 = 0;
byte hours1 = 0;
byte minutes = 0;
byte hours = 0;
hours=Adhr;
minutes=Admnt;
if ((hours & 0x0f) > 9) hours = hours + 6;
if (hours > 0x24) hours = 1; // Mid night 12.00 will show as 12:00 (With PM LED on) or 24:00
//if (hours > 0x23) hours = 1; // Mid night 12.00 will show as 0:00
if ((minutes & 0x0f) > 9) minutes = minutes + 6;
if (minutes > 0x59) minutes = 0;
while (!(Z==0)){ // set time switch must be released to exit
int TST = digitalRead(SW2);
while (TST==0) // set hours
{
hours++;
// converting hexa in zecimal:
zh = hours / 16;
uh = hours - 16 * zh ;
ore = 10 * zh + uh;
zm = minutes / 16;
um = minutes - 16 * zm ;
miniti = 10 * zm + um;
if ((hours & 0x0f) > 9) hours = hours + 6;
if (hours > 0x24) hours = 1; // Mid night 12.00 will show as 12:00 (With PM LED on) or 24:00
//if (hours > 0x23) hours = 1; // Mid night 12.00 will show as 0:00
if (hours <= 9)
delay(1);
for(int i = 400 ; i >0 ; i--) {
displayNumber01(ore*10000+miniti*100);
}
TST = digitalRead(SW2);
}
while (!(digitalRead(SW1))) // set minutes
{
minutes++;
// converting hexa in zecimal:
zh = hours / 16;
uh = hours - 16 * zh ;
ore = 10 * zh + uh;
zm = minutes / 16;
um = minutes - 16 * zm ;
miniti = 10 * zm + um;
for(int i = 400 ; i >0 ; i--) {
displayNumber01(ore*10000+miniti*100);
}
if ((minutes & 0x0f) > 9) minutes = minutes + 6;
if (minutes > 0x59) minutes = 0;
if (minutes >= 9)
delay(1);
}
Wire.beginTransmission(0x68); // activate DS1307
Wire.write(0); // where to begin
Wire.write(0x00); //seconds
Wire.write(minutes); //minutes
Wire.write(0x80 | hours); //hours (24hr time)
Wire.write(0x06); // Day 01-07
Wire.write(0x01); // Date 0-31
Wire.write(0x05); // month 0-12
Wire.write(0x09); // Year 00-99
Wire.write(0x10); // Control 0x10 produces a 1 HZ square wave on pin 7.
Wire.endTransmission();
// converting hexa in zecimal:
zh = hours / 16;
uh = hours - 16 * zh ;
ore = 10 * zh + uh;
zm = minutes / 16;
um = minutes - 16 * zm ;
miniti = 10 * zm + um;
for(int i = 400 ; i >0 ; i--) {
displayNumber01(ore*10000+miniti*100);
}
delay(100);
//Serial.print(digitalRead(SW0));
if (digitalRead(SW0)==0) Z = 0;
delay(300);
}
//Serial.print(SW2);
}
void displayNumber01(long toDisplay) {
#define DISPLAY_BRIGHTNESS 25
#define DIGIT_ON HIGH
#define DIGIT_OFF LOW
for(int digit = 6 ; digit > 0 ; digit--) {
//Turn on a digit for a short amount of time
switch(digit) {
case 1:
digitalWrite(digit1, DIGIT_ON);
break;
case 2:
digitalWrite(digit2, DIGIT_ON);
//digitalWrite(segDP, LOW);
break;
case 3:
digitalWrite(digit3, DIGIT_ON);
break;
case 4:
digitalWrite(digit4, DIGIT_ON);
break;
case 5:
digitalWrite(digit5, DIGIT_ON);
break;
case 6:
digitalWrite(digit6, DIGIT_ON);
break;
}
lightNumber(toDisplay % 10);
toDisplay /= 10;
delayMicroseconds(DISPLAY_BRIGHTNESS);
//Turn off all segments
lightNumber(10);
//Turn off all digits
digitalWrite(digit1, DIGIT_OFF);
digitalWrite(digit2, DIGIT_OFF);
digitalWrite(digit3, DIGIT_OFF);
digitalWrite(digit4, DIGIT_OFF);
digitalWrite(digit5, DIGIT_OFF);
digitalWrite(digit6, DIGIT_OFF);
}
}
void displayNumber02(long toDisplay) {
#define DISPLAY_BRIGHTNESS 25
#define DIGIT_ON HIGH
#define DIGIT_OFF LOW
for(int digit = 6 ; digit > 0 ; digit--) {
//Turn on a digit for a short amount of time
switch(digit) {
case 1:
lightNumber(10);
break;
case 2:
digitalWrite(digit2, DIGIT_ON);
//digitalWrite(segDP, LOW);
break;
case 3:
digitalWrite(digit3, DIGIT_ON);
break;
case 4:
digitalWrite(digit4, DIGIT_ON);
break;
case 5:
digitalWrite(digit5, DIGIT_ON);
break;
case 6:
digitalWrite(digit6, DIGIT_ON);
break;
}
lightNumber(toDisplay % 10);
toDisplay /= 10;
delayMicroseconds(DISPLAY_BRIGHTNESS);
//Turn off all segments
lightNumber(10);
//Turn off all digits
digitalWrite(digit1, DIGIT_OFF);
digitalWrite(digit2, DIGIT_OFF);
digitalWrite(digit3, DIGIT_OFF);
digitalWrite(digit4, DIGIT_OFF);
digitalWrite(digit5, DIGIT_OFF);
digitalWrite(digit6, DIGIT_OFF);
}
}
void displayNumber03(long toDisplay) {
#define DISPLAY_BRIGHTNESS 25
#define DIGIT_ON HIGH
#define DIGIT_OFF LOW
for(int digit = 6 ; digit > 0 ; digit--) {
//Turn on a digit for a short amount of time
switch(digit) {
case 1:
digitalWrite(digit1, DIGIT_ON);
break;
case 2:
digitalWrite(digit2, DIGIT_ON);
break;
case 3:
digitalWrite(digit3, DIGIT_ON);
break;
case 4:
digitalWrite(digit4, DIGIT_ON);
break;
case 5:
digitalWrite(digit5, DIGIT_ON);
break;
case 6:
digitalWrite(digit6, DIGIT_ON);
break;
}
lightNumber(toDisplay % 10);
toDisplay /= 10;
delayMicroseconds(DISPLAY_BRIGHTNESS);
//Turn off all segments
lightNumber(10);
//Turn off all digits
digitalWrite(digit1, DIGIT_OFF);
digitalWrite(digit2, DIGIT_OFF);
digitalWrite(digit3, DIGIT_OFF);
digitalWrite(digit4, DIGIT_OFF);
digitalWrite(digit5, DIGIT_OFF);
digitalWrite(digit6, DIGIT_OFF);
}
}
void displayNumber04(long toDisplay) {
#define DISPLAY_BRIGHTNESS 25
#define DIGIT_ON HIGH
#define DIGIT_OFF LOW
for(int digit = 6 ; digit > 0 ; digit--) {
//Turn on a digit for a short amount of time
switch(digit) {
case 1:
lightNumber(10);
break;
case 2:
digitalWrite(digit2, DIGIT_ON);
break;
case 3:
digitalWrite(digit3, DIGIT_ON);
break;
case 4:
digitalWrite(digit4, DIGIT_ON);
break;
case 5:
digitalWrite(digit5, DIGIT_ON);
break;
case 6:
digitalWrite(digit6, DIGIT_ON);
break;
}
lightNumber(toDisplay % 10);
toDisplay /= 10;
delayMicroseconds(DISPLAY_BRIGHTNESS);
//Turn off all segments
lightNumber(10);
//Turn off all digits
digitalWrite(digit1, DIGIT_OFF);
digitalWrite(digit2, DIGIT_OFF);
digitalWrite(digit3, DIGIT_OFF);
digitalWrite(digit4, DIGIT_OFF);
digitalWrite(digit5, DIGIT_OFF);
digitalWrite(digit6, DIGIT_OFF);
}
}
void displayNumber05(long toDisplay) {
#define DISPLAY_BRIGHTNESS 25
#define DIGIT_ON HIGH
#define DIGIT_OFF LOW
for(int digit = 6 ; digit > 0 ; digit--) {
//Turn on a digit for a short amount of time
switch(digit) {
case 1:
digitalWrite(digit1, DIGIT_ON);
break;
case 2:
digitalWrite(digit2, DIGIT_ON);
break;
case 3:
digitalWrite(digit3, DIGIT_ON);
break;
case 4:
digitalWrite(digit4, DIGIT_ON);
break;
case 5:
digitalWrite(digit5, DIGIT_ON);
break;
case 6:
digitalWrite(digit6, DIGIT_ON);
break;
}
lightNumber(toDisplay % 10);
toDisplay /= 10;
delayMicroseconds(DISPLAY_BRIGHTNESS);
//Turn off all segments
lightNumber(10);
//Turn off all digits
digitalWrite(digit1, DIGIT_OFF);
digitalWrite(digit2, DIGIT_OFF);
digitalWrite(digit3, DIGIT_OFF);
digitalWrite(digit4, DIGIT_OFF);
digitalWrite(digit5, DIGIT_OFF);
digitalWrite(digit6, DIGIT_OFF);
}
}
void displayNumber06(long toDisplay) {
#define DISPLAY_BRIGHTNESS 25
#define DIGIT_ON HIGH
#define DIGIT_OFF LOW
for(int digit = 6 ; digit > 0 ; digit--) {
//Turn on a digit for a short amount of time
switch(digit) {
case 1:
//digitalWrite(digit1, DIGIT_ON);
break;
case 2:
digitalWrite(digit2, DIGIT_ON);
break;
case 3:
digitalWrite(digit3, DIGIT_ON);
break;
case 4:
digitalWrite(digit4, DIGIT_ON);
break;
case 5:
digitalWrite(digit5, DIGIT_ON);
break;
case 6:
digitalWrite(digit6, DIGIT_ON);
break;
}
lightNumber(toDisplay % 10);
toDisplay /= 10;
delayMicroseconds(DISPLAY_BRIGHTNESS);
//Turn off all segments
lightNumber(10);
//Turn off all digits
digitalWrite(digit1, DIGIT_OFF);
digitalWrite(digit2, DIGIT_OFF);
digitalWrite(digit3, DIGIT_OFF);
digitalWrite(digit4, DIGIT_OFF);
digitalWrite(digit5, DIGIT_OFF);
digitalWrite(digit6, DIGIT_OFF);
}
}
//Given a number, turns on those segments
//If number == 10, then turn off number
void lightNumber(int numberToDisplay) {
//Common Anode *************************
#define SEGMENT_ON HIGH
#define SEGMENT_OFF LOW
/* Common Cathode *****************
#define SEGMENT_ON LOW
#define SEGMENT_OFF HIGH
*/
switch (numberToDisplay){
case 0:
digitalWrite(segA, SEGMENT_ON);
digitalWrite(segB, SEGMENT_ON);
digitalWrite(segC, SEGMENT_ON);
digitalWrite(segD, SEGMENT_ON);
digitalWrite(segE, SEGMENT_ON);
digitalWrite(segF, SEGMENT_ON);
digitalWrite(segG, SEGMENT_OFF);
break;
case 1:
digitalWrite(segA, SEGMENT_OFF);
digitalWrite(segB, SEGMENT_ON);
digitalWrite(segC, SEGMENT_ON);
digitalWrite(segD, SEGMENT_OFF);
digitalWrite(segE, SEGMENT_OFF);
digitalWrite(segF, SEGMENT_OFF);
digitalWrite(segG, SEGMENT_OFF);
break;
case 2:
digitalWrite(segA, SEGMENT_ON);
digitalWrite(segB, SEGMENT_ON);
digitalWrite(segC, SEGMENT_OFF);
digitalWrite(segD, SEGMENT_ON);
digitalWrite(segE, SEGMENT_ON);
digitalWrite(segF, SEGMENT_OFF);
digitalWrite(segG, SEGMENT_ON);
break;
case 3:
digitalWrite(segA, SEGMENT_ON);
digitalWrite(segB, SEGMENT_ON);
digitalWrite(segC, SEGMENT_ON);
digitalWrite(segD, SEGMENT_ON);
digitalWrite(segE, SEGMENT_OFF);
digitalWrite(segF, SEGMENT_OFF);
digitalWrite(segG, SEGMENT_ON);
break;
case 4:
digitalWrite(segA, SEGMENT_OFF);
digitalWrite(segB, SEGMENT_ON);
digitalWrite(segC, SEGMENT_ON);
digitalWrite(segD, SEGMENT_OFF);
digitalWrite(segE, SEGMENT_OFF);
digitalWrite(segF, SEGMENT_ON);
digitalWrite(segG, SEGMENT_ON);
break;
case 5:
digitalWrite(segA, SEGMENT_ON);
digitalWrite(segB, SEGMENT_OFF);
digitalWrite(segC, SEGMENT_ON);
digitalWrite(segD, SEGMENT_ON);
digitalWrite(segE, SEGMENT_OFF);
digitalWrite(segF, SEGMENT_ON);
digitalWrite(segG, SEGMENT_ON);
break;
case 6:
digitalWrite(segA, SEGMENT_ON);
digitalWrite(segB, SEGMENT_OFF);
digitalWrite(segC, SEGMENT_ON);
digitalWrite(segD, SEGMENT_ON);
digitalWrite(segE, SEGMENT_ON);
digitalWrite(segF, SEGMENT_ON);
digitalWrite(segG, SEGMENT_ON);
break;
case 7:
digitalWrite(segA, SEGMENT_ON);
digitalWrite(segB, SEGMENT_ON);
digitalWrite(segC, SEGMENT_ON);
digitalWrite(segD, SEGMENT_OFF);
digitalWrite(segE, SEGMENT_OFF);
digitalWrite(segF, SEGMENT_OFF);
digitalWrite(segG, SEGMENT_OFF);
break;
case 8:
digitalWrite(segA, SEGMENT_ON);
digitalWrite(segB, SEGMENT_ON);
digitalWrite(segC, SEGMENT_ON);
digitalWrite(segD, SEGMENT_ON);
digitalWrite(segE, SEGMENT_ON);
digitalWrite(segF, SEGMENT_ON);
digitalWrite(segG, SEGMENT_ON);
break;
case 9:
digitalWrite(segA, SEGMENT_ON);
digitalWrite(segB, SEGMENT_ON);
digitalWrite(segC, SEGMENT_ON);
digitalWrite(segD, SEGMENT_ON);
digitalWrite(segE, SEGMENT_OFF);
digitalWrite(segF, SEGMENT_ON);
digitalWrite(segG, SEGMENT_ON);
break;
// all segment are ON
case 10:
digitalWrite(segA, SEGMENT_OFF);
digitalWrite(segB, SEGMENT_OFF);
digitalWrite(segC, SEGMENT_OFF);
digitalWrite(segD, SEGMENT_OFF);
digitalWrite(segE, SEGMENT_OFF);
digitalWrite(segF, SEGMENT_OFF);
digitalWrite(segG, SEGMENT_OFF);
break;
}
// End of the coding, BUDHUSARANAI, Best of luck.
}
It's Very good project i love It's so much
ReplyDeleteThank you very much
DeleteSir when my Clock reached 12
DeleteIt's not show 12, shows 0 how can i solve this problems reply pleas. Thank you
it is 12 midnight shows as 0
DeleteCan i change it
Deleteyes. Download new codes
DeletePlease help me I'm trying to Making this projects but when i upload the arduino all digital pin are blinked Solution please please
ReplyDeleteIt may be the reason due to an issue on wiring.
DeleteI think wiring is ok.
DeleteProblems in code
Give me your whatsapp Number
ReplyDeleteContact me on FB https://www.facebook.com/setnfix
Deleteblinking fast or slowly ? and can you see the time even it is blinked.
DeleteNo time only all led is bliking
DeleteIm Check wiring its absolutely ok with your diagram
Blinking slowly
ReplyDeleteMy whatsapp number +8801644057379
ReplyDeleteUse transistors
DeleteHow to add this project ds3231 rtc,
ReplyDeletePlease help me
Is there a reason you did not want to use the arduino board and just used the Atmel chip?
ReplyDeleteI am working on getting this project running but am running into issues. Would 2N3906 PNP transistor work instead of bc557?
If you want, you can use the arduino board as well, but it is more cost and more space consume. Yes you can use.
DeleteSir i make this Clock project successfully, but DP is not blinking. So please give me guideline.
ReplyDeletethanks
DP led is directly connected to the LED of RTC module.
DeleteVery nice project
ReplyDeletewhat is the error?
ReplyDeleteHello sir, when the time for example 8:00 , the clock shows 8:00:00( First digit off). But I want 08:00:00, I want '0' before '8' , how do I do that, Pls help me sir
ReplyDeleteFind the following code
Deletevoid displayNumber06(long toDisplay)
and, under that code find
//digitalWrite(digit1, DIGIT_ON); code and remove "//" mark. Best of luck.
Thank you for visiting SetNFix
In respect of this your advice, I tried removing the "//" mark and it showed quit well but it's blinking is not stable
DeleteI follow your step , all 6 digit now active , but 1st digit '0' is not constant, blinking very fast , pls solve this problem
ReplyDeletePls sir solve this problem ):
ReplyDeleteThere may be a wire short. pls check the wiring and the connection of the pins of LED (+) and (-)
DeleteI made 2nd another clock , same problem , all my connection I checked 50s time , but same problem, there is a problem with the code. plsss fix this problem . thank you :)
ReplyDeleteI can't upload the code to Atmega 328pu microcontroller using Arduino uno. Shows upload error while uploading and shows board problem. How to program a new Atmega328 microcontroller with the help of Arduino uno, I would benefit from the process window. Thanks.
ReplyDeleteGive me the error code
DeleteSir, can you let me know by means of a communication so that I can send two pictures about the error? here is no possible add any pictures & imag.
Deleteyou can copy the error and post it
Deleteplease sir i want to enhance it modify the 7 segment clock by adding more 8 pieces of 7 segments display to enable it to display DD/MM/YYYY. (00/00/0000). So please how do I go about it in terms of code and hardware
ReplyDeleteThanks.
Sir I really want to know if I am going to connect all the segments A,B,C,D,E,F and G of the new 8 pieces of 7-segment (SSD) display i want to add to the modification I am working on and again I am thinking of making use of another AVR chip that can accommodate more input and output pins such as ATmega16 with 40pins. Please sir I really need your advice because I am serious about adding date, month, and year functions to this digital clock
ReplyDeleteIt is not enough pins there in Atmega16 for your purpose. But if you want to add Date, Time, Year you have to use arduino Mega board. Then start the programming. Programming part is complicated but it can be done if you check the existing code and the details of the Library well.
DeleteOK thanks Sir.
DeleteThanks, it's the best clock design.
ReplyDeletesir i made this clock but when i powered then no led is in on position, when i pressed the setup button this hour and minute leds are flashing, please help....
ReplyDeleteI think you have to chose common anode or common cathode correctly.
Deletei have made common anode seven segment display with 4 pcs. of red led in parallel in connection.
DeleteDid you apply the correct circuit?. ok trouble shoot like this. Find int DIM = 0; from the code and type timp = 121212; and check the result.
DeleteThis comment has been removed by the author.
DeleteCan i make this without rtc ?
ReplyDeleteYes you can. but you can not keep the time in memory and also you have to generate pulse of 1Hz.
DeleteThis comment has been removed by the author.
DeletePls helpe me sir,,,give me without rtc code.
Deletei have made common anode seven segment display with 2 pcs. of red led in parallel in all segment connection. how can i operate this. plz help me. what is code for this.
ReplyDeleteno need to change the codes, just see the description and and use the transistors correctly applicable for common anode.
Deletehi sir ! in my project all connections are correct but ds1307 ic become verry hot. and clock atomically off after sometime. why? how can i solve this problem
ReplyDeleteCheck input voltage of RTC module.
DeleteI made this clock, but all 7 segment are not glow full brightness, how to increase its brightness, I used 5v 2amp power supply, please help
ReplyDeletei think use 9 volt power supply but connect proper resister for each segment second option use low resistance transister base resister
DeleteChange the brightness level amount in the code and find out the suitable amount.
Deletei have made this clock successfully, but the input for led directly from trainsistor is enoughf? i mean that there is no resistor used for output of led. is that not decreased the life of led's? please reply....
ReplyDeleteNo. I am using the same product more than 4 year without an issue.
Deleteok. thank u..
ReplyDeletesir, i want to increase the brightness of led. what code need to change for this?
ReplyDeleteThen you have to use arduino PWM pins. You need 6 PWM pins such as pin no 3,5,6,9,10,11.
DeleteSTEP 01
Find #define DIGIT_ON HIGH
Then change the HIGH in to your value (0 to 256)
STEP 02
Then all the coeds from digit1 to digit6 should be changed from digitalWrite to analogWrite.
Please send any new updated code (6 digit 12/24 7 segment digital clock)
DeleteCan you send me this kit and what price
ReplyDeleteSir can i use a ready Arduino Nano board instead if Atmega328 with the same code
ReplyDeleteUploading error
ReplyDeleteAn error occurred while uploading the sketch
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x3e
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x3e
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x3e
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x3e
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x3e
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x3e
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x3e
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x3e
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x3e
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x3e
which microcontroller do u used?
DeleteSir At-mega 328P
Delete1st open a new program and upload it without codes. It is uploaded well, the Chip is working well.
DeleteThen connect the board to arduino (without any other wirings) and upload the code.
Sir now code has been uploaded, but all the segments are blinking, if observed closely, clock is running
DeletePlease help
Regards
Check the wiring of switch board
DeleteSir i am using common anode display, whether I will have to edit the code?
ReplyDeleteie:-
//Common Anode *************************
#define SEGMENT_ON HIGH
#define SEGMENT_OFF LOW
/* Common Cathode *****************
#define SEGMENT_ON LOW
#define SEGMENT_OFF HIGH
*/
switch (numberToDisplay){
THIS SECTION
No need to edit the code, check the wiring diagram above.
DeleteI complete this project but time running fast 4 or 5 second in one day how can i fix it please help
ReplyDeleteDue to the different qualities of products, this can be happened.
DeleteHello,
ReplyDeleteMade the project with my own 7" x 11" displays. Case is 3d printed. Love it. I used an Arduine Uno. Works great. Thanks for sharing.
Greetings...!!! Share your project in SetnFix Facebook page and share your experience.
DeleteHello,
ReplyDeleteI used an DS3231 and had to modify the code for the blinking led into:
// part code for flashing LED
Wire.beginTransmission(0x68);
Wire.write(0x0E); // move pointer to SQW address
// Wire.write(0x00); // turns the SQW pin off
Wire.write(0xc0); // sends 0xc0 (hex) 00010000 (binary) to control register - turns on square wave at 1Hz
// Wire.write(0x13); // sends 0x13 (hex) 00010011 (binary) 32kHz
Is it working?
DeleteI create 4 digit clock.
ReplyDeleteAll led are lighting.
adjust button is working , it OK.
But can't adjust Hour and minute , it not working.
I sent detail and photo from Facebook messenger.
Please help me.
Thank Sir
// RTC.adjust(DateTime(F(__DATE__), F(__TIME__)));
Deletethen, I remove // , but not OK.Please help me.
// RTC.adjust(DateTime(F(__DATE__), F(__TIME__)));
DeleteThis code is to decide keeping the time in RTC Memory or jut updating the time from the PC.
Thank Sir.
Deletehello dear
ReplyDeleteyou have really done a wonderful job and i have made a clock by watching your instructions and using 3231 rtc but 1 problem is coming that please help but blinking leds are not working. soo please give your expert opinion..
That blinking LEDs are not coming through the arduino programme. It is directly connected to the LED of RTC module. If the LED of RTC module is working, Check the wiring.
Deleteleds are constant not blinking but when i use this code
Delete// part code for flashing LED
Wire.beginTransmission(0x68);
Wire.write(0x0E); // move pointer to SQW address
// Wire.write(0x00); // turns the SQW pin off
Wire.write(0xc0); // sends 0xc0 (hex) 00010000 (binary) to control register - turns on square wave at 1Hz
// Wire.write(0x13); // sends 0x13 (hex) 00010011 (binary) 32kHz
led start blinking but timekeeping after power off is not working so please helppp....
Hello Sir,I loved your project.If you don't mind please give me the hole circuit diagram in one full ciruit..plz sir it's my humble request..
ReplyDeleteThank you. I will try. the problem is it will take more space and complicated.
DeleteOk sir..but sir, can i use RTC modlue in this circuit..??
DeleteHello Sir ,
ReplyDeleteSome segment is dim lighting.
For exempar , " 1 " number only need for light B Segment and C Segment , but D , E , F Segment are dim lighting.
How to fit this error.
then , Segments brightness are lower.
How to increase brightness.
Thank you very much .
Now I replace High to 255 and digitalWrite to analogWrite, but
Deletenot working.How to fit?
Thank
Swap the number of the code assigned to A to G and check it again. let me know the result. If the error is as same the problem is with the wiring or components related to that lines.
DeleteHello Sir,
ReplyDeleteI am from Myanmar.
I can not write English well.
Please understand.
I edited as you say.
Brightness not increase.
I tested and edited from
" define DISPLAY_BRIGHTNESS 25 " to " define DISPLAY_BRIGHTNESS 3000 ".
After editing , brightness are become increase.
Clock is normally work.
After editing ,
When I press the SET Button it does not work immediately .
Hold for about 5 seconds to work , Hour , Minute , 12/24 too.
I mean,I can only adjust it once by holding down the button long time.
How to fit it ?
Thank you very much for your reply.
Try with on/off switch
Deletegreat project.i made the clock with common anode 6 digits with ds3231 rtc module .no led is lit.does the clock work with rtc ds3231 module and what do i have to modify in the code. thanks a lot
ReplyDeleteI didn't try with DS 3231, You have to assign DS 3231 library and the cardings accordingly.
DeleteHello admin
ReplyDeleteNice project thank you.
I did it this morning and was using it. No problem for now, I'll check if there will be a time delay.
Stay healthy and happy.
I also had the same problem, but it is about 5 minutes to last 3 years. I think it is not a big issue. The time accuracy is depend on the quality of the components, specially crystal and the Atmega IC. There are different levels of the products' qualities. If the time variation is high, try with changing brightness amount in the coding.
DeleteI was wondering if i could use a 3 non-adressable led rgb strip for each segment and how would that affect the diagram. Thank you
ReplyDeleteIf you are not expecting to change the colors while the clock is running, it is no needed to change the diagram.
DeleteIf I want to use 12 volt LED then how can I do it? Please.
ReplyDeleteGive 5v to the board and give 12v to the transistors
DeleteCode error problem
ReplyDelete(redefinition of ' void setup ()')
What to do now?
Please help me
Sir DS3231 and nano board this project is not working no led blink. Please help me
ReplyDeleteIs it uploaded to the board?
Deletesir i want to add a buzzer that beep in every hour, in ihe place of seconds degits pin of arduino. i want to remove 2 last digit that showing seconds and use this pins of arduino with a buzzer. please help me to give me the code to make the buzzer beep in every hour....
ReplyDeleteIf so, you may not need int digit5 = 5; int digit6 = 3; pins.
Deletethen create int variable as an OUTPUT.
then you have to find the hours using timp variable. if its value is 120010
the time is 12h 00m 10s.
RTC lib can not even find the DS1307 chip, all it does is blink with 0-s , i have no idea how did you compile this, but the currently available compiler and libraries do not work at all with it.
ReplyDelete