Advanced Design of Smart Digital Application Using PIC 16F887A Microcontroller and DS 1307 RTC

Similar documents
Nixie Clock Kit IN-12B color LED backlit Operation Manual Nixie Clock Kit IN-12B V6.0 ( All Right Reserved 2015 )

LOW COST DIGITAL BASIC MATHEMATICS RULES LEARNER KIT

Digital IC Tester by Using PIC18F4550

Keyboard Controlled Scoreboard

ECE 372 Microcontroller Design

Digital Clock. Perry Andrews. A Project By. Based on the PIC16F84A Micro controller. Revision C

Published in A R DIGITECH

Hello and welcome to this training module for the STM32L4 Liquid Crystal Display (LCD) controller. This controller can be used in a wide range of

Digital Stopwatch Timer Circuit Using 555timer and CD4033

DRAFT Microprocessors B Lab 3 Spring PIC24 Inter-Integrated Circuit (I 2 C)

ECB DIGITAL ELECTRONICS PROJECT BASED LEARNING PROJECT REPORT ON 7 SEGMENT DIGITAL STOP WATCH USING DECODER

Digital (5hz to 500 Khz) Frequency-Meter

Experimental Study to Show the Effect of Bouncing On Digital Systems

Data Conversion and Lab (17.368) Fall Lecture Outline

NORTHWESTERN UNIVERSITY TECHNOLOGICAL INSTITUTE

