A Simple Clock

by Dushyanta in Circuits > Clocks

11149 Views, 144 Favorites, 0 Comments

A Simple Clock

clock main photo 2.jpg
DSC_0398.jpg
DSC_0422.jpg
DSC_0430.jpg
DSC_0374.JPG
DSC_0403.JPG
DSC_0379.JPG

In this coronavirus lockdown, I came back to my hometown. Everything is good here but there was one small problem. There is no clock on my table. I know a table clock sounds a little redundant especially in this era of smartphones and laptops, but it's always good to have one. Also, it is irritating when you are doing some work or watching any series on full screen and have to scroll up or fetch for the phone just to check the time.

My old table clock is kept in my dormitory. I took it last year when I joined college and forgot to buy a new one for home. I thought of making one by myself but I always kept averting it in procrastination. A few days ago, Instructables launched a clock contest and I thought, now would be a good time to make a clock.

About the clock I made, it's a very simple clock that shows time and date. To be honest, I only wanted a time-keeping device that can tell hour and minute but I also included the date as it's good to have it visible. Apart from that, I don't need anything else. All those features like a stopwatch or timer are meaningless for a table clock. Anyway, we can use our mobile phones for those special scenarios when we need them.

How does it work?

There are four 7 segment displays that will work in synchronization to display time. Every 10 seconds, the current date will be displayed for a period of 3 seconds. On the right-hand side, there are three indicators for AM, PM, and date. They are there so that one does not confuse the date with time. A push-button is also present for the date, just in case you want to check it and do not want to wait for it to appear.

Note: At the time of making this Instructable, a very strict lockdown is going on in India (because of Covid19). Only essential commodities are available. Therefore, I am restricted to use things that I have in hand. Spare me for taking shortcuts or for not doing things professionally. I am bounded not by will but by means.

Supplies

  • Arduino board (preferably nano or mini)
  • RTC module (DS1307)
  • 74HC164
  • LED strip (I am using 2835 white)
  • NPN transistors (BC547) X15
  • High current NPN transistor (2N2222) X4
  • 1K ohm resistors
  • Headers
  • Push buttons

Print the Parts

DSC_0049.JPG
DSC_0053.JPG
DSC_0058.JPG
DSC_0061.JPG
DSC_0074.JPG
DSC_0077.jpg
DSC_0267.JPG
Untitled-1.jpg

This project is heavily dependent on 3D printing. The basic structures as well as the outer casing are made from 3D printed parts. One can surely make it without a 3D printer but it would be a lot hectic and definitely not worth your time.

I have designed all the parts in TinkerCAD software. I am not a design guy and TinkerCAD gives me just enough flexibility to make 3D models. Links to all the files can be found below.

Three things I want to point out here:

  1. Print the internal parts/sleeves in a dark or dense filament so that the light cannot wander inside and ruin the look.
  2. Try to print the outer casing in the black filament. It looks good. I did not have a black filament so I printed it in Fuschia and colored it with spray paint.
  3. Since the outer casing is too large to be printed at once, I have sliced it into two parts. This creates a weak joint in our 3D printed model. Instead of using a 3D printed backplate, I am using a single-piece MDF board for the back, to overcome it. This provides some stability to the side casing. It is just a precautionary thing, not a necessity. I have still provided a design for the backplate.

Point to be noted, sleeves are the extended covers printed to guide the light. They are a bit fragile because they are made from 1mm thick walls. The reason for it being so thin is that they are just providing a boundary to light rays. Apart from that, they don't have any special purpose so it is not wise to spend excessive material on them. Another reason is thinner walls are easier to bend. This property helps in attaching them to the base plate. If they don't fit properly, just slightly bulge them and they will form a perfect fit without deforming the top layer. A thicker wall will cause the entire structure to bulge.

Apart from the right-side panel, no other part needs support. Build plate adhesion is also not required, you may skip it. I printed all my parts without it and they turned out fine. Anyway, it's your call. For joining two side covers, I am using 2 components epoxy. They have a 1mm thick guide plug to properly align them.

