Introduction: Arduino Real Time Clock With Large 7-segment Displays
Hello,
I saw some RTC projects on the internet, but none of them were shown with 7-segment Displays.
This instructables is about my version of the RTC shown with 7-segment Displays.
I am using a RTC DS1307, to keep the correct time, to show this time I am using four large 7-segment Displays and an Arduino Uno with four 8-bit shiftregisters.
This project is concealed in a box, which displays are cut to size from the box and the back and top of this box are made out of plexiglass, so you can watch it from the inside.
Step 1: List of Materials Used
- 01 x RTC-module (DS1307)
- 01 x Arduino Uno
- 04 x 74HC595 Shiftregister (8-bit)
- 04 x 7-Segment Displays (Common Anode).
- 28 x 560 ohm resistors
- 01 x stripboard
- 04 x 16 pins IC socket
- 01 x set jumper wires
Step 2: Wire Up the RTC With the Arduino Uno
Wire up the RTC, just like shown in the photograph.
Step 3: Arduino Script RTC
This is the Arduino script for programming the RTC with the right time. You can adjust the time and read it if you want in serial monitor.
Attachments
Step 4: 74HC595 IC & 7-segment Displays
We use the 74HC595 IC, to minimalise the Arduino input pins needed for the four 7-segment Displays.
This IC can be used with more, you only have to connect the date pin with the next one.
Connect the 7-segment Displays:
- Q0 - Q7 of the IC are there to connect the 7 inputs from your 7-segment Display. Q0 - Segment A, Q1 - Segment B, etc. (pin lay-out in the photograph).
Make sure you dont demolish your segments in the Displays, I am using 560 Ohm resistors for this.
- If you connected your displays, you will notice that there are four pins remaining: 9, 11, 12, 14. Connect these pins like shown in the photograph. Now only pin 9 remains to connect, this is your data output you need to send to the next IC, this output goes to the next IC pin 14, etc. You need to connect pin 11 & 12 to your next IC also.
I minimalised the space, by solder these IC's on a stripboard.
Step 5: Arduino Script to Show the Time
This is the Arduino script to show the time from the RTC, on to your 7-segment Displays.
Attachments
Step 6: Case
I made my case with some help from makercase.com
I really want to show the inside of my project, but I wanted it to look good too. That is why I chose to make the back and top out of plexiglass and the rest out of wood.
These two files are the files I used for laser cutting the box.
Step 7: The End
This was my project! You have questions or something to mention, please feel free to leave a comment.
9 Comments
6 years ago
*Edited
There is a typo
#include <Wire.h> // i2c wire libraries for RTC
#include "RTClib.h" // RTC libraries
RTC_DS1307 RTC; // define RTC variables
#define CLOCK 10
#define LATCH 9
#define DATA 8
byte digits [110]; // Definitions of the 7-bit values for displaying digits, digit [10] is turning the display completely off
const int shiftRegisters = 4; // Number of shift registers in use, 4
byte display [shiftRegisters]; // Array of numbers to pass to shift registers
int hour, minute, second;
int fnHour, snHour;
int fnMinute,snMinute;
int fnSecond, snSecond;
void setup()
{
pinMode(LATCH, OUTPUT);
pinMode(CLOCK, OUTPUT);
pinMode(DATA, OUTPUT);
digits [0] = 0x40;
digits [1] = 0x79;
digits [2] = 0x24;
digits [3] = 0x30;
digits [4] = 0x19;
digits [5] = 0x12;
digits [6] = 0x2;
digits [7] = 0x78;
digits [8] = 0x0;
digits [9] = 0x18;
Serial.begin(9600);
Wire.begin();
RTC.begin();
}
void loop()
{
DateTime now = RTC.now(); // This line needed for the database words from RTC_DS1307
Serial.print(now.year(), DEC); // You can use this Serial.print for serial monitoring
Serial.print('/');
Serial.print(now.month(), DEC);
Serial.print('/');
Serial.print(now.day(), DEC);
Serial.print(' ');
Serial.print(now.hour(), DEC);
Serial.print(':');
Serial.print(now.minute(), DEC);
Serial.print(':');
Serial.print(now.second(), DEC);
Serial.println();
hour = now.hour(); // Multiplex hour from RTC
minute = now.minute(); // Multiplex Minute from RTC
fnHour = hour / 10; // First Number Hour
snHour = hour % 10; // Second Number Hour
fnMinute = minute / 10; // First Number Minute
snMinute = minute % 10; // Second Number Minute
second = now.second();
fnSecond = now.second() / 10;
snSecond = now.second() % 10;
display [2] = digits [fnHour]; // This step is to maintain the overvieuw and to keep track of which display view which digit
display [3] = digits [snHour]; // You can copy for example " digits [fnHour] " in the place where " display [0] " stands
display [0] = digits [fnMinute];
display [1] = digits [snMinute];
// display [3] = digits [snSecond];
// display [2] = digits [fnSecond];
/* display [0] = digits [snSecond];
display [1] = digits [snSecond];
display [2] = digits [snSecond];
display [3] = digits [snSecond];
*/
digitalWrite(LATCH, LOW);
shiftOut(DATA, CLOCK, MSBFIRST, display [0]); // shiftOut(DATA, CLOCK, MSBFIRST, digits [fnHour]);
digitalWrite(LATCH, HIGH);
digitalWrite(LATCH, LOW);
shiftOut(DATA, CLOCK, MSBFIRST, display [1]);
digitalWrite(LATCH, HIGH);
digitalWrite(LATCH, LOW);
shiftOut(DATA, CLOCK, MSBFIRST, display [2]);
digitalWrite(LATCH, HIGH);
digitalWrite(LATCH, LOW);
shiftOut(DATA, CLOCK, MSBFIRST, display [3]);
digitalWrite(LATCH, HIGH);
delay(1000);
}
Reply 3 years ago
don´t work!
Question 5 years ago
Greetings Jensvw, that's a nice project. ++
I have a question please. How can you adjust time if there is no buttons? Please post the full circuit diagram by Proteus, Fritzing or so.
Regards :)
6 years ago
need schematic ,i want to make it ,please send me schematic haxord7@gmail.com
6 years ago
Looks nice man!
Reply 6 years ago
Thanks kill
6 years ago
Goodjob
6 years ago
what size are the 7 segment displays and where die you get them?
Reply 6 years ago
length: 70mm
width: 48mm
I bought them from Conrad >
https://www.conrad.nl/nl/7-segments-display-rood-5...