Digital Systems Based on Principles and Applications of Electrical Engineering/Rizzoni (McGraw Hill

Combinational vs Sequential

uresearch GRAVITECH.US GRAVITECH GROUP Copyright 2007 MicroResearch GRAVITECH GROUP

Experiment 3: Basic Embedded System Analysis and Design

Telephony Training Systems

Microcontroller Based Emergency Service Console

ADC Peripheral in Microcontrollers. Petr Cesak, Jan Fischer, Jaroslav Roztocil

Figure 30.1a Timing diagram of the divide by 60 minutes/seconds counter

8 PIN PIC PROGRAMMABLE BOARD (DEVELOPMENT BOARD & PROJECT BOARD)

Copyright 2011 by Enoch Hwang, Ph.D. and Global Specialties. All rights reserved. Printed in Taiwan.

DESIGN AND DEVELOPMENT OF A MICROCONTROLLER BASED PORTABLE ECG MONITOR

EXPERIMENT 2: Elementary Input Output Programming

RF4432 wireless transceiver module

Design of VGA and Implementing On FPGA

Combo Board.

Multipurpose Robot. Himanshu Gupta 1, Mohammad Shahid 2

Comparing JTAG, SPI, and I2C

16 Stage Bi-Directional LED Sequencer

A NOVEL INTELLIGENT SYSTEM FOR EFFICIENT QUEUE MANAGEMENT

IOT BASED ENERGY METER RATING

Embedded System Training Module ABLab Solutions

BUSES IN COMPUTER ARCHITECTURE

SAL Series Wireless Clock (V1)

Chapter 9 MSI Logic Circuits

Review : 2 Release Date : 2019 Last Amendment : 2013 Course Code : SKEE 2742 Procedure Number : PK-UTM-FKE-(0)-10

Rfid Based Attendance System

Telephony Training Systems

Prototype Model of Li-Fi Technology using Visible Light Communication

International Journal of scientific research and management (IJSRM) Volume 1 Issue 6 Pages Website: ISSN (e):

6.111 Project Proposal IMPLEMENTATION. Lyne Petse Szu-Po Wang Wenting Zheng

A Directional Indicator with a Symbol Based Interface for improvised Safety-Enhanced Directional Indicators using Matrix LED

Digital Fundamentals. Lab 5 Latches & Flip-Flops CETT Name: Date:

Section 24. Programming and Diagnostics

SAPLING MASTER CLOCKS

LED Array Board.

A MISSILE INSTRUMENTATION ENCODER

SXGA096 DESIGN REFERENCE BOARD

RF4432F27 wireless transceiver module

UNIT V 8051 Microcontroller based Systems Design

FLIP-FLOPS AND RELATED DEVICES

MODULAR DIGITAL ELECTRONICS TRAINING SYSTEM

SignalTap Plus System Analyzer

Embedded Systems Lab. Dynamic Traffic and Street Lights Controller with Non-Motorized User Detection

STATIC RANDOM-ACCESS MEMORY

Preliminary Design Report. Remote Fencing Scoreboard Gator FenceBox

University of Pennsylvania Department of Electrical and Systems Engineering. Digital Design Laboratory. Lab8 Calculator

SAPLING WIRED SYSTEM

PDW MARTHEL S.C. ul. Sosnowa 24-5, Bielany Wrocławskie Kobierzyce, POLAND tel , 12; fax MART-02:

Experiment # 12. Traffic Light Controller

TV Synchronism Generation with PIC Microcontroller

ARM HOW-TO GUIDE Interfacing Traffic Light with LPC2148

Although the examples given in this application note are based on the ZX-24, the principles can be equally well applied to the other ZX processors.

Color Programmable Control Board

TRIMBLE GPS / 10MHz REFERENCE MONITOR DISPLAY V January 2015

E90 Proposal: Shuttle Tracker

TV Character Generator

Department of Electrical and Computer Engineering University of Wisconsin Madison. Fall Final Examination CLOSED BOOK

PRE J. Figure 25.1a J-K flip-flop with Asynchronous Preset and Clear inputs

Sharif University of Technology. SoC: Introduction

Introduction. The Clock Hardware. A Unique LED Clock Article by Craig A. Lindley

CONVOLUTIONAL CODING

LAB #6 State Machine, Decoder, Buffer/Driver and Seven Segment Display

Section 24. Programming and Diagnostics

14 GHz, 2.2 kw KLYSTRON GENERATOR GKP 22KP 14GHz WR62 3x400V

Laboratory Exercise 7

MUHAMMAD NAEEM LATIF MCS 3 RD SEMESTER KHANEWAL

PHYSICS 5620 LAB 9 Basic Digital Circuits and Flip-Flops

DESIGN AND ANALYSIS OF COMBINATIONAL CODING CIRCUITS USING ADIABATIC LOGIC

Pattern Based Attendance System using RF module

Electronic Grocery Machine

Application Note. Serial Line Coding Converters AN-CM-264

EE 367 Lab Part 1: Sequential Logic

DIGITAL ELECTRONICS: LOGIC AND CLOCKS

Spring 2011 Microprocessors B Course Project (30% of your course Grade)

Triple RTD. On-board Digital Signal Processor. Linearization RTDs 20 Hz averaged outputs 16-bit precision comparator function.

Report on 4-bit Counter design Report- 1, 2. Report on D- Flipflop. Course project for ECE533

International Journal for Research in Applied Science & Engineering Technology (IJRASET) Trespass Prevention System Using IOT

CSCB58 - Lab 4. Prelab /3 Part I (in-lab) /1 Part II (in-lab) /1 Part III (in-lab) /2 TOTAL /8

Senior Design Project: Blind Transmitter

Chapter 5 Flip-Flops and Related Devices

Computer Systems Architecture

SDA 3302 Family. GHz PLL with I 2 C Bus and Four Chip Addresses

Logic Analyzer Auto Run / Stop Channels / trigger / Measuring Tools Axis control panel Status Display

University of Illinois at Urbana-Champaign

IJMIE Volume 2, Issue 3 ISSN:

Transcription:

American Journal of Embedded Systems and Applications 2018; 6(1): 30-36 http://www.sciencepublishinggroup.com/j/ajesa doi: 10.11648/j.ajesa.20180601.15 ISSN: 2376-6069 (Print); ISSN: 2376-6085 (Online) Advanced Design of Smart Digital Application Using PIC 16F887A Microcontroller and DS 1307 RTC Mohammad Salim Raza 1, Raihana Zannat 2, Ohidujjaman 3 1 Department of Electrical and Electronic Engineering, Hamdard University Bangladesh, Munshiganj, Bangladesh 2 Department of Software Engineering, Daffodil International University, Dhaka, Bangladesh 3 Department Computer Science and Engineering, Daffodil International University, Dhaka, Bangladesh Email address: To cite this article: Mohammad Salim Raza, Raihana Zannat, Ohidujjaman. Advanced Design of Smart Digital Application Using PIC 16F887A Microcontroller and DS 1307 RTC. American Journal of Embedded Systems and Applications. Vol. 6, No. 1, 2018, pp. 30-36. doi: 10.11648/j.ajesa.20180601.15 Received: June 2, 2018; Accepted: June 27, 2018; Published: July 27, 2018 Abstract: In an elegant phenomenon of the world, mechanical applications are replaced by electronic appliance. Especially digital clocks are smart application due to precisely time display and several types of reasons such as much reliable, free maintenance, portable, elegant outlook, inexpensiveness, tiny size and result accuracyy. Every electronics based modern real life application in any filed is now integrated with the digital calendar to enable the user to keep time and date anywhere at any time. It is often incorporated into all kinds of devices such as transports, traffic signal, radios, televisions, standard ovens, computers, laptop, cell phones and wireless peripheral to intellect the device in the way that would be easily enticed by human mind. Regarding the demand of digital clock, this paper presents graceful design of smart digital clock in a particular way that would not only be able to display time, it has an ability to display day of a week with real time. This research shows an embedded system which is constructed through PIC 16F877A microcontroller, DS1307 RTC and 74LS138 decoder IC. Keywords: PIC 16F877A Microcontroller, I2C Communications, DS 1307 RTC, 7-Segment Display, LED Display, 74LS138 Decoder IC 1. Introduction To measure time, something is needed that will repeat at regular intervals. The number of intervals counted gives a quantitative measurement of the duration. The earliest references for the measurement of the time are the moon and sun [1]. When the sun and the moon are not visible, it is impossible to know the exact time. However clocks are developed to measure out the time in absence of the sun and the moon. The process of measuring time has progressively become more accurate, and the devices more localized eternally [2]. In this work a smart digital clock is developed which is not only shows the time operation with am-pm but also indicates the day of a week. The whole controlling operation is maintained by a PIC 16F877A microcontroller which can set timing condition of DS1307 RTC and read data from the RTC to represent time on 7-segment display. Moreover PIC 16F877A microcontroller indicates a day of a week and am/pm operation with help of decoder 74LS138 IC and LED respectively. 1.1. Objective The goal of this study is to build up a smart application through PIC 16F887A microcontroller and DS 1307 RTC. The tricky embedded system is also comprised 7- segment display. This application especially covers maximum possible arena where it applicable. This study is also significant because of to write code segment with Mikro C Pro for PIC microcontroller. It is also study and learning base phenomena for an amateur who would eager to learn microcontroller, Mikro C Pro, embedded system, advanced interfacing etc. 1.2. Applications i) In various types of transport ii) In traffic signal

American Journal of Embedded Systems and Applications 2018; 6(1): 30-36 31 iii) In radios & televisions iv) In standard ovens v) In computers, laptop & cell phones vi) In wireless peripheral vii) In robotics 2. Literature Review The first public clock that struck the hours was made and exerted in Milan in 1335[3]. The oldest servicing clock in England is that at Salisbury Cathedral, which dates from 1386. About 1500 Peter Henlin, a German locksmith, began to make small clock driven by a spring [4]. The first electronic clock is quartz clock. It is made with a piece of quartz like liquid crystals which eventually composed watch displays [5]. Quartz vibrates equally at thousands of times a second when subjected to an electrical current. Electronic clock at those vibrations divides then down to minute, second and fraction of seconds to show time on the dial or display. Quartz clocks provide more accurate than any mechanical time keeper [6]. However Digital clocks display a numeric representation of a time. Two numeric display formats are commonly used on digital clock such as 24 hours and 12 hours notation. Electronic clocks have predominately replaced the mechanical clocks as they are much reliable, accurate, maintenance free, portable and cost effective [3-5]. The modern version of electronic clock is a name of digital clock that displays the time digitally. Microcontroller like PIC 16F877A, Real Time Clock like DS1307 RTC, 7 Segments Display, LED indicators and some digital IC like 74LS138 Decoder are conventionally used to design smart digital clock [6-8]. There are also clocks for the blind that have display that can be read by using the sense of touch. Some of these are similar to normal analog displays, but are constructed so the hands can be felt without damaging them. Though all clocks measure time, but different clocks can have different status or importance [5, 9, 10]. In 2008, Pan Thu Tun has designed a digital clock using microcontroller with 7-segment display [11]. It simply handles the timing functions electronically rather than mechanically. 3. Proposed Model and Design Principle This embedded system is constructed using PIC 16F877A microcontroller, DS1307 RTC and 74LS138 decoder IC. The proposed basic model of smart digital clock is portrayed in figure 1. The PIC 16F877A microcontroller is a heart of this clock. The microcontroller sets initial time on DS1307 RTC according to input switching conditions. After that the microcontroller reads data from DS1307 RTC and displays time on 7-segment display with am/pm mode by LED indication and also displays day by 74LS138 decoder IC indication. When designed embedded system is connected with power supply, it executes the sequential operations according to programming instructions. Figure 1. Basic model of smart digital clock.