The TinkerCAD links: Clock center dots plate and sleeves, Clock Right Side Cover, Clock Front Ring, Clock AM,PM,Date base plate, Clock PM top sleeve, Clock Date Top Sleeve, Clock AM Top Sleeve, Clock Left Side Cover, Clock 7 segment base plate, Clock Plates Connector, Clock 7 segment sleeve

Making the 7 Segment Display (Part1)

DSC_0131.JPG
DSC_0135.JPG
DSC_0139.JPG
7Segment Digits.png
DSC_0142.jpg

We will begin by making our own 7 segment display. For this, you will need an LED strip. Divide the LED strip into smaller pieces. You can differentiate these smaller pieces by looking for a line with a scissor sign having 2 copper pads on each side. Arrange them in the shape of 8. The LED strip's pieces will follow a spiral pattern, that is, the negative rail/wire of it will be facing towards the center whereas the positive rail will face outwards. Follow the circuit diagram given above to connect the LED pieces in the specified pattern. In a digit, Anodes of LED strip's pieces will be connected in parallel whereas cathode will be left hanging/not connected right now. I recommend you make the connections to the LED pieces separately and stick them to the printed plate later. This way, it will be easier for you to work and you won't accidentally damage the part with your hot soldering iron.

You may ask why are we making our own 7 segment digits. The reason for that is we are aiming for a big clock, and finding such a big 7 segment display is hard. Even if you find one, you won't have many color options. So to make this project more accessible to the masses, I settled on making my own display.

I am using a 2835 white LED strip for lighting up the individual segments. The good thing about the LED strips is that they are available in all colors and sizes. This variety makes it more customizable. The LED density of the 2835 strip is 120 LEDs/meter. Other options like 5050 or WS2812b are also readily available. Particularly the WS2812b is very famous for these kinds of projects because of its ease of use and RGB color output. I did not choose it because they are not in stocks and for this project, I want to work on multiplexing. More about multiplexing and the continuation of 7 segment display is in the next step.

Making the 7 Segment Display (Part2)

DSC_0146.JPG
DSC_0148.jpg
DSC_0159.jpg
DSC_0162.jpg

What is Multiplexing?

Multiplexing is a very common technique used in a lot of consumer electronics products. Almost all the displays that we use today take advantage of multiplexing. Even the display you are reading this instructable on is working with multiplexing. How does it work? Suppose you want to control 100 different LEDs with a microcontroller or some IC. Instead of controlling all of them individually, we can make a grid of 10 rows with 10 LEDs in each row. Now we can control them with just 20 pins instead of 100 pins. For a more detailed description, search for it on Google.

If you have still not printed to parts, now would be the time to do it. In the 3D printed plate of the digits, you will find small holes and notches in each segment. These are made for the wires of LED strip pieces. The notches are made for the anode wire and the holes are made for the cathode wires. The cathode wire of the LED strip will be aligned directly above the holes for a perfect fit. Assuming you are done with the connections, you can proceed by stick the LED pieces to their individual segments. The glue of the LED strip is strong enough to hold them in place but in my case, since the LED strip was a bit old, I had to use drops of super glue to stick them properly.

Once you have stuck all the LED strip pieces on the base plate, connect pins A, B, C, D, E, F, G of all four segments together. This way we make them in parallel.

7 Segment Controller Circuit

DSC_0090.JPG
DSC_0101.jpg
Clock Driver Circuit.png
DSC_0104.jpg
DSC_0121.JPG
DSC_0123.JPG
DSC_0124.JPG

We will use transistors for controlling the LEDs and shift register(74HC164) to control the transistor. You may ask why can't we use the shift register directly, the reason for that is:

  1. 74HC164 is a logic IC and is not capable of delivering an enormous amount of power. Even though LED strips consume significantly less power, it is still very large in comparison of digital electronics.
  2. The voltage level of the IC doesn't match with the LED strip. The IC works at 5V whereas the LED strip works at 12V(usually). To overcome this voltage gap, we shift the voltage to an appropriate level using transistors.

I will be using 74HC164 for the shift register as it is the only one I have right now. There are other options available in the market, like 74HC595. The 595 is a better option in comparison to 164 because it has a latch. If you don't know what a latch is, I highly recommend, you check out how shift registers work. Since we are controlling only LEDs and they are not a high-frequency component, it won't be a problem for me.

