arduino with a ds1307 rtc and lcd display price

you can use the basic structure of this project. We have already made various Arduino projects, Embedded projects, and Arduino tutorials on our website. You can visit them if you are new to the world of electronics and Arduino.
to display the time. You can make an Automatic pet Feeder, Automatic Light, time-based plant watering system, and much more using this. This reduces the manual stress on us.
the module is capable of counting seconds, minutes, hours, days, weeks, months, and years. Arduino uses the I2C communication protocol to send data to the LCD display,
which we are using here to display the time. The display updates every second to tell the most accurate time since the module is much accurate to tell the time.
The module is capable of running for more than 5 years continuously without affecting the count in time. this is possible because of the in-built cell.
the most professional PCB manufacturer for prototyping and low-volume production to work with in the world. With more than a decade in the field, PCBWAY committed to meeting the needs of customers from different industries in terms of quality, delivery, cost-effectiveness, and any other demanding requests. As one of the most experienced PCB manufacturers and SMT Assemblers in China, we pride ourselves to be your best business partners as well as good friends in every aspect of your PCB needs. They strive to make your R&D work easy and hassle-free.
NOTE- You need to install the three libraries LiquidCrystal_I2C.h, Wire.h, and DS1307.hwhich can be downloaded from HERE into your Arduino IDE before uploading the code.
Once the uploading of code is complete, LCD Display will be able to show the Time as per the code uploaded. I hope you found this guide helpful in making the project. If you have any doubts, you can put them in the comment section below.

We are all aware that most MCUs used in our projects are time-agnostic; that is, they are unaware of the time around them. It’s fine for most of our projects, but every now and then, when you come across an idea where keeping time is critical, the DS1307 precision RTC module comes in handy. It is suitable for a wide range of projects, including clocks, timers, and alarms, as well as data logging and time stamping.
This module is built around the highly capable DS1307 RTC chip and the AT24C32 EEPROM, both of which have been around for a while and have good library support.
At the heart of the module is a low-cost, extremely accurate RTC chip from Maxim — the DS1307. It handles all timekeeping functions and communicates with the microcontroller over I2C.
The DS1307 can keep track of seconds, minutes, hours, days, dates, months, and years. It can work in either a 12-hour or 24-hour format and has an AM/PM indicator. For months with fewer than 31 days, it automatically adjusts the date at the end of the month, including leap year corrections (valid up to 2100).
Another interesting feature of the DS1307 is the SQW pin, which can be programmed to output one of four square-wave frequencies: 1Hz, 4kHz, 8kHz, or 32kHz.
The DS1307 requires an external 32kHz crystal for timekeeping, the frequency of which is easily affected by external temperature. Even though this change in frequency is negligible, it does add up.
The built-in power-sense circuit continuously monitors the status of VCC to detect power failures and automatically switches to the backup supply. This means that even in the event of a power outage, the IC can still keep time.
Assuming you use a fully charged 47mAh coin cell battery and keep the chip current draw to a minimum of 300nA, the battery should be able to power the RTC for at least 17 years without the need for an external power supply.
The DS1307 RTC module also includes a 32-byte (4K x 8-bits) AT24C32 EEPROM (non-volatile) chip with 1,000,000 write cycles. This chip doesn’t really have anything to do with the RTC, but it can be useful for things like data logging or storing any other data that you want to be non-volatile.
The AT24C32 EEPROM is rated for 1,000,000 write cycles, so it won’t wear out during normal data logging applications as long as you’re not writing data every second.
After installing the DS18B20, you will be able to obtain temperature readings from the DS pin. These readings can be used to compensate for temperature-based time drift.
The module has a simple I2C interface that takes up two addresses. The DS1307 RTC chip’s fixed I2C address is 0x68, and the 24C32 EEPROM’s fixed I2C address is 0x50.
The SDA and SCL signals, as well as power and ground, are also broken out to the other side of the module to allow these signals to be looped out to another module.
DS pin should provide temperature readings if a DS18B20 temperature sensor is installed using the three mounting holes in the upper right corner, close to the battery holder (marked U1).
BAT is a backup supply input for any standard 3V lithium cell or other energy source to keep accurate time when the device’s main power is interrupted.
Now we are left with the pins that are used for I2C communication. Note that each Arduino board has different I2C pins that must be connected correctly. On Arduino boards with the R3 layout, the SDA (data line) and SCL (clock line) are on the pin headers close to the AREF pin. They are also referred to as A5 (SCL) and A4 (SDA).
It takes a lot of effort to communicate with an RTC module. Fortunately, the uRTCLib library was created to hide all of the complexities, allowing us to issue simple commands to read the RTC data.
To install the library, navigate to Sketch > Include Library > Manage Libraries… Wait for the Library Manager to download the library index and update the list of installed libraries.
At the end of the tutorial, we’ve also included code for reading and writing the onboard 24C32 EEPROM. If you’re interested, you’ll need to install the uEEPROMLib library. Look for ‘ueepromlib‘ and install it as well.
The sketch begins by including the Arduino.h and uRTCLib.h libraries for communicating with the module. We then create an uRTCLib library object and define the daysOfTheWeek 2D character array to store the days information.
set(ss, mm, hh, day, dd, mm, yy) function sets the RTC to an explicit date and time. For example, to set January 13, 2022 at 12:56, you would call: rtc.set(0, 56, 12, 5, 13, 1, 22);
dayOfWeek() function returns the current day of the week (1 to 7). This function is typically used as an index for a 2D character array that stores information about the days.
As an added bonus, the DS1307 RTC module includes 32 bytes of Electrically Erasable ROM. Its contents will not be erased even if the device’s main power is interrupted.
This is a simple sketch that attempts to write an integer, float, character, and string to the 24C32 EEPROM and then reads them back. This sketch can be extended to save settings, passwords, or just about anything.
When reading/writing the EEPROM, keep in mind that different data types take up different amounts of memory. For example, a character is one byte, an integer is two bytes, and a float is four bytes.
However, if you are storing an integer, you must reserve two memory locations for each value, so you will want to store data in every other memory location, such as (0,2,4,6….).