32 Mohammad Salim Raza et al.: Advanced Design of Smart Digital Application Using PIC 16F887A Microcontroller and DS 1307 RTC The flowchart of the proposed model is depicted in figure 2. First of all; microcontroller cheeks the initial condition of adjustment switch (ON or OFF). If Adjustment switch gets ON signal (+Vcc) then the data are written into microcontroller and displayed on the 7- segment display. In other direction if the adjustment switch gets OFF signal (ground) then the microcontroller writes data into RTC and displays time on the 7-segment display with am/pm mode by LED indication and also displays day by 74LS138 decoder IC indication. After that data are read from RTC and displayed time on the 7-segment display. The whole processes are repeated to execute the operation of the smart digital clock until to shutdown the system. 3.1. Setup for Proposed Method The program is written in C programming language with Mikro C Pro environment in order to meet the requirement for interfacing of all components in the system and the whole model is simulated with Porteus software [12]. 7-segment LED display is used to show up time and also nine LEDs are used to indicate am/pm mode as well as day of a week. To provide power to the system, 5 volt dc adopter and 3v backup battery are used to operate Real Time Clock DS1307 and 74LS138 decoder IC respectively. Communication between PIC 16F877A microcontroller and DS1307 can be established through I2C bus protocol. 3.2. PIC Microcontroller Tool MIKRO C PRO The MIKRO C PRO for PIC is a powerful feature-rich development tool for PIC microcontroller [13]. It is designed to provide the programmer with the convenient possible solution to developing applications for embedded systems, without compromising performance or control. The MIKRO C PRO is used to write program that has been used to execute operation of the smart digital clock [14]. This program has been written with MIKRO C PRO programming environment for PIC microcontroller. Figure 2. Flowchart of the proposed method for smart digital clock.