I have combined the entire circuit of 7 segment displays in one PCB. We can vaguely divide it into two parts, the common cathode controller and the common anode controller. At the cathode, we have a current consumption of 80 mA. For that, we can use a normal NPN transistor like BC547 which can handle around 100mA of current. At the anode, we have a current consumption of 140mA and for that, we need a more powerful transistor. I am using 2N2222 for it which can handle around 800mA of current. Though it is overabundant in this case, we can surely work it out.

For the common anode circuitry, we need a driving transistor whose job is to turn On/Off the 2N2222. We can't do it with our microcontroller as we need a 12V signal for that. Therefore we use our trusty old BC547 to do this job. The circuit diagram of these circuits is given above.

Making the Dots and AM PM Block

DSC_0180.JPG
DSC_0172.jpg
DSC_0168.jpg
DSC_0176.JPG
DSC_0205.JPG
DSC_0182.jpg
DSC_0189.jpg
DSC_0197.JPG

If you observe a digital clock, you will find two dots present between hours and minute digits. They represent seconds and blink continuously. Though they do not have any major function and can be omitted, they surely improve the look of the clock. Therefore we will inculcate it.

I prefer a 12-hour clock, so I will also include some indicators for displaying AM/PM. Also, every 10 seconds, the clock displays today's date. We don't want to mess up the date with time. Hence we will include an indicator for the date.

Start by dividing the LED strip into smaller pieces. I have already mentioned how to do it. The AM, PM, and date indicators have 4 LED pieces each. In each section, the 4 LED pieces are soldered in parallel using wire. You may ask "why can't we use a continuous strip of 4 pieces instead of separating them and then soldering with wires"? The reason is space constraint. When you flex an LED strip, it acquires space. We don't have enough room to afford it because we want to make our project as compact as possible. Hence the wires. They are easier to handle and acquire less space than traditional LED strips.

For the center dots, there is not enough space to accommodate two different pieces. It is wise to use two continuous pieces here. Apply some black tape on the rest of the LEDs to stop them from interfering.

The Clock Driver

DSC_0111.jpg
DSC_0220.JPG
Clock Arduino Circuit.png
DSC_0234.JPG
DSC_0238.JPG
DSC_0227.JPG
DSC_0255.JPG
DSC_0260.JPG
DSC_0278.JPG

The display part is now completed and it's time to make a driver circuit for the 7 segment display. We will use a microcontroller for it and what better option than our beginner's favorite, the Arduino board. Here I am using Nano because of its ease of programming but Arduino mini will also work fine. I won't recommend Arduino Uno or Mega because they take up a lot of space. Also, you may have to edit the 3D printed parts if you are going with those boards as I have not tested them personally.

The transistors for the AM, PM, Date block and can also be soldered along with the microcontroller. No need to use a separate PCB. If you have doubts about why we are using transistors, I recommend you back and check the Making of 7 segment display step. I have explained it briefly there.

The Arduino Nano already has a voltage regulator to safely step down 12V to 5V. You can very well use it but just to be extra cautious, I have used an external voltage regulator with a higher power rating. The DS1307 can also be soldered together with the Arduino board and connected to its I2C pins. Also, solder some male headers for connection to the 7 segment display's circuit. I used some rainbow wire and female headers to make a cable for it. Don't forget to apply hot glue on the ends of the cable to protect it from breaking.

One thing I would like to mention is, in the circuit diagram, I have mentioned headers for push buttons but in my circuit, you can not see them. Only the 7 segment display headers are present in it. I forgot to add those when I was making the circuit board but later I added them.

Make a small circuit by soldering three push buttons on a perf board. Pin 1 of these pushbuttons will connect to the ground and pin 2 of each to A0, A1, and A2 respectively.

Connecting the Plates and Connect the Circuit

DSC_0211.JPG
DSC_0215.JPG
DSC_0249.JPG
DSC_0239.JPG
DSC_0241.JPG
DSC_0290.JPG
DSC_0307.JPG

There are in total, four base plates. Three are used for the time display and one for the AM, PM, and date. All of them have 4mm holes at the top and at the bottom corner. They are there to help connect all the plates together. We are joining them together because it's always better to have all your circuit components in a single layer rather than in bits and pieces.