Time is vital in today"s society, and when it comes to certain electronics, timing is crucial; just like us, they require a means to keep track of time, and precise time. So, how do electronics accomplish this? A Real-Time Clock, or RTC, is a timekeeping device embedded inside an Integrated Circuit, or IC. The answer is DS1307. Many time-critical applications and devices rely on it, including servers, GPS, and data loggers.
The DS1307 is a battery-backed clock/calendar with 56 bytes of SRAM. The clock/calendar displays data in seconds, minutes, hours, days, dates, months, and years. Each month"s end date is automatically changed, particularly for months with fewer than 31 days.
They come in the form of integrated circuits (ICs) that control time like a clock and date like a calendar. The key advantage of RTC is that it has a battery backup system that keeps the clock/calendar working even if the power goes out. The RTC requires a tiny amount of electricity to stay active. These RTCs may be found in various applications, including embedded devices and computer motherboards.
DS If your module has a DS18B20 temperature sensor fitted immediately next to the battery holder, the pin is designed to output temperature information (labeled as U1).
BAT is a backup supply input for any standard 3V lithium battery or another energy source that allows the gadget to keep a precise time when the primary power is lost.
The DS1307 RTC module includes all onboard components necessary for the proper operation of a DS3107 chip. Furthermore, it has a holder for a 20mm 3V lithium coin battery. Any CR2032 battery can be used in this module. Let"s go through each of the module"s components one by one. The DS1307 keeps track of the seconds, minutes, hours, days, and months. This chip resets its seconds, minutes, hours, and date at the end of every month. Time can be displayed in 12-hour format with AM and PM or in 24-hour format.
The DS1307 chip requires a 32KHz external crystal oscillator to function (time-keeping). As a result, the RTC module has a 32KHz external crystal oscillator. However, there is one issue with this 32KHz crystal oscillator: changes in ambient temperature alter the crystal oscillator"s oscillation frequency. The difference in the external crystal oscillation frequency of 32KHz is insignificant. However, in the long term, it is a mistake. It causes a monthly clock drift of 2-3 minutes.
The DS1307 RTC module also has a 24C32 EEPROM onboard. This EEPROM has a 32-byte capacity and only allows for regional read-write operations. Using an RTC module for Alarm-based projects may leverage this memory to save time. For example, we wish to wake up every day at 8:00 a.m. We may record this time value in EEPROM, and an alarm will sound anytime the time equals the saved value.
These EEPROM chips use the I2C interface to connect with microcontrollers like Arduino. As a result, it uses the same I2C bus as the DS1307. To communicate with EEPROM (o 0x50 Hex) and DS1307 chip on the same I2C bus, different slave addresses are set to them.
A holder for connecting a CR2032 coil cell may be found on the rear side of an RTC module. This backup battery is intended to preserve precise time even if the primary power supply attached to the DS1307 fails. This chip has a power sensor circuit that detects main power and switches to the backup coil cell when main power is lost.
An external DS18B20 digital temperature sensor can be connected to an empty slot on this module. The three empty pinouts in the bottom right corner serve as a placeholder for the DS18B20 sensor, whose output may be received through the RTC module"s DS pin.
After making the above connections, you need to connect the Arduino Uno to your PC, open Arduino IDE, and install Arduino DS1307 Time Set Library. Open the Arduino IDE and select Library Manager from the menu bar. Now look for RTCLib and get the most recent version, as shown in the figure below.
You may manually set the time on this line by giving the following date-time values to the function: year, month, day, hour, minute, and second. In the code below, we"ll set the system"s time. As a result, this line has been commented out.
Wire.h is used to connect with the module via I2C, LiquidCrystal_I2C.h is used to show time on the LCD display, and RTClib.h is used to set and format the time on the display.
If the RTC loses power and the time in the module becomes incorrect, the code will automatically adjust the time in the module using the computer"s clock. So make sure the clock on your computer is set to the correct time when setting the time.
The only difference between the DS3231 and the DS1307 is that the DS3231 has a temperature compensated crystal built-in, which makes it more precise, but the chip is also considerably bigger. They share the same I2C address, thus libraries designed for the DS1307 should also function for the DS3231.
The address byte starts with the 7-bit DS1307 address, which is 1101000, and then the *direction bit (R/W), which is a 0 for a write. The device produces an acknowledge on the SDA line after receiving and decoding the address byte.
The 32-kHz clock is used to run the RTC. There are fixed-length seconds and one variable-length second for each hour. There are 3599 seconds of constant length. The 32-kHz clock ticks precisely 32,768 times per second.