American Journal of Embedded Systems and Applications 2018; 6(1): 30-36 33 3.3. Initial Time Setting and Data Writing on RTC Clock The circuit diagram of smart digital clock is simulated in Proteus Software and then implemented practically as shown in figure 3. Port A of PIC 16F877A microcontroller is declared as an input pins by which can control to setup the initial time and day of this digital clock. Port B and Port D are declared as output pins that are connected with 7-segment display and base of transistor in order to display real time on the seven 7-segment display. In Port C, pin RC3 and pin RC4 are connected with RTC DS1307 in order to write/read time and day by the microcontroller. Pin RC0 and RC1 are used as an output pins, those pins are needed to indicate am/pm mode of digital clock via LED indicator. Port E is used as output pins that are connected with input pin of 74LS138 decoder in order to meet the requirements of day display through seven LEDs indicator. Pin 11 and pin 12 are used to deliver power supply to the microcontroller, although those pins are hidden in this simulation but practically needed. Pin 13 and Pin 14 are interconnected with 20MHz Crystal that needed to operate microcontroller. Moreover pin 1 is used as RESET pin of PIC 16F877A Microcontroller. R18 R19 D1 D2 LED-YELLOW R16 R17 SW2 SW-SPDT SW1 SW-SPDT R1 R20 X1 U1 CRYSTAL 20MHz 13 OSC1/CLKIN RB0/INT 14 OSC2/CLKOUT RB1 RB2 2 RA0/AN0 RB3/PGM 3 RA1/AN1 RB4 4 RA2/AN2/VREF-/CVREF RB5 5 RA3/AN3/VREF+ RB6/PGC 6 RA4/T0CKI/C1OUT RB7/PGD 7 RA5/AN4/SS/C2OUT RC0/T1OSO/T1CKI 8 RE0/AN5/RD RC1/T1OSI/CCP2 9 RE1/AN6/WR RC2/CCP1 10 RE2/AN7/CS RC3/SCK/SCL RC4/SDI/SDA 1 MCLR/Vpp/THV RC5/SDO RC6/TX/CK RC7/RX/DT RD0/PSP0 RD1/PSP1 RD2/PSP2 RD3/PSP3 RD4/PSP4 RD5/PSP5 RD6/PSP6 RD7/PSP7 33 34 35 36 37 38 39 40 15 16 17 18 23 24 25 26 19 20 21 22 27 28 29 30 R3 10k SDA SCL TRIG R2 10k U2 6 SCL X1 5 SDA 7 SOUT 3 VBAT X2 1 2 I2C X2 CRYSTAL 32.687KHz R10 Q6 R9 R11 Q5 R8 R12 Q4 R7 R13 Q3 R6 R14 Q2 R5 R15 Q1 R4 PIC16F877A DS1307 BAT1 3V U3 1 A 2 B 3 C 6 E1 4 E2 5 E3 74LS138 Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7 15 14 13 12 11 10 9 7 D9 D3 D4 D5 D6 D7 D8 Figure 3. Schematic Circuit Diagram of Smart Digital clock. When designed system is enable/powered, it executes the sequential operation according to programming which is loaded within PIC 16F877A microcontroller. First of all, microcontroller cheeks the initial condition of switch of SW1 (PORTA. F3), if SW1 is connected with higher potential (+Vcc), the microcontroller gets interrupt signal and goes to store the initial data into itself [12]. The buttons (PORTA. F0, PORTA. F1) across the resistor R16 and R17 are pressed to initiate minutes and hours respectively and switch SW2 (PORTA. F2) is used to set am/pm mode. The day mode of a week can be setup through the button switch (PORTA. F4) across resistor R20 when SW1 is connected with +Vcc. Microcontroller waits to initiate time and date of RTC DS1307 until SW1 is connected with +Vcc. If SW1 is connected with ground potential, microcontroller sends data to write into the DS1307 RTC [13]. The following code segment represents the initial time setting and data writing on RTC clock