You will have four jointer plugs, printed earlier. Use them to join the plates. They are like small blocks with perpendicular cylinders. The block provides rigidity whereas the cylinder goes inside the hole to grab the plate properly. Use superglue to support the jointer plug and to give them some surface to adhere to. Once done, apply a thick layer of hot glue to affirm the connection.

Once the glue has dried up, connect your circuit board to the 7 segment display as well as to the AM, PM, and Date circuit. Plug the cable between the two circuits to join them. After doing the connection, use drops of hot glue to stick the circuit to the backside of the plate. This keeps it attached to the main plate and prevents wires from breaking.

The Code

//Project Name: A Simple Clock//Project Author: Dushyanta Shukla//Date: 24/05/2021//including the RTC library#include "RTClib.h"//defining the RTC moduleRTC_DS1307 rtc;//Control pins for shift register#define DATA 6#define CLOCK 7#define CLEAR 8//Control pins for Anode of 7 segment display#define DIGIT1 5#define DIGIT2 4#define DIGIT3 3#define DIGIT4 2//Control pins for DOTS, AM, PM, and Date indicator#define DOTS 9#define PM 10#define DATE 11#define AM 12//Pins for Push-buttons#define BUTTON1 A0#define BUTTON2 A1#define BUTTON3 A2//Defining the variable for storing data coming from RTC moduleDateTime now;//Variable declearation//AMPM_state is 1 for PM and 0 for AM//button _state is 0 when button1 is not pressed, 1 once it is pressedbyte Hours, Mins, AMPM_state = 0, button_state = 0;//Flag variables to measure elapsed time after last date or time was displayedlong TimeCounter, DateCounter, ButtonCounter;//Encoded values of shift register pins for numerical values 0 to 9byte digits[10] = {126, 48, 109, 121, 51, 91, 95, 112, 127, 123};void setup() {  //Pin type decleration  pinMode(DATA, OUTPUT);  pinMode(CLOCK, OUTPUT);  pinMode(CLEAR, OUTPUT);  pinMode(DIGIT4, OUTPUT);  pinMode(DIGIT3, OUTPUT);  pinMode(DIGIT2, OUTPUT);  pinMode(DIGIT1, OUTPUT);  pinMode(DOTS, OUTPUT);  pinMode(AM, OUTPUT);  pinMode(PM, OUTPUT);  pinMode(DATE, OUTPUT);  pinMode(BUTTON1, INPUT_PULLUP);  pinMode(BUTTON2, INPUT_PULLUP);  pinMode(BUTTON3, INPUT_PULLUP);  //CLEAR pin is active LOW. Deactivating it  digitalWrite(CLEAR, HIGH);  //DIGIT pins are active low. Deactivating them  digitalWrite(DIGIT1, HIGH);  digitalWrite(DIGIT2, HIGH);  digitalWrite(DIGIT3, HIGH);  digitalWrite(DIGIT4, HIGH);  //RTC starts working  rtc.begin();  //Assigning value to DateCounter variable  DateCounter = millis();}void loop() {  //Function for dispalying date  dateDisplay();            //Funtion for updating the time value coming from RTC  segmentDisplay((Hours * 100) + Mins, 0000, 1);         //Displaying time with DOTS turned ON for 1 seconds  TimeCounter = millis();  while (millis() < TimeCounter + 1000)           {    digitalWrite(DOTS, LOW);    buttonCheck();    digitalWrite(DOTS, HIGH);     //DOTS are turned on    segmentDisplay((Hours * 100) + Mins, 0000, 0);  }  //Funtion for updating the time value coming from RTC  segmentDisplay((Hours * 100) + Mins, 0000, 1);  //Turning DOTS OFF  digitalWrite(DOTS, LOW);                  //Displaying time when DOTS are turned OFF for 1 seconds  TimeCounter = millis();  while (millis() < TimeCounter + 1000)           {    buttonCheck();    segmentDisplay((Hours * 100) + Mins, 0000, 0);  }}//Functions for printing values on 7-segment Displayvoid segmentDisplay(int inputValues, int pinState, byte timeUpdate){  //Local Variable Declearation  byte value4, value3, value2, value1;  byte pinState1, pinState2, pinState3, pinState4;  //Extracting value of individual digits and its state from received values  value4 = inputValues % 10;  pinState4 = (pinState) % 10;  //Sending encoded value of digit's numerical value from the array, to Shift Register  shiftOut(DATA, CLOCK, MSBFIRST, digits[value4]);  digitalWrite(DIGIT4, pinState4);  //RTC takes 1ms to transfer the time values to microcontroller. This casuses flickering in the display  //Using this 1ms as a delay for display to prevent flickering  //Doing this only when we want to update time otherwise. Working normally  if (timeUpdate == 1)  {    now = rtc.now();    delay(2);  }  else    delay(3);  digitalWrite(DIGIT4, HIGH);  //Extracting value of individual digits and its state from received values  value3 = (inputValues / 10) % 10;  pinState3 = (pinState / 10) % 10;  //Sending encoded value of digit's numerical value from the array, to Shift Register  shiftOut(DATA, CLOCK, MSBFIRST, digits[value3]);  digitalWrite(DIGIT3, pinState3);  delay(3);  digitalWrite(DIGIT3, HIGH);  value2 = (inputValues / 100) % 10;  pinState2 = (pinState / 100) % 10;  shiftOut(DATA, CLOCK, MSBFIRST, digits[value2]);  digitalWrite(DIGIT2, pinState2);  delay(3);  digitalWrite(DIGIT2, HIGH);  value1 = (inputValues / 1000);  pinState1 = (pinState / 1000);  //A check statement to disable the first digit if it is zero  if (value1 != 0)  {    shiftOut(DATA, CLOCK, MSBFIRST, digits[value1]);    digitalWrite(DIGIT1, pinState1);    delay(3);    digitalWrite(DIGIT1, HIGH);  }  //If time value is updated, then refresh our code's global variable  if (timeUpdate == 1)  {    Hours = now.hour();    Mins = now.minute();    //To check AM/PM and turn on their respective indictors    //To convert 24 hour clock to 12 hour    if (Hours >= 12)    {      Hours -= 12;      AMPM_state = 1;      digitalWrite(PM, HIGH);      digitalWrite(AM, LOW);    }    else if (Hours < 12)    {      AMPM_state = 0;      digitalWrite(PM, LOW);      digitalWrite(AM, HIGH);    }    //If zero in 24 hour clock, then make it 12    if (Hours == 0)      Hours = 12;  }}//Function for displaying datevoid dateDisplay(){  //Checkig whether 10 seconds have elapsed after last date was dispalayed  if (millis() > (DateCounter + 10000))  {    DateCounter = millis();    //Turning the AM,PM indicator off and Date indicator On    digitalWrite(AM, LOW);    digitalWrite(PM, LOW);    digitalWrite(DATE, HIGH);    //Getting today's date    byte CurrentDate = now.day();    byte CurrentMonth = now.month();    //Dispalying date for a period of 3 seconds    while (millis() < (DateCounter + 3000))    {      segmentDisplay((CurrentDate * 100) + CurrentMonth, 0000, 0);    }    //Turning OFF the date indicator and turning ON the AM/PM indicator    digitalWrite(DATE, LOW);    if (AMPM_state == 1)      digitalWrite(PM, HIGH);    else      digitalWrite(AM, HIGH);    DateCounter = millis();  }}//Function for checking whether any button is being pressed or notvoid buttonCheck(){  //If BUTTON2 or BUTTON3 is being pressed, display the date  if ((digitalRead(BUTTON2) == LOW || digitalRead(BUTTON3) == LOW) && button_state == 0)  {    //10 seconds are removed from DateCounter variable because     //the dateDispaly() function has if condition, which is true when    //this counter is 10 secconds less than the millis() function    DateCounter -= 10000;    dateDisplay();  }  //If BUTTON1 is pressed, start the ButtonCounter variable  //This is done to check whether this button is pressed for more or less than 5 seconds   else if (digitalRead(BUTTON1) == LOW && button_state == 0)  {    ButtonCounter = millis();    button_state = 1;  }  else if (digitalRead(BUTTON1) == LOW && button_state == 1)  {    //If the button is pressed more than 5 seconds, enter the settings mode    if (millis() > (ButtonCounter + 5000))      dateChange();  }  //If BUTTON1 is not being pressed anymore  else if (digitalRead(BUTTON1) == HIGH && button_state == 1)  {    //If the button was pressed for more than 5 seconds, enter the settings mode    if (millis() > (ButtonCounter + 5000))      dateChange();    //Otherwise diplay the current date    else    {      button_state = 0;      DateCounter-=10000;      dateDisplay();    }  }}void dateChange(){  ButtonCounter = millis();  //Temporary variable when clock is in settings mode  byte set_hour, set_minute, set_date, set_month, set_state;  //Because values of years are out of bound of byte datatype  int set_year;  //Putting current time values in temporary variables to display on setting mode's startup  set_hour = now.hour();  set_minute = now.minute();  set_date = now.day();  set_month = now.month();  set_year = now.year();;  set_state = 0;  //Turning AM, PM and date indicator ON to signify clock is in the settings mode  digitalWrite(AM, HIGH);  digitalWrite(PM, HIGH);  digitalWrite(DATE, HIGH);  //Loop will be executed untill 10 seconds of inactivity  //When any button is pressed, it restarts  while (millis() < (ButtonCounter + 10000))  {    //If BUTTON1 is pressed, change the time variable being adjusted    if (digitalRead(BUTTON1) == LOW)    {      //Reset the ButtonCounter variable to again start counting 10 seconds of inactivity      ButtonCounter = millis();      set_state++;      if (set_state == 5)        set_state = 0;    }    //BUTTON2 will increment the values    if (digitalRead(BUTTON2) == LOW)    {      //Reset the ButtonCounter variable to again start counting 10 seconds of inactivity      ButtonCounter = millis();      //switch case to increment the time variable which is selected      switch (set_state)      {        case 0:          set_hour++;          if (set_hour == 24)            set_hour = 0;          break;        case 1:          set_minute++;          if (set_minute == 60)            set_minute = 0;          break;        case 2:          set_date++;          if (set_date == 32)            set_date = 1;          break;        case 3:          set_month++;          if (set_month == 13)            set_month = 1;          break;        case 4:          set_year++;          break;      }    }    //BUTTON3 will decrement the values    else if (digitalRead(BUTTON3) == LOW)    {      //Reset the ButtonCounter variable to again start counting 10 seconds of inactivity      ButtonCounter = millis();      //Switch case to decrement the time variable which is selected      switch (set_state)      {        case 0:          set_hour--;          if (set_hour == -1)            set_hour = 23;          break;        case 1:          set_minute--;          if (set_minute == -1)            set_minute = 59;          break;        case 2:          set_date--;          if (set_date == 0)            set_date = 31;          break;        case 3:          set_month--;          if (set_month == 0)            set_month = 12;          break;        case 4:          set_year--;          break;      }    }    //If any button is pressed, this produced a delay of 250 ms    //This is done to match reaction time of Arduino to that of a human    while (millis() < (ButtonCounter + 250))    {      if (set_state == 0 || set_state == 1)        segmentDisplay((set_hour * 100) + set_minute, 0000, 0);      else if (set_state == 2 || set_state == 3)        segmentDisplay((set_date * 100) + set_month, 0000, 0);      else        segmentDisplay(set_year, 0000, 0);    }    //Turn OFF the digits which are displaying the selected variable    //This creats a blinking effect in the variable being changed    if ((millis() % 1000) < 500)    {      if (set_state == 0)        segmentDisplay((set_hour * 100) + set_minute, 1100, 0);      else if (set_state == 1)        segmentDisplay((set_hour * 100) + set_minute, 11, 0);      else if (set_state == 2)        segmentDisplay((set_date * 100) + set_month, 1100, 0);      else if (set_state == 3)        segmentDisplay((set_date * 100) + set_month, 11, 0);      else if (set_state == 4)        segmentDisplay(set_year, 1111, 0);    }        else if ((millis() % 1000) > 500)    {      if (set_state == 0 || set_state == 1)        segmentDisplay((set_hour * 100) + set_minute, 0000, 0);      else if (set_state == 2 || set_state == 3)        segmentDisplay((set_date * 100) + set_month, 0000, 0);      else if (set_state == 4)        segmentDisplay(set_year, 0000, 0);    }  }  //Once clock is out of setttings mode, turn OFF the AM, PM, and date indicator  digitalWrite(AM, LOW);  digitalWrite(PM, LOW);  digitalWrite(DATE, LOW);  //Update time values in RTC with the chosen value of user  rtc.adjust(DateTime(set_year, set_month, set_date, set_hour, set_minute, 0));  //Give a delay of 2 ms for above line of code to take effect  delay(2);  //Refresh the time values in the 7 segment diplay variables  segmentDisplay((set_hour * 100) + set_minute, 0000, 1);  //Reset the button 1 state to zero  button_state = 0;  //This is done so that after time is changed, date is not displayed immidiately  //Done for look, not a necessity  DateCounter=millis();}