In this tutorial, we will learn to interface DS1307 RTC module with Arduino UNO. Firstly, we will look into these questions: What is RTC (Real-time clock)? Why real-time clock is used? How an RTC module communicates with Arduino on an I2C communication bus? How to make a digital clock using Arduino and DS1307 RTC module? Secondly, we will discuss pinout, pin configuration details, interfacing circuit with Arduino, and example code at the end.
Before going further into this article, you should have a basic knowledge of Arduino programming and how to use Arduino IDE. You should know how to interface LCD with Arduino and how to use the input/ output ports of Arduino. If you don’t know how to do these things, we recommend you to go through the following articles to get a better understanding of this articles:
As its name suggests, a real-time clock is used to keep a record of the time and to display time. It is used in many digital electronic devices like computers, digital smartwatches, data loggers, and situations where you need to keep track of time. one of the great benefits of a real-time clock is that it also keeps a record of time even if the power supply is not available.
Now the question is how can an electronic device like real-time clockwork without the use of a power supply. Because almost all RTC modules come with small coin size 20mm 3V lithium coin cells which can work for years. Usually, CR2032 coil cells are used.
At the center of the DS1307 RTC module is an 8-pin DS1307 chip. It provides a real-time clock that is used to keep track of seconds, minutes, hours, days, months, and years. It uses the I2C communication protocol for communicating with other devices like in our case we are using Arduino. Arduino reads values of time and date from DS1307 using the I2C communication protocol. Moreover, it also has a feature to keep a record of the exact time in case of power failure with the help of a backup battery. It is used to make a real-time clock using some other electronic components.
VBAT: Connect a CR2032 coil cell as backup power. Its value should be between 3-5 volt. voltage more than 5 volts may burn DS1307 permanently. A backup battery is used to keep track of time in case of power failure.
SQW pin provides square waves of different frequencies such as 1Hz, 4kHz, 8kHz, or 32kHz. The frequency of output wave can be selected by sending a signal to DS1307 over an I2C bus.
If you want to use this IC directly with Arduino, you need to use external components to connect with DS1307. The following circuit diagram shows the connections of all required components with DS1306:
DS1307 RTC module has all onboard components which are required for the correct functionality of a DS3107 chip. On top of that, it contains a holder to connect a 20mm 3V lithium coin cell. This holder can contain any CR2032 battery. Now let’s discuss the components of this module one by one.
At the center of the DS1307 RTC module is a chip which we have discussed earlier. This chip keeps track of seconds, minutes, hours, days, and months. At the end of every month, this chip automatically adjusts its seconds, minutes, hours, and date. It is also possible to configure time display in 12-hour with an AM and PM or 24-hour format.
As discussed earlier, the DS1307 chip requires 32KHz of an external crystal oscillator for its operation (time-keeping). Therefore, the RTC module comes with 32KHz of an external crystal oscillator.
But there is one problem with this 32KHz crystal oscillator that is a change in environmental temperature affects the oscillation frequency of the crystal oscillator. This change in 32KHz of external crystal oscillation frequency is negligible. But it shows an error in the long run. It gives a clock drift of 2-3 minutes per month.
DS1307 RTC module also contains onboard 24C32 EEPROM. This EEPROM can store 32 bytes and have limited read-write operations. We can use this memory to save time when we want to use an RTC module for Alarm based projects. For example, we want to set an alarm at 8:00 AM every day. We can save this time value into EEPROM and whenever the time matches with this saved value, an alarm starts.
These EEPROM chips also communicate with microcontrollers or Arduino over the I2C bus. Hence, it shares the same I2C bus as DS1307. Different slave addresses are assigned to EEPROM (o 0x50 Hex) and DS1307 chip to communicate with them on the same I2C bus.
On the back side of a RTC module, there is a holder to connect the CR2032 coil cell. This backup battery is used to keep track of time accuracy even when the main power source which is connected to DS1307 fails. This chip contains a power sensing circuitry which senses the main power and whenever the main power shutdown, it switches to the backup coil cell.
In backup mode, DS1307 consumes only 300nA current. That means a backup battery based on a coin cell can work for more than 17 years. Because, generally, the capacity of CR2032 battery is 47mAh and chip consumes only 300nA when powers through a battery.
There is an empty slot available on this module to connect an external DS18B20 digital thermometer. The three empty pinouts in the bottom right corner is a place holder for the DS18B20 sensor and output of the sensor can be received from DS pin of RTC module.
The following figure shows the pinout diagram. This module exposes a total of 7 pins out of which two are power supply pins and two are for SCL and SDA pins for the I2C communication bus. We have already seen the functionality of all these pins in the previous sections.
But it demands an exercise to write code from scratch. Luckily, an Arduino RTCliblibrary is available, which implements callback functions to get time measurements from an RTC module. This library hides all the complexity to interact with an RTC module over I2C communication. We can use simple callback functions implemented by RTClib to read data from DS1307.
To apply this library, first, we need to install this library in Arduino IDE by going to Arduino’s library manager. Open Arduino IDE, go to Tools > Manage Libraries.
After that, this window library manager window will appear. Search for “RTClib” by typing in the search bar. You will see many options for DS1307. But the one that we will use in this tutorial is RTClib by Adafruit. Select RTClib by Adafruit and click on the install button.
When you click on the install button, you may get a message that RTClib may require other libraries dependencies which is currently not installed in your Arduino IDE. We recommend you to install all dependencies by clicking on install button. Otherwise, RTClib will not work properly.
In your Arduino IDE, open up the serial monitor and set the baud rate to 115200. The serial monitor will start displaying the current date and time along with future date and time and time since midnight of 1/1/1970.
In this section, we will see a proteus simulation of DS1307 RTC module by using all external components and display the value of time and data on 16×2 LCD.
The following circuit shows the connections of DS1307chip along with external components with an Arduino. SCL and SDA pins of DS1307 are connected with SCL and SDA pins of Arduino. If you have already gone through the above-mentioned article on LCD interfacing with Arduino and other basic articles to get a know-how of Arduino, you can easily understand the following circuit.