34 Mohammad Salim Raza et al.: Advanced Design of Smart Digital Application Using PIC 16F887A Microcontroller and DS 1307 RTC Figure 4. Code segment representing the initial time setting and data writing on RTC clock. 3.4. Reading Data from RTC Clock and Display on 7-Segment PIC 16F877A microcontroller reads the data from DS1307 RTC and display time on 7-segment display with am/pm mode of operation. Every 24 hours, microcontroller increases the value of day by 1 and passes to the 74LS138 decoder IC through port E. However the decoder provides high output to the next one that indicates the next day [13]. Once more to setup the time, it is needed to set switch SW1 to +Vcc and then required to press the reset button which is connected with pin 1 of the microcontroller; consequently, time, day and am/pm mode can be set with help of others switches. The following code segment represents the data reading from DS1307 RTC and displaying data on the 7-segment display.

American Journal of Embedded Systems and Applications 2018; 6(1): 30-36 35 Figure 5. Code segment representing the data reading from DS1307 RTC and displaying data on the 7-segment display. 4. Result Analysis The output is very significant and perceptible on 7- segment display in smart way. The accuracy level is entirely high, trustworthy significant and implementable possible versatile arena. The following table 1 shows the initial setting and the result after first iteration in regarding some constraints. Table 2 shows the outcome both in 7-segment display and RTC clock when PORTA. F3 is null that means PORTA. F3 is connected with ground instead of +Vcc. At this stage, updated time at microcontroller will be written at DS1307 RTC by PIC 16F877A microcontroller. Table 3 shows the continuous outcome both in RTC clock and 7-segment display after data are written into DS1307 RTC. At this phase, PORTA. F3 is also NULL and time will be updated by one second. The smallest unit of time such as SECOND is generated at DS1307 RTC by its own function. The updated data are read by the PIC 16F877A microcontroller in every second and send it to the 7-segment display.