Download library for RTC from GitHub.

Name- RTClib.h

Link- https://github.com/adafruit/RTClib

Assembling the Clock (Part 1)

DSC_0304.JPG
DSC_0297.JPG
DSC_0322.JPG
DSC_0325.JPG
DSC_0464.JPG

Finally, the 3D printing and circuit building job are done and we can start assembling our clock. Start by mounting the sleeves on the base plates. They will show some resistance, but will eventually fit. Once done, slide the entire build plate in the outer housing.

I am assuming that you have already glued the two side covers as well as the front loops together. If not, follow these steps. I forgot to take pictures of it but will try to guide you verbally. The glue I am using is 2 component epoxy. Mix the two gels and apply a thin coating on the joining edges. The left side casing has 1mm thick plugs protruding out. They are there to help you align the two covers. The right side cover has holes in it to accommodate those plugs. Slide them gently in there. If you are having trouble inserting them, sand it a little. You can also break them and align them manually.

Once the glue has dried up, place the main plate inside. It will sit perfectly flat. No need to apply glue, the frictions from the wall will hold it in place.

Assembling the Clock (Part2)

DSC_0294.JPG
DSC_0314.JPG
DSC_0329.JPG
DSC_0377.JPG
DSC_0379.JPG
DSC_0453.JPG
DSC_0316.JPG
DSC_0459.JPG
DSC_0445.JPG

