Arduino Nano Clock With Auto Brightness.

Arduino Nano Clock With Auto Brightness.

Everyone wanted a clock that shows time and date together So, In this project I’ll show you how you can build an arduino nano clock with adaptive brightness using RTC and a design PCB from JLCPCB.

Arduino Nano Clock Features.

1. Shows the time time and together. swithes every three seconds.

2.Adaptive brightness,i.e this clock will adjust the brightness of display according to outside light condition.

3. Easily Visible ,Due adaptive brightness it is easily visible to day as well as in night.

4.No need to set time and date everytime when power goes off. RTC takes care of correct time and date.

5.Easy to assemle, by using nextpcb’s PCB it is very easy to make it.

PCB for the Project.

To build this project, I’ve designed a PCB for the Arduino nano board and RTC.

I’ve designed the shield to be a compact digital clock. The PCB has a lot of features so that it can suit a lot of different projects for different applications; you can also attach bluetooth module to display data ; In fact, I didn’t use all the PCB features in this project.

The RTC module is a very interesting addition to the shield, you no need to set time everytime when power goesoff.

Parts Required

To assemble the circuit on a breadboard you need the following parts:

1.Arduino nano

2.RTC Module

3.LDR

4.LED matrix

5.1K Resistor

6.PCB Board from NextPCB

7.Female Header

Schematic

After gathering all the needed parts, you can assemble the circuit by following the above schematic diagram:

Designing the PCB

After making sure the circuit was working properly, use any online or offline tool to design your pcb,

I won’t explore how I’ve designed the PCB, but I provide all the files if you want to modify the PCB for yourself. Click here to download the GERBER project files.

You don’t need to know how to design the PCB to order one. You just have to:

1.To download the Gerber files, click here to download the .zip file.

2.Go to jlcpcb.com, click the “QUOTE NOW” button, and upload the .zip file you’ve just downloaded.

3.Select the parameters of yours PCB like….the solder-mask, silkscreen, copper,Quantity, Surface Finish, Electrical Test,etc.

With the default settings, you can order 10 PCBs for just $2. However, if you want to select other settings like a different PCB Color it will cost you a few more dollars. When, you’re happy with your order. Click the “SAVE TO CART” button to complete the order. After calculating the price.

My PCBs took 1 day to be manufactured and they arrived in 5 business days using DHL delivery option.

Soldering the Components

The next step was soldering the components to the PCB,

Now place every components in the soldier mask of PCB board and soldire everything properly,

Use female header for the Arduino nano and RTC module so you can able to reuse these components.

The Above figure shows how the PCB looks like after soldering all the components.

Code

When your hardware is ready connect the clock to your computer to upload the code,

Download the needed code given to the link, and upload that in your arduino nano clock, after selecting the right board and port. Click here for code ...Arduino nano clock.

#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>
#include <Arduino.h>
#include <RTClib.h> 


const int ldrPin = A2;
int Hr,yr,mon,d;
int Mn, sc;
byte value;
RTC_DS1307 rtc;
//#define HARDWARE_TYPE MD_MAX72XX::PAROLA_HW
#define HARDWARE_TYPE MD_MAX72XX::FC16_HW

#define MAX_DEVICES 4
#define CLK_PIN   13
#define DATA_PIN  11
#define CS_PIN    10



// Hardware SPI connection
//MD_MAX72XX mx = MD_MAX72XX(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
//MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
// Arbitrary output pins
MD_Parola P = MD_Parola(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);

byte ledintensitySelect(int light) {
       value=round(light/250);
  return value;
};
String sign[] ={"Jan", "Feb", "Mar", "Apr", "May", "Jun","Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};



void setup() 
{
  Serial.begin(9600);
  rtc.begin();
  P.begin();
  pinMode(ldrPin, INPUT);
  /////////////////////(year,month,day,hr,min,sec)
 // rtc.adjust(DateTime(2019, 11, 6, 10, 45, 30));
}




void loop()
{
  int L = analogRead(ldrPin);
  byte  L1= ledintensitySelect(L);

   DateTime now = rtc.now();
   // Save check in time;
   yr=now.year();
   mon=now.month();
   d=now.day();
   Hr = now.hour();
   Mn = now.minute();
   sc=now.second();
   String d1= String(d) + " " ;
   String s1= String(Hr) + ":" ; 
   String s2= String(Mn);
   String s3= String(sc);
   String s= s1 + s2 ;
   if (strlen(Hr)==1)
   {
    String s1="0"+ s1;
    }
   if( strlen(Mn)== 1 )
   {
    String s2 = "0"+ s2;
    }
   P.setIntensity(L1);
   P.print(s);
   delay(4000);
   P.print(d1+sign[mon-1]);
   delay(2000); 
  Serial.println(L);
  
  }

Ready to Use

Now our Clock is ready to use , you can use it anywhere

In office

In School

In home

In bedroom etc

So order your own PCB board from NextPCB and your own project

Video Tutorial.

Leave a Reply

Your email address will not be published. Required fields are marked *