Sometimes it may be necessary to use a display while making a hardware project, but the size and the type of the display may vary according to the application. In a previous project, we used a 0.96″ I2C OLED display, and in this project we will have an I2C 20×4 character display.
This liquid crystal display has 4 lines, 20 character in each line and cannot be used to display graphics. The main feature of this display that it uses I2C interface, which means that you will need only two wires to connect with Arduino. At the back side of the screen there is a small PCB soldered in the display, this circuit is a serial LCD 20 x 4 module and it also has a small trimpot to adjust the contrast of the LCD.
Display’s backlight is blue and the text is white. It is fully compatible with Arduino and has 5V input voltage. Its I2C address could be 0x27 or 0x3F. You can get it for about $7 from Bangood store.
DS3231 is a low-cost, accurate I2C real-time clock (RTC), with an integrated temperature-compensated crystal oscillator (TCXO) and crystal. The device incorporates a battery input, so that if power is disconnected it maintains accurate time.
RTC maintains seconds, minutes, hours, day, date, month, and year information. Less than 31 days of the month, the end date will be automatically adjusted, including corrections for leap year. The clock operates in either the 24 hours or band / AM / PM indication of the 12-hour format. Provides two configurable alarm clock and a calendar can be set to a square wave output. Address and data are transferred serially through an I2C bidirectional bus.
This RTC module operates at input voltage range between 3.3V and 5.5V, so it can be connected with 3.3V or 5V pins. It is available on Banggood store for about $2.
First we need to download the library of the display, which includes all required functions to configure and write on the display. You can find it here.
Unzip the library and add it to the Arduino libraries folder, then run Arduino IDE and copy the following code. The first two lines are to include both of I2C and LCD libraries.
lcd.setCursor(3,0) will set the cursor of the LCD in the specified location, the first argument for the column and the second for the row starting form 0.
Here we will use a small breadboard to connect the RTC module and display with the Arduino’s I2C pins (A4 and A5). The SCL pins are connected with analog 5 pin and the SDA pins with analog 6 pin. The top rail of the breadboard used as I2C bus and the bottom one is power bus.
In addition to setup and loop function, we will create four other functions to organize the code. As the corners and vertical lines of the frame are special characters, we have to create them manually. So we will use a function to create them and another one to print them on the LCD.
Inside the loop function the time will be read from the real time clock module and the printed to the LCD using a custom function for each of time and date.
At first, we have to include the three libraries, I2C, LCD, and RTC and set the LCD address. Inside the setup function the display is initialized, then we will call createCustomCharacters() function and print them.
Each character can be 5-pixel long in width and 8-pixel in height. So to create a custom character we need to create a new byte. We need 5 characters, the vertical line and the four corners. The yellow pattern shows you how the character will be displayed on the LCD.
Inside createCustomCharacters() function, we called lcd.createChar(#, byte array) function. The LCD supports up to 8 custom characters numbered from 0 to 7. It will assign the index in the first argument to the character given by the byte array. To print this character we can use lcd.write(byte(#)) function.
This function is very simple, it uses lcd.setCursor(#,#) to move the cursor and lcd.print(“”) to print the given string. The function will print the top and bottom horizontal lines, then printing other custom characters.
As we discussed earlier, the loop function will get the current time and date every second and refresh them on the display. First we defined a time element “tm” which has current time data, then if the time is correct and the RTC module working fine the time and date will be printed.
We can add some instructions so, if the DS1307 is stopped or there is a circuit error,we can light a LED to indicate the problem. The loop will wait for 1 second before starting the next iteration.
PrintTime function uses three arguments, the column and line where it will print the time, and the time element. lcd.print(tm.Hour) will print the hour, then if the minutes and seconds are less than 10 we will add 0 to the left. And the same method is used to print the date.
Now everything is ready, upload the code to your Arduino and enjoy watching your new clock. You can find the full Arduino sketches and libraries in the attachment below.

This post shows a simple real time clock and calendar example using an Arduino UNO board and DS1307 RTC chip where time and calendar are displayed on 1602 LCD screen and it can be set with two push buttons.
The DS1307 is an IC (integrated circuit) which has only 8 pins, it’s low cost, easy to use and it has the ability to count time and date in real time (more details are in the datasheet).
In the circuit there are 2 push buttons (B1 & B2) connected to pins 8 and 9 respectively, the two push buttons are used to set time date parameters (minutes, hours, date, month and year). Button B1 selects the parameter and B2 increments the selected parameter.
Arduino real time clock with DS1307 code:The Arduino code below doesn’t use any library for the DS1307 RTC, the Wire library is for the communication between the Arduino and the DS1307 using I2C protocol.
void blink_parameter() : this small function works as a delay except that it is interrupted by the buttons B1 (connected to pin 8) and B2 (connected to pin 9). When called and without pressing any button the total time is 10 x 25ms = 250ms. With this function we can see the blinking of the selected parameter with a frequency of 2Hz. So a delay of 250ms comes after the print of the selected parameter and after that delay a 2 spaces is printed which makes the parameter disappears from the LCD and another 250ms delay comes after the print of the 2 spaces.
Downloads:To be able to simulate this example, Proteus needs the Arduino library which can be downloaded from the link below. After extracting the files (ARDUINO.IDX and ARDUINO.LIB) put it in the Library folder (ex: C:\Program Files\Labcenter Electronics\Proteus 8 Professional\LIBRARY):

DS1307 Real Time Clock are widely available low cost I2C RTC modules. They come with a clock and a small battery, and when connected to Arduino, can keep track of real time even when the Arduino board is not powered. I already wrote some Instructables with DS1307. Some of you have asked, how to display the Date and Time on LCD Display.
In this Instructable, I will show you how to connect DS1307 I2C RTC Module, and I2C LCD Display to Arduino, and program it with Visuino to read and display the date and time. I will use the Tiny RTC Module that I have, but it should be very much the same with any other DS1307 Module.
Connect the Female end of Female-Male Power(Red wire), SDA(Green wire), and SCL(Yellow wire) to the LCD Module (Picture 1), and leave the Male ends unconnected
Connect the Female end of another Female-Male wire(Green wire) to SDA/Analog pin 4 of the Arduino Nano board(Picture 2), and leave the Male end unconnected
Connect the Female end of another Female-Male wire(Yellow wire) to SCL/Analog pin 5 of the Arduino Nano board(Picture 2), and leave the Male end unconnected
Connect the Female end of anotherFemale-Male Power wire(Red wire) to the 5VPower pin of the Arduinoboard(Picture 2), and leave the Male end unconnected
Connect the Female end of Female-Male Power(Red wire), SDA(Green wire), and SCL(Yellow wire) to the DS1307 RTC Module (Picture 1), and leave the Male ends unconnected
Connect the Male ends of the 3 Power wires(Red wires) - from the Display, the RTCModule, and the Arduino togetheras example with the help of a Breadboard (Picture 1) - In my case I used a small Breadboard
First we need to add components to control the RTC and the LCD Display. The RTC provides Date/Time data. To Display it the way we want, we need to decode it into Integer fields, and for this we will use Decode Date/Time component:Type "lcd" in the Filter box of the Component Toolbox then select the "Liquid Crystal Display (LCD) - I2C" component (Picture 1), and drop it in the design area
If necessary you may need to change the default Address of the LCD by setting the "Address" property. Check this Instructable on how you can find the address of an I2C device
Type "rtc" in the Filter box of the Component Toolbox then select the "Real Time Clock(RTC) DS1307" component (Picture 3), and drop it in the design area
In the Elements Editor select the "Value" element on the right, and then click on the "+" button on the left (Picture 3) 13 times to add 13 elements (Picture 4)
Continue setting the "Value" properties for the rest of the Elements to "Mar", "Apr", "May", "Jun", "Jyl", "Aug", "Sep", "Oct", "Nov", "Dec" (Picture 6)
To display the Date/Time nicely in the LCD we will need to add some fields with the separation text, and the Date/Time values for day, month, year, hours, minutes, and seconds.
First we will add text to form the separation between the Date elements:Click on the "Tools" button of the LiquidCrystalDisplay1 component (Picture 1) to open the elements editor (Picture 2)
Connect the "Day" output pin of the DecodeDateTime1 component to the "In" input pin of the IntegerField1 element of the LiquidCrystalDisplay1 component (Picture 1)
Connect the "Out" output pin of the Array1 component to the "In" input pin of the TextField2 element of the LiquidCrystalDisplay1 component (Picture 3)
Connect the "Year" output pin of the DecodeDateTime1 component to the "In" input pin of the IntegerField2 element of the LiquidCrystalDisplay1 component (Picture 4)
Connect the "Hour" output pin of the DecodeDateTime1 component to the "In" input pin of the IntegerField3 element of the LiquidCrystalDisplay1 component (Picture 1)
Connect the "Minute" output pin of the DecodeDateTime1 component to the "In" input pin of the IntegerField4 element of the LiquidCrystalDisplay1 component (Picture 2)
Connect the "Second" output pin of the DecodeDateTime1 component to the "In" input pin of the IntegerField5 element of the LiquidCrystalDisplay1 component (Picture 3)

To calculate the overall star rating and percentage breakdown by star, we don’t use a simple average. Instead, our system considers things like how recent a review is and if the reviewer bought the item on Amazon. It also analyzed reviews to verify trustworthiness.

Hi, and welcome to this tutorial, it’s about another RTC (Real Time Clock) module, it’s the DS1307, previously I did a tutorial about the DS1302, and a project where I set it up using a keypad, then an Alarm Clock project based on that module, I also did a tutorial about the DS3132.
But today we’re about the DS1307, and I’m gonna use it with Arduino UNO board and I’ll also use a LCD i²c screen and OLED display, to show time and date in different formats.
“The DS1307 serial real-time clock (RTC) is a lowpower, full binary-coded decimal (BCD) clock/calendar plus 56 bytes of NV SRAM. Address and data are transferred serially through an I2C, bidirectional bus. The clock/calendar provides seconds, minutes, hours, day, date, month, and year information. The end of the month date is automatically adjusted for months with fewer than 31 days, including corrections for leap year.”
OLED libraries: – Download here Adafruit OLED SSD1306 library – Download here Adafruit GFX Library
Important !! First time you must wire the module and upload the “SetTime” example, it sets the module to the compiling time of the code which is technically your real time and date.
N.B: If you are testing the module with multiple things it’s better to close the “SetTime” example, open it again and upload to the board, otherwise your module will be programmed with the first time the “SetTime” example was compiled, and you may think that your module doesn’t work well !!

This is an Arduino based digital Clock to display real time on a 16x2 LCD using a DS1307RTC module. The date and time can be set via serial interface or push button switches.
Time library adds timekeeping functionality to Arduino with or without external timekeeping hardware. This library is often used together with TimeAlarms and DS1307RTC.
The LCD Keypad shield includes 6 momentary push buttons and a blue backlight LCD which can display two row of 16 characters. The buttons are connected to only one analog input (A0) in order to saving on input/output pins.
The DS1307 serial real-time clock (RTC) is a low- power, full binary-coded decimal (BCD) clock/calendar plus 56 bytes of NV SRAM. DS1307 works on I2C protocol which can interfaces to most microcontrollers.
A 3 volt lithium coin cell battery (CR2032) is connected to the DS1307 which keeps time running after electricity failure. The DS1307 has a built-in power-sense circuit that detects power failures and automatically switches to the backup supply. The module also include a 24C32 32K I2C EEPROM which is not using in this project.

In the Arduino Real Time Clock Tutorial, we will learn about Real Time Clock (RTC) and how Arduino and Real Time Clock IC DS1307 are interfaced as a time keeping device. If you recall, we have already implemented an Arduino Alarm Clock using RTC DS1307 in an earlier project.
But that project didn’t cover the basics of Real Time Clock or RTC, the specifications of DS1307 RTC IC and how to interface a Real Time Clock like DS1307 or DS3231 with Arduino.
An RTC or Real Time Clock is a Timekeeping device, usually in the form of an Integrated Circuit (IC). An RTC is battery powered and keeps track of the current time even when there is no power.
Real Time Clock ICs are present in computers, servers, many embedded systems and in fact they are used wherever it is required to keep an accurate time.
Even though Arduino and almost all microcontrollers have built-in timers and timekeepers (millis () in case of Arduino), they are power dependent i.e. they run as long as there is power supply. Once the power is turned off (manually or due to power outage), all the timers are reset to 0.
While timekeeping using internal timers is acceptable for simple projects, we need an alternative in projects like data loggers, clocks, alarms, etc. where the timer runs independently irrespective of the external power or if the Microcontroller (or Arduino) is reprogrammed.
Here comes the use of Real Time Clock ICs. Almost all RTC ICs are low-current devices that run for years on a single lithium cell (usually CR2032). One of the popular and most commonly used RTC ICs is the DS1307 Real Time Clock.
The DS1307 RTC is a low cost, low power real time clock IC that can maintain full clock and calendar i.e. hours, minutes, seconds as well as year, month and day. Some of the well-known features of the popular DS1307 RTC are mentioned below.
DS1307 RTC is available as modules, which consists of all the necessary components like Battery, connectors, pull-up resistors and crystal. One such module is used in this project and is shown below.
The following image shows the pin diagram of the DS1307 RTC IC. In order to reduce the power consumption, the number of pins on the IC has to be reduced. Hence, DS1307 RTC used I2C Communication.
X1 and X2: These are pins for connecting the crystal of frequency 32.768 KHz to enable the internal oscillator. If an external oscillator is connected to X1, then X2 can be left floating.
Now that we have seen a little bit about the Real Time Clock IC DS1307, we will proceed with the interface of Arduino and Real Time Clock. As mentioned earlier, the DS1307 RTC Module uses I2C Communication.
In the Arduino Real Time Clock I2C interface, the Arduino Microcontroller always acts as Master and the DS1307 acts as Slave. The Master in I2C Communication i.e. Arduino in this case, is responsible for clock signal, bus access, start and stop signals.
The following image shows the circuit diagram of the Arduino Real Time Clock DS1307 Interface. This circuit explains just the basic connections with respect to a DS1307 Module (a board that contains the DS1307 IC along with the crystal, Battery and pullup resistors).
In order to understand better about the DS1307 RTC Module, the following image will help you as it contains the circuit of a typical DS1307 Real Time Clock Module.
The design of the Arduino RTC Interface is quite straight forward. Connect the SDA and SCL pins of the DS1307 RTC to the SDA and SCL pins of Arduino i.e. pins A4 and A5.
A simple project where Arduino UNO is interfaced with DS1307 Real Time Clock is implemented here. In this project, we will be programming the DS1307 RTC with current date and time and see whether it actually keeps that data even if the power supply to Arduino is removed.
A special library called “RTClib” is used in the programming and it can be downloaded from this link. Make sure that it is downloaded first and added to the Arduino library database.
In order to upload the data and time into the DS1307 RTC IC, we have used a feature available in the RTClib library, where the Arduino will upload the date and time from the computer while uploading the code.

Now that I look again, you are right... BUT.. the actual address is 0x3F! I"m not sure that makes sense either but because I believe the lowest bit is considered the R/(not)W bit. Since its a write only device, I"d think it should be ox3E if anything, but that"s the address needed, so I guess the LCD library I"m using overrides the low bit. And now that you mention it, I see that the board does have places for jumpers (or zero hom SMD parts) to further configure the address. It means I can now drive multiple displays (up to 8) if I even needed to.
Very interesting Thanks! So the likelihood of two devices with completely different purposes using the same addess range is fairly low, and like my DS1882 audio pot chips, they will usually allow the user to configure 3 bits within the lower nibble of the address.
For an i2c based clock/RTC module would use a DS3231 instead of a DS1307. The price is about the same and it is much more accurate. DS3231 modules on ebay (starting at just under $1.50 USD shipped) are cheaper than the price shown on that link you provided to the DS1307.
You do need to be careful with most of these low cost RTC modules in the they have a little charging circuit on them for using with a LIR2032. If you use a 2032 instead, you should cut a trace on the module to disable the charging circuit.
Well that one I linked seems very convenient, and I probably wouldn"t need even 1/10th of it current functions. But I"ll investigate the S3231 too! For my projects, I just need a way to re-set the time if power has been lost for a while. Currently I detect eminent power fail, save the current time in EEprom, and retrieve it on power up. This is just to survive very typical power losses that only last minutes, without resetting to a stupid time like 12:00AM like most household devices do. But I"ll never need millisecond accuracy for any current projects.
And yes... I"ve been meaning to check out those nifty esp8266 modules too, for other projects. I was wondering though (even though its another subject), can they be used without coding them, just using external commands? I"m thinking of the major hassles and expense getting any kind of FCC approval, should I ever use such a module in a product. From my research, if a module has already passed FCC muster with its existing code, and you don"t alter its code, you may have a slightly cheaper path to approval.

Antigua and Barbuda, Aruba, Australia, Austria, Bahamas, Bahrain, Bangladesh, Barbados, Belgium, Belize, Bermuda, Bolivia, Brazil, Brunei Darussalam, Bulgaria, Cambodia, Canada, Cayman Islands, Chile, China, Colombia, Costa Rica, Cyprus, Czech Republic, Denmark, Dominica, Dominican Republic, Ecuador, Egypt, El Salvador, Estonia, Finland, France, French Guiana, Germany, Gibraltar, Greece, Grenada, Guadeloupe, Guatemala, Guernsey, Honduras, Hong Kong, Hungary, Iceland, Indonesia, Ireland, Israel, Italy, Jamaica, Japan, Jersey, Jordan, Kuwait, Latvia, Liechtenstein, Lithuania, Luxembourg, Macau, Malaysia, Maldives, Malta, Martinique, Mexico, Monaco, Montserrat, Netherlands, New Zealand, Nicaragua, Norway, Oman, Pakistan, Panama, Paraguay, Peru, Philippines, Poland, Portugal, Qatar, Republic of Croatia, Reunion, Romania, Saint Kitts-Nevis, Saint Lucia, Saudi Arabia, Singapore, Slovakia, Slovenia, South Africa, South Korea, Spain, Sri Lanka, Sweden, Switzerland, Taiwan, Thailand, Trinidad and Tobago, Turks and Caicos Islands, United Arab Emirates, United Kingdom, United States, Vietnam

This is a very simple project using only a few components. In this project Both LCD and RTC are on a common I2C bus.The code can be downloaded from there if ...

DS1307 with 8051 Development Board buy including USB Programmer, Li(Lithium) 3V Coin Battery,16×2 LCD Display,On-Board MAX232, and AT89S52 Microcontroller IC
DS1307 with 8051 Development Board Buy from India to learn How to interface RTC DS1307 with 8051 Project Kit & display real-time cloak, alarm on 16×2 LCD. Real-Time Clock RTC DS1307 interfacing with 8051 Microcontroller can be executed using I2C or IIC Serial Protocol. it also supports All Digital Microcontroller such as Arduino, 8051, PIC, AVR, PIC, ARM, MSP, COP8, STM.8051 Development Board with LCD Project Kit Support AT89S51, AT89S52, P89V51RD2, etc. 40-Pin DIP Chip.USB Programmer can be used for both 8051-AVR IC (2in1).16×2 LCD Display has Yellow Back-light.
If you are learning microcontroller programming and want to make a project based on 8051 microcontrollers then this DS1307 with 8051 development board buy online with LCD and
First of all 16×2 LCD is a basic 16 character by 2 line display Yellow/Green Backlight. Utilizes the extremely most common HD44780 parallel interface chipset (datasheet). Even more, it has JHD162A Compatible Pin-out Diagram, so the Command Interface code is freely available. Finally, You will need 7 general I/O pins (If used in 4-bit Mode) to interface to this LCD screen. it also includes an LED backlight. Learn How To Interface 8051 Development Board with LCD 16×2 Display using 8051/AVR USB Programmer for Burn/Flash Hex File into Atmel AT89S52 Microcontroller. The hobbyist can learn the interfacing of DS1307 with 8051 Development Board Buy along with 16×2 LCD.
Features of 16×2 Display LCD:Commonly Used in Student Project, College, copiers, fax machines, laser printers, industrial test equipment, networking equipment such as routers and storage devices
This is the DS1307 Real Time Clock (RTC) Module, this small breakout board that uses the most popular DS1307 to keep track of the current year, month, day as well as current time. The module comes fully assembled and includes a small Lithium coin cell battery that will run the RTC for a minimum of 9 years without an external 5V Power supply. The DS1307 RTC is accessed via I2C Protocol. Finally DS1307 with 8051 Development Board Buy online is the easiest way for Electronics engineers to collect necessary components in a time-efficient way.
USB AVR and AT89Sxx ISP (In System programming) Programmer is a low-cost USB-based programmer. Because it is ISP, so there is no need to take out the target microcontroller from the development Board. This programmer will work with a wide variety of Atmel AVR and also AT89Sxxxx microcontroller. This is quite compact, but the design is really elegant. Even more, The USB interface is achieved by using an atmega8 processor, and the rest is done in firmware.USB Programmer is used to loading Hex file, for example, suppose interfacing code Hex file of DS1307 with 8051 Development Board Buy with 16×2 Lcd and ISP Programmer.
Download Link:(All in 1 RAR file) For How to install driver | Circuit Diagram | Connection | Program 8051 AVR Microcontroller | Driver For All Windows OS 64-bit & 32-bit

A smart relay for the Arduino that allows programming of 10 time based alarms and one voltage based alarm (for overvoltage/ under voltage protection). Also uses DS1307 RTC to keep time, and allows the user to reset the time if the RTC loses time.
Ms.Josey
Ms.Josey