To protect the internal parts and circuit, we need a top cover. I have three items in hand to do this job:

  1. Transparent Acrylic glass
  2. Milky white Acrylic board
  3. Butter paper

The Acrylic glass is too transparent, hence the internal components are visible. It does not give a good look. The milky white acrylic board I have is too dispersive and causes the walls to disappear, causing a feathering effect. Therefore I reject both the option. I use butter paper in combination with acrylic glass. The butter paper diffuses the light and gives it a texture and the acrylic glass protects it from wear and tear. The butter paper I have is small in size therefore I join the two of them from the back using some translucent tape.

Place the paper and then the acrylic glass on top of the main plate and using the front loop, close the front side. Apply some superglue to the loop to adhere them to side covers. Finally, flip the clock and cover the backside using the MDF board. I have drilled a hole in it for the power plug and using some hot glue, attached the power jack to it.

The right side cover has three holes for the pushbuttons. Hot glue the PCB of push buttons to the side cover from inside. In my model, you can see that the holes for the pushbuttons are not properly aligned. I had to use a hot knife to melt the plastic around them, to fit them perfectly. This is an issue of design and has already been fixed in yours.

End

DSC_0427.jpg
clock main.jpg
DSC_0377.JPG
DSC_0412.JPG

The project is complete now. Before you go, let's talk about how to power it. I am using a 12V 1A supply to power it. Don't use batteries. Even though the LED strips are efficient and consume less power, your batteries will still run out in 2-3 days depending upon their capacity. The best option is to use a constant power supply like an SMPS.

To change the time, use the pushbuttons. If you press the first button for 5 seconds, the clock will go into settings mode. Using the other two pushbuttons, increase or decrease values, and using the first one, change the variable(hours, minutes, date, etc). Once done, leave the clock. It will automatically go back to normal mode and update the value with your specified values.

Hope you enjoyed this project. Don't forget to leave your comments.