In this project, I am going to produce a digital clock which uses 7 segment displays to display the time. Besides of using 7 segment displays, Liquid Crystal Display (LCD) is also used to allow feature selections and menu navigation purpose. I am using a popular platform, Arduino with Atmega328P as the microcontroller for this project. The clock information will be obtained from Real Time Clock (RTC) IC which is DS1307.
Besides of displaying the time, the digital clock in this project also have extra features such as alarm, thermometer, stopwatch and timer. Stopwatch and timer are actually functions usually available in watch but we try to integrate it together with digital clock. Another extra feature that are available in this project is that instead of using normal button for user interface, I used TV remote to control the functions of digital clock, this provides a wireless control.
If you want to see how this project works, go to step 11 for video.
Step 1: Hardware
Bill of materials:
- DIY Arduino Uno
- DS1307 Real Time Clock IC
- 3V Lithium Battery
- CR 2032 Batter Holder
- 74HC595 Shift Register
- Common Anode 7 Segment Display
- 2N3904 NPN Transistor
- LM 35 Temperature Sensor
- TSOP 4838 IR Receiver
- TV Remote
- 16x2 Liquid Crystal Display
Step 2: DIY Arduino Uno
Some of the features of Arduino Uno:
• Operating Voltage: 5V
• Digital I/O Pins: 14 (6 provide PWM output)
• Analog Input Pins: 6
• Flash Memory: 32KB (Atmega 328P) of which 0.5KB is used by bootloader
• SRAM: 2KB (Atmega 328P)
• EEPROM: 1KB (Atmega 328P)
• Clock Speed: 16MHz
Instead of using the original Arduino Uno, I made myself my own Arduino Uno. The method is simple and there are a lot of guide on how to make your own Arduino and how to make your own PCB.
Step 3: DS1307 Real Time Clock
The DS 1307 that I used has been made onto a DIY PCB with 3V Lithium Backup Battery. This allow easy use for variety of projects.
One of the benefits of using DS1307 is that it can be connected to a backup supply. A 3V, CR2032 Lithium battery is used as the backup supply for DS1307. Whenever the built in power sense detects power failures, it will switch to backup supply and continue the time keeping operation. In other words, the user no needs to worry the loss of time information even if the main controller is being switched off.
DS1307 is controlled using Inter- Integrated Circuit (I2C) communications. I2C uses only two bidirectional open drain line, which are Serial Data Line (SDA) and Serial Clock Line (SCK). Since the data and clock line are open drain, pull up resistor is required to ensure the logic system settle at expected logic level. Open drain output means that the device can drive its output low but cannot drive it high. SDA is used to transfer data between master and slave, while SCK is used to synchronize all the data transfer over I2C bus.
How to use DS 1307 with Arduino: http://iamzxlee.wordpress.com/2013/06/27/ds1307-real-time-clock-rtc/
Step 4: 7 Segment Display
Since there are 7 segment displays is used, a total of 48 pins is required to individually control each segments. The solution for this huge number of IO pins is by using 74HC595 Shift Register to expand for more output pins. In this case, two shift registers is used to control six digits of 7 Segment Displays.
First shift register has 8 output pins which are used to control each segments whereas second shift register is used to control the common pin of 7 segments display.
How to use 7 segment display with Arduino: http://iamzxlee.wordpress.com/2013/07/08/7-segment-display/
Step 5: 16x2 LCD
How to use Liquid Crystal Display with Arduino: http://iamzxlee.wordpress.com/2013/07/05/liquid-crystal-display-lcd-hd-44780/
Step 6: 74HC595 Shift Register
In this project, three 74HC595 is being used, one to control each segments of 7 segment display, second to control each digit of 7 segment display and third is to control the LCD display.
Step 7: TSOP 4838 IR Receiver
Different remote controls have their own IR remote protocol. Therefore, to ease the job of getting the information, I use the IRremote library from Ken Shirriff. I just need to decode the results from IR receiver and use it for specific function.
Step 8: LM 35 Temperature Sensor
How to use LM 35 with Arduino: http://iamzxlee.wordpress.com/2013/07/01/temperature-sensor-lm35/
Step 9: Schematic Diagram
Step 10: Project Explanation
When the user pressed ‘menu’ button on the TV remote, the LCD will display the selection for menu function. The functions available are alarm, timer, stopwatch and settings. User can navigate through each function by the ‘+/-‘ button. Whenever the user decides a function, the user can press the ‘select’ to enter that particular function.
For the alarm function, the user can first set the alarm time. To set each value, the user can use the number button on the TV remote. User also has to set the ‘ON/OFF’ to either enable or disable the alarm. The alarm will be check every time the program reads from DS1307 whether the time matches. If the alarm time reaches, the buzzer will sounds repeatedly until the user press the TV remote to disable it.
For the timer function, the user first needs to set the countdown timing. Again, the user can set the timing by using the number button on TV remote. To start the countdown, ‘select’ button has to be pressed. The programs will countdown based on the time set until it reaches ‘00.00.00’. At this time, the buzzer will sounds indicate the time reached. In order to disable the buzzer, the user has to press the ‘menu’ button.
For the stopwatch function, the user just need to press the start button, then it will start count up. If the user presses the start button again, it will stop the counting. Basically, the start button is like a toggle switch to control the stopwatch function.
The final function is settings function, where the user can set the time, date and control LCD backlight. The user able to set the time and date, then it will write on the DS1307 chip. The program also allows the user to either turn on or off the LCD backlight. The purpose of adding is that the user can turn off the backlight when it is not needed and for energy saving.
Step 11: Video
Link of this project on my blog: http://iamzxlee.wordpress.com/2013/12/20/digital-clock-using-7-segment-display-with-tv-remote/
If your have any suggestions or questions, feel free to comment below. I will try my best to answer your question.