36 Mohammad Salim Raza et al.: Advanced Design of Smart Digital Application Using PIC 16F887A Microcontroller and DS 1307 RTC Table 1. At initial setting display features. PORTA. F3 MINUTE HOUR AM/PM DAY 7- SEGMENT DISPLAY PORTA. F3==X 00 00 AM SATURDAY Saturday:00:00:00 AM AFTER FIRST ITERATION PORTA. F3!=0 10 minute (Increased by 1 if Press BUTTON connected to PORTA. F0) 10 hour (Increased by 1 if Press BUTTON connected to PORTA. F1) PM (If Press switch connected to PORTA. F2) SUNDAY ( If Press BUTTON connected to PORTA. F4) Table 2. After single iteration if PORTA. F3= =0, data write on RTC (Sunday: 10:10:00 PM). Sunday:10:10:00 PM PORTA. F3 MINUTE HOUR AM/PM DAY 7- SEGMENT DISPLAY WRITTEN INTO RTC PORTA. F3= =0 10 minute 10 hour PM SUNDAY Sunday:10:10:00 PM Sunday: 10:10:00 PM Table 3. Reading data from RTC CLOCK and display value continuously. PORTA. F3 SECOND MINUTE HOUR AM/PM DAY RTC CLOCK 7-SEGMENT DISPLAY 0 1 second 10 minute 10 hour PM Sunday Sunday:10:10:01 PM Sunday:10:10:01 PM 0....... 0............................... 0 10 second 11 minute 11 hour AM Monday Monday: 11:11:10 AM Monday:11:11:10 AM 5. Conclusion In the proposed model, simple smart digital clock has been designed using single microcontroller and implemented practically after the simulation. However, most of the digital clock cannot provide the time exactly for longer period due to unstable effect of clocking pulse. Nevertheless, our designed smart digital clock is not affected by the unstable effect of clocking pulse problem because it uses Real Time Clock module DS1307 that keeps track of the system time and updates continuously. Another data loss problem occurs in some digital clocks whenever power supply shuts down, but our designed smart digital clock is fully free from this hamper due to using of DS1307 RTC which has built-in power sense circuit that detects power failures and automatically switch 3V Li cell battery which is attached with the RTC provided by manufacturer. Moreover its circuit s complexity is very low even visually understandable and cost effective. References [1] https://biblenumbers.files.wordpress.com/2012/11/celestialclock-sun-moon-stars.pdf [2] http://www.historyofwatch.com/watch-history/ [3] Sadeque Reza Khan, Alvir Kabir, Dilshad Ara Hossain, Designing Smart Multipurpose Digital Clock using Real Tim Clock (RTC) and PIC Microcontroller, International Journal of Computer Applications (0975 8887) Volume 41 No. 9, March 2012. [5] M. Mamun and Z. Karim A. H, Designing a Microcontroller based Smart Multi Language Learning Word Master, International journal of Engineering Science & Technology (IJEST), Vol. 3 No 1 Jan 2011, pp 84-88. [6] Microchip. 2001. PIC16F877A Data Sheet. Printed by Microchip Technology, Inc in the United States of America www.microchip.com [7] Dallas DS1307 64 8 Real time Clock (RTC), Data Sheet Printed by Dallas Semiconductor www.maxim-ic.com [8] Motorola SN74LS138 1-OF-8 Decoder/ De- multiplexer, Data Sheet Printed by Motorola- www.motorola.com [9] Chukwunazo. J. Ezeofor #1, Eric. C. Okafor Design and Simulation of Microcontroller Based Electronic Calendar Using Multisim Circuit Design Software, International Journal of Engineering Trends and Technology (IJETT) Volume 13 Number 8 Jul 2014. [10] Victor Kathan Sarker, M. Ataur Rahman, and M. A. Matin, Design and Development of Microcontroller Based Digital Bangla Clock, International Journal of Computer Theory and Engineering, Vol. 4, No. 6, December 2012. [11] Pan Thu Tun, Development and Implementation of Microcontroller-based Digital Clock, World Academy of Science ngineering and Technology 42 2008, pp: 362-365. [12] Bo Su, Li Wang, "Application of Proteus virtual system modeling (VSM) in teaching of microcontroller" IEEE xplore White Paper (April 2010). [13] PIC17C4x microcontroller data sheet (PDF). Microchip Technology. 1996. DS30412C. Retrieved 2016-08-16. [14] Churm, Thomas M. (November 5, 2013). "A Short History of Digital Clocks and Watches". Alarm Clock Blog. Archived from the original on March 1, 2016. Retrieved 2016-02-28. [4] S. Ahmed and S. Monira, Designing a 10 segment display for Bangla and English numerals, Proceedings of ICCIT, 2007, pp. 602-605.