International Conference on Information and Communication Technology and Its Applications (ICTA 2016) Federal University of Technology, Minna, Nigeria November 28 – 30, 2016 Development and Implementation of Microcontroller-based Improved Digital Timer and Alarm System Lukman Adewale Ajao1, Mutiu Adesina Adegboye2, Eustace M. Dogo1, Salihu O. Aliyu3, and Danlami Maliki1 1 Department of Computer Engineering, Federal University of Technology, Minna, Niger State 2 Department of Electrical Engineering, Federal University, Oye-Ekiti 3 Department of Telecommunication Engineering, Federal University of Technology, Minna, Niger State Abstract—Time plays an important role in our daily activities, clocks. All clocks measures time but different clocks have more particularly in sectional events or conference arena varying added functions or importance in their architecture. where there is need for accurate time management. This paper This experimental timer and alarm system design in this focuses on the development and implementation of an paper is aimed at time control in regular symposium, in order improved digital timer with audio-visual unit using to solve the usual problems of time delay or overlaps during (PIC16F887) microcontroller chip and other electronics presentations by sugar coated mouth presenter or people with component such as LCD, 7-segment display, LED and buzzer too many materials, since overtime is an offense to the as an I/O device. Thus, the need for this device in our daily audience, particularly if there are parallel sessions. Well, this activities is to monitor the time scheduled for events, updating device brings the solution, since it contains timer with light and alert the audience using an audio-visual approach. The proposed system allows apt time management and avoids time indicator unit (Green, Yellow and Red) and alarm system to wastage during seminar presentations and the likes. It tell the presenter the actual time spent logically. Mechanical particularly helps presenters to be time conscious, thus, and electromechanical clocks are being modified and making them to naturally adjust such that the allotted time is replaced by microcontroller-based digital clocks, this is due enough to cover up their presentation. The digital timer and to the reduced cost, higher reliability, less power alarm system presented herewith is also of advantage to the consumption, portability, wide variety of changeable physically challenged like the deaf and blind in monitoring functions by reprogramming the chip and adding new their sectional activities and to be fully involved about the product features. In addition to these, it gives confidence to event situation. The system was designed in different modules, the experts and student in the area of embedded systems by and all were interfaced together with firmware chip to simplify (learn-while doing) undertaking certain simple in-house the mechanism’s fault diagnoses and fault corrections. experiments with frequent practice on microcontroller-based electronics circuit design and simulation and the replacement Keywords-digital timer, signal module, conference arena, of analog devices or components to achieve better physically challenged, firmware chip. performance operation and simple circuit [2]. I. INTRODUCTION II. RELATED WORKS Watches or other timing devices are very important in Several significant papers have been reviewed on the tracking our daily activities. Timing control and alert system microcontroller-based timing system, which led to this is significant in every aspect of our lives beyond just to tell improved digital seminar timer and alarm system what time of the day it is. The science of time began when development and implementation. The design of a humans started analyzing the patterns of light and darkness microcontroller-based intelligent digital volume with timer which lead to development of the calendar year and a clock was put forward by the authors in [3]. Their system design is based on 60-seconds/minute, 60-minutes/hour and 24- a computer based timer with speaker volume controller, it hours/day. Clock has been designed in different architecture cannot be used in the conference arena for timing and alarm with functions to determine or solve many problems like day purposes because of its complexity and difficult to operate and night period, to control periodic events, to ring a bell since it uses serial communication port and setup. The every hour or minute, to open doors, run machinery and play authors in [4], designed a digital clock using microcontroller- music. Presently, humans are controlling actions within the based system with seven-segment display to display time environment in a programmed and predictable manner [1]. base on the program coding. The system could not display Therefore, keeping of time is basic for all control systems. year, month or day and no alarm system. Also, it became In every conferences chamber, public room, schools and relatively expensive due to the use of external decoder. other convention arena nowadays, timing is a very essential Another effort was made on microcontroller-based factor considered in the gathering for the coordination and timing system in [5]. They came up with a 24 segment managing of the event. Due to the level of technology display for Bangla characters and numerals. Similarly, nowadays, time is mostly measured electronically using another effort was made by the authors in [6] towards 184 International Conference on Information and Communication Technology and Its Applications (ICTA 2016) developing a 10-segment display for Bangla digits, but their performances. The input unit, this unit used combination of segments were not uniform, also, it had some controversy in (4x4 keypad) for the timing digits input to the system for the portraying digits such as “1”, “2”, “3”, and “7” accurately. processing. Therefore, the output units are divided into three Furthermore, the work in [7] improved on the work of [5] parts: First, the implementation of a 16x2 (LCD) module, and [6] by coming up with design of an 11-segment display which display timing digit pressed for the system operation for Bangla, Arabic and English numerals. This design gives a and time received message display as shown in the figure 9. uniform results and it complements the effort of the previous Secondly, the 7-segment display was programmed to authors without any segment intersections. Microcontroller respond to any input time digits for the count-down timer. based digital Bangla clock and calendar, which display Thirdly, the (LED) indicator and buzzer, this was designed Bangla digits on the 16x2 LCD was put forward by [8]. The and arranged serially using time delay to respond to changes author used ATmega8 microcontroller and basic language in an input timing by shown green light when input timing is for the system coding and programming. The clock functions fresh, then changed the state when the count-down timer is in dual mode of performance, it display digits in both left with 5 seconds to the end and activate yellow LED, and English and Bangla language. No alarm unit incorporating finally changed the state of LED to RED light when the input with the system for the message notifications. The electric timing elapsed. At this stage, the buzzer will be activated heating timer based system using Atmel AT89S52 immediately and raised alarm to show the accuracy of the microcontroller was developed by [9]. The system deals with system. With all features attached to this system and its the designing of biomedical related equipment for pain relief performances make it an improved digital clock and alarm based on time dependent heat therapy, which performs system over the existing one as reported in the literature count-down operation from 0000 – 9999 minutes with four review. This will assists presenters to strictly adhere with 7-segment display showing the actual time left for the heat time specification and management in the conference arena therapy. The system is functioning well in the area of or events. It will also help the physically challenged people application but lack of monitoring and alarm system when to be fully involved about the present situation of the event the time elapsed. Author in [10] discuss an approach for and to manage their daily time activities. managing alarms and diagnosis in an automation In achieving this system, it involves modular management system and integrated information technology implementation of the different units separately before each milieu, using WBEM/CIM approach technologies. Since, the of the module were linked together to function as a system integration of system management of enterprises and unit. This give advantages of operating the system easily, industrial automation become increasingly connected. and make the fault isolation and fault detection simple. The Therefore, it requires alarms and diagnosis governed system. system was designed to be powered through 5V universal The shortcoming of the system does not involved timing and serial bus (USB) port; all components are connected to the logical method of managing industries like light indicator common 5V line and grounded. The structural design of an and others. improved digital seminar timer and alarm system is given in In this paper, we intend to develop and implement a Fig. 1. microcontroller based digital timer and alarm system to enable presenters strictly adhere with time specification and management in conference arena or events. The system LCD consists of three major sections which will be discussed DISPLAY KEYPAD MCU under system design and methodology. The device contains a (PIC16F887) digital clock, implemented with software codes which allow 7-SEGMENT time to be set and reset, alarm system to alert user when the DISPLAY preset times elapse and indicating light which tell the time conditioning logically. POWER III. SYSTEM DESIGN AND METHODOLOGY LED SUPPLY INDICATOR The Microcontroller based improved digital timer and UNIT alarm system was design and implemented with the use of both hardware and software approaches for the design, ALARM development and implementation in modular programming. (BUZZER) In our design, the software used in the program coding was MikroC Pro for PIC using micro C language. The circuit development was simulated, programmed and demonstrated Figure 1. Structural design of microcontroller-based digital timer and using Proteus Virtual System Modeling 8.0 (PVSM) and alarm system PICKit3 debugger was employed in the process for the real life scenario programming of the microchip. Therefore, the A. System Controller Unit hardware implementation of the microcontroller based The PIC 16F887 Microcontroller was used as an improved digital clock and alarm system was carried out and intelligence device, which control and coordinate all the tested on the breadboard before finally soldering on the activities carried out by the system development. This chip veroboard. belongs to a mid-range 8 bits architecture and 14 The hardware design comprises of different module like instructional word length of microchip, it consists of 40 pins the system controller unit where (PIC16F887) (1-40) and 5 ports coded as Port (A-E). Port A to port D are microcontroller was used for the system programming and 8 bits bidirectional digital input/output (I/O) ports with 185 International Conference on Information and Communication Technology and Its Applications (ICTA 2016) additional port bits as shown in the figure 3, while Port E is a to the microcontroller of the system. The four button pins 4-bit bidirectional input/output ports. Therefore, the other along the column are configure to be inputs and grounded four pins like pin (11 and 12, 31 and 32) are for the (GND), while all the four buttons across the rows are controller power (Vss) and ground (GND) respectively, most configure to be output as shown in the simulation circuit of the pins of this chip are multifunctional pins and design in figure 9. The four input pins along the column are multipurpose. Details description of some selected pins connected to the Port D (RD0-RD3) of the microcontroller number was given in the table 1. For instance, pin 1 and grounded, while the other output four pins across the (RE3/MCLR/VPP), pin 5 (RA3/AN3/VREF+/C1IN+), pin row of the button are connected to the Port D (RD4-RD7) 13 (RA7/OSC1/CLKIN) and pin 39 (RB6/ICSPCLK ). with 10k resistor for each connection pins. If one of the PIC16F887 has high performance RISC CPU with sixteen buttons is pressed, it connects a pair of pins together. features of high operating speed; it works on 4-20MHz This feature helps in detecting which button is pressed. The oscillator/clock input and 200ns instruction cycle [11]. It also internal and external architecture of the keypad connection contains three timer modules; Timer0, Timer1 and Timer2, was shown in the figure 4 and figure 5 respectively. where timer0 module was used for the timing in this work. The OPTION register is a readable and writable register which contains various bits to configure the Timer0/WDT A prescaler, External INT interrupt, Timer0 and Weak pull-ups resistor on PORTB. B TABLE I. DETAILS OF SOME SELECTED PIN NUMBERS AND C DESCRIPTION OF PIC16F887 MICROCONTROLLER CHIP. Pin Pin Name Description D N0 1 RE3/MCLR/VPP RE3: Digital I/O Port E, Pin 3 MCLR: Low logic controller power 1 2 3 4 reset or clear screen. VPP: Microcontroller programming voltage Figure 3. Internal architecture of 4 x 4 matrix keypad connections 5 RA3/AN3/VREF+ RA3: Digital I/O Port A, Pin 3 /C1IN+ AN3: Analog to Digital channel 3 VREF+:Analog to Digital positive voltage reference input C1IN+: Positive input comparator 1 13 RA7/OSC1/CLKI RA7: Digital I/O Port A, Pin 7 N OSC1: First input crystal oscillator CLKIN: External clock input 39 RB6/ICSPCLK RB6:Digital I/O Port B, Pin 6 ICSPCLK: Serial clock programming Figure 4. External architecture of 4 x 4 matrix keypad connection C. Output Unit The first output device used in this system was 16x2 LCD (HD44780) parallel interface chipset, 16 pins connection, easy to configure and program which commonly used in the various simple and complex embedded systems to exhibit output information. LCD (Liquid Crystal Display) is an electronic module use to display alphanumeric data on Figure 2. Pin configuration of the PIC 16F887 microcontroller chip the screen, a 16x2 LCD denotes 16 columns and 2 rows capable of displaying 16 characters per line/row and there B. The Input Unit (4x4 matrix keypad) are two (2) of such lines/rows. In this work, 4-bit data mode In this work, 4x4 matrix keypad was used as a data input (D4-D7) was used instead of the 8-bit counterpart. The data device for the system timing or logical configuration of the line pin (D4-D7) of LCD was connected to the port C, pin system operation. In the process of connection, the four (15-18) of microcontroller respectively. In the process of button pins along the rows are connected with the four interfacing the LCD with microcontroller, the LCD pins was buttons pins across the column to reduce the input connected accordingly as shown in the figure 6a before connection switches to 8 pins, which are directly connected embarking on the bread boarding and soldering. 186 International Conference on Information and Communication Technology and Its Applications (ICTA 2016) (a) (b) Figure 5. Pin configuration and circuit implementation of 16 x 2 LCD module D. Seven Segment Display Unit A seven segment display is the most common basic electronic display device capable to demonstrate digits from 0-9 and beyond in a clearly digital form. It can be used in many applications of electronics and embedded system devices to display numeric information like in the digital clocks, radio, microwave ovens, electronic meters etc. The arrangement are laid out as a squared-off shown in the in Figure 7, every LED is assigned a name from 'a' to 'h' and is identified by its name. Seven LEDs 'a' to 'g' are used to display the numerals while 'h' is used to display the dot/decimal [12]. Common cathode type of seven-segment display was used in this design, the pin 11 and 12 of the device was connected to the Port A, pin (2-5) of microcontroller using NPN 2n2222 transistor to improve the Figure 7. LED connection to microcontroller brightness of the display. Also, the pins connection of the From Figure 7, using voltage divider rule with Vcc  9V , each 2-digit seven segment display (a-g) and the decimal point (dp) was connected together and directly connected to the port B, pin (33-40) for the digit display. where RD is the resistance of the green LED, R1 is obtained In CC configuration, the negative terminals of all LEDs thus: are connected to the common pins (low voltage) and common pin is connected to ground to glow a particular LED when its corresponding pin is given high logic to Vcc  R1 display a number. VR1  R1  RD R1Vcc  VR1 ( R1  RD ) (1) R1 (Vcc  VR1 )  VR1 RD VR1 RD 900 100 R1    300 Vcc  VR1 12  9 Figure 6. The cascaded four seven segment display and the pin configuration of each segment F. Audio Unit A buzzer is an audio signaling device, which may be mechanical, electro-mechanical, or piezoelectric. The E. Light Emitting Diode Unit wide areas of application of buzzers include: alarm devices The application of (LED) in this development system like clock, timers and confirmation of user input such as a was divided into two functions. First, it serves as an indicator mouse click or keystroke [14]. The buzzer is connected with light, and also as control and monitoring timing system. NPN transistor, wired with the third LED that indicating stop Three different color of LED was used for the control and and connected to the port E, pin 10 of microcontroller. This monitoring system (Green, Yellow and Red) which indicate device was configured and programmed to sounds whenever time begins, ready to stop and stop respectively. The LED the preset time interval has elapsed or when red light is was connected to port E, pin (8-10) of microcontroller, the activated (STOP). Figure 8 depicts the wiring method of buzzer and then grounded [13]. buzzer in our design. 187 International Conference on Information and Communication Technology and Its Applications (ICTA 2016) V. SYSTEM FLOWCHART Start Input Time No Is time valid? Figure 8. Wiring method of buzzer with NPN transistor From Figure 8, we have: Yes Count down on green VB  I B RB  VBE LED Ic2 103 IB    10  A  200 (2) No VB  10V Has 90% of time VBE  0.7V elapsed? Therefore, RB which is the base resistor of the transistor is Yes obtained as: Put ON Yellow LED and VB  VBE 10  0.7 count down RB    930 (3) IB 10 106 No Hence, a 1KΩ resistor value was used. Time Up? Yes IV. DISCUSSION The development and implementation of microcontroller- based digital timer and alarm system was design and tested Put ON Red LED, to ensure workability and reliability of its performance. The Sound Alarm system can be programmed for timing purposes by connecting it to the laptop through a USB port for power- driven, and simply press the ‘*’ key on the keypad to prepare Stop the system for data input or timing code. Then press the ON/OFF key to enter the countdown time or event time. For the proper interaction, the digits pressed/entered are Figure 9. Flow chart of microcontroller based digital timer and alarm system displayed on the LCD, when the user is done with timing range, the ‘#’ key is pressed and the system checks the time VI. IMPLEMENTATION inputs. If it is a valid time, the message display on the LCD “TIME RECEIVED” or else display “INVALID TIME”. The design is an embedded microcontroller-based This required a user to enter a valid time. system, with LCD, LED, seven segment display, keypad, But if a valid time is entered, the time will be shown on buzzer and others electronic components. It is divided into the “7-Segment Display”, activating the green light and the hardware and software parts. In the software part, the time will start counting. When countdown time reaches 90% MicroC program on the controller core can initialize the of the stipulated time, the Green LED goes off and activates parameters, configure the simulation and communicate with yellow LED. Once the countdown time expired, the yellow the hardware model. LED goes off and activates Red LED as well as buzzer If the time set for the system is 5 minutes in the clock, activated to sound in support of expiring time set. green light is activated and glow indicate the beginning of 188 International Conference on Information and Communication Technology and Its Applications (ICTA 2016) time, and counter will count by decreasing timer till it gets to activate and turn ON, at the same time it triggers the alarm 1 minute to the end of timing, after which the yellow LED system; the buzzer immediately comes up and interrupts the will come up to tell about the timing. Finally, when it counts presenter logically. Details implementation and testing of the to exactly 5 minutes of the total timing, the red lights will be digital timer and alarm system are shown in the figure 11. +5v +5v +5v RV1 +5v +5v LCD1 LM016L 44% Q4 Q2 2N2222 2N2222 Q1 10k 2N2222 Q3 VDD VSS VEE RW RS D0 D1 D2 D3 D4 D5 D6 D7 2N2222 E 1 2 3 4 5 6 7 8 9 10 11 12 13 14 R4 2k R5 2k R2 R3 2k 2k +5v R1 R9 20k 330 D1 LED-GREEN U1 1 15 RE3/MCLR/VPP RC0/T1OSO/T1CKI 16 RC1/T1OSI/CCP2 2 17 RA0/AN0/ULPW U/C12IN0- RC2/P1A/CCP1 3 18 RA1/AN1/C12IN1- RC3/SCK/SCL 4 23 RA2/AN2/VREF-/CVREF/C2IN+ RC4/SDI/SDA 5 24 RA3/AN3/VREF+/C1IN+ RC5/SDO 6 25 RA4/T0CKI/C1OUT RC6/TX/CK 7 26 RA5/AN4/SS/C2OUT RC7/RX/DT 14 RA6/OSC2/CLKOUT 13 19 RA7/OSC1/CLKIN RD0 20 RD1 33 21 RB0/AN12/INT RD2 34 22 RB1/AN10/C12IN3- RD3 35 27 RB2/AN8 RD4 36 28 RB3/AN9/PGM/C12IN2- RD5/P1B 37 29 RB4/AN11 RD6/P1C 38 30 RB5/AN13/T1G RD7/P1D 39 RB6/ICSPCLK 40 8 RB7/ICSPDAT RE0/AN5 9 RE1/AN6 10 RE2/AN7 PIC16F887 A 7 8 9 B 4 5 6 R6 R7 R8 330 330 330 C 1 2 3 ON D C 0 = + 1 2 3 4 +5v BUZ1 R10 R11 R12 R13 BUZZER 10k 10k 10k 10k Q5 2N2222 Figure 10. Complete simulation circuit diagram of digital timer and alarm system Figure 11. Implementation of digital timer and alarm system on the breadboard Figure 13. Packaging of the digital timer and alarm system VII. COMPARATIVE STUDY WITH SIMILAR WORK IN LITERATURE REVIEW The development of microcontroller based improved digital timer and alarm system put forward in this paper was evaluate by comparing with the existing similar work in the Figure 12. Implementation of digital timer and alarm system on the Vero literature from the perspective of the components used, board performances and their area of applications. 189 International Conference on Information and Communication Technology and Its Applications (ICTA 2016) TABLE II. COMPARATIVE STUDY WITH SIMILAR WORK IN THE firmware technology like System-on-Chip (SoC), complex REVIEW LITERATURE. programmable logic device (CPLD) or field programmable S/N Author & Project Title Parameter of gate array (FPGA), Arduino microcontroller etc to make the Year Comparison device efficient, portable compact, and more functions. 1. Victor et al. Design and The author employed (2012) development of ATmega 32 REFERENCES microcontroller microcontroller and 7- based digital bangle segment display in their [1] V. K. Sarker, M. A. Rahman, and M. A. Matin “Design and clock design to show the digits Development of Microcontroller Based Digital Bangla in both English and Clock”, International Journal of Computer Theory and Bangla languages, but no Engineering, Vol. 4, No. 6, December 2012. LCD and alarm system [2] L. A. Ajao, J. Agajo, J. G. Kolo, M. A. Adegboye, Y. Yusuf, 2. Diptarup and Microcontroller The system was designed “Learning of Embedded System Design, Simulation and Sukalyan, based intelligent to control music system Implementation: A Technical Approach”, American Journal (2012) digital volume and volume level using of Embedded Systems and Applications, Vol. 3, No. 3, pp. controller with Atmel 8051 35-42., May 2016. timer microcontroller, 7- [3] D. Paul and S. Som, “Microcontroller Based Intelligent segment display and Digital Volume Controller with Timer”, International Journal others. Based on their of Computer Applications, 38(1):19-26, January 2012. focus, alarm system, LCD [4] P. T. Tun, “Development and implementation of is not considered. microcontroller-based digital clock,” World Academy of 3. Mizanur et al. Microcontroller and Atmel 8051 Science, Engineering and Technology Conference, Singapore. (2012) LCD based digital microcontroller, LCD, 7- vol. 42, June 2008. Bangla Clock and segment display was used [5] M. S. Arefin, M. A. Dewan, M. I. Khan, and M. S. Islam, calendar in their design to display “Designing a 24 segment display for Bengali numerical digits time and calendar in and characters”, 3rd International Conference on Electrical Banglar language. The and ComputerEngineering ICECE, pp. 549-552, 2004. system is not capable of [6] S. Ahmed and S. Monira, “Designing a 10 segment display alerting. for Bangla and English numerals”, Proceedings of ICCIT, pp. 4. Arushi & Timer based The authors used Atmel 602 605, 2007. Sakshi (2016) Electric Heating 8051 microcontroller, 7- Pad segment display and [7] M. O. Rahman, M. A. Azim, M. S. Chowdhury, and M. N. heating element for their Islam, “Defferent segment displays for Bangla, English and design as time totalizer Arabic digits”, Proceeding of ICCIT, pp. 299-302, 2003. for dependent heat [8] M. Rahman, A. Islam, R. S. Rajan, D. M. parvez, R. Islam, therapy. No alarm system M. N. Islam, “Microcontroller and LCD based digital Bangla inclusive in the designed clock cum calendar”, International Journal of Engineering should in case of Research and Development, Volume 4, Issue 1 Pg.99-103, monitoring. 2012. [9] A.Vats, S. Sethi, “Timer Based Electric Heating Pad”, International Journal of Innovative Research in Science, VIII. CONCLUSION Engineering and Technology, Vol. 5, Issue 5, May 2016. [10] R. Lehmann, A. Dennert, M. Wollschlaeger, S. Trebing, This work presents the development and implementation “Diagnosis, Alarms and their Management in integrated of microcontroller-based improved digital timer and alarm Automation Systems”, IEEE, 2015. system. It is applicable for monitoring time preset, avoid [11] “Microchip PIC 16F887 datasheet”, retrieved from premature abortive time measures and enhance effective time www.microchip technology.inc, Retrieved May, 2015. usage by updating and alerting audience in the conference [12] “7-Segment Display”, retrieve from arena. The completed work was tested to ensure that the http://www.engineersgarage.com/ electronic-components/7- required task of timing, alerting and interrupting were all segment-display. well done. This was established to improve on learning idea, [13] A. Abubakar, T. Mantoro, S. Moedjiono, H. Chiroma, A. Waqas, “A Support Vector Machine Classification of Computational Capabilities enhanced research and technological improvement on of 3D Map on Mobile Device for Navigation Aid”, International embedded system design and development using Journal Of Interactive Mobile Technologies, 2016. microcontroller chip. The simulation, bread boarding, [14] "Buzzer - definition of buzzer by The Free Dictionary". soldering and the final packaging of the device was also Retrieved May 2015. presented. Further research work may include using other 190