Universities Research Journal 2011, Vol. 4, No. 4 Keyboard Controlled Scoreboard Kyaw Hlaing 1 and Win Swe 2 Abstract The objective of this research work is to design a keyboard controlled scoreboard that is easy to use, portable, and cost effective. Both hardware and software have been designed for the keyboard controlled scoreboard. All program source codes are written by assembly language. PIC16F84A and PIC16F877A microcontrollers are used as control devices in data transmitting circuit and data receiving circuit of this research work. The display screen is composed of 8 8 dot-matrix modules and 7- segment displays. The size of one character in 8 8 dot-matrix modules is 12 cm length and 7.5 cm breadth. Each module can display one character. Four modules are cascaded to display the name of team and two modules are cascaded to display the scores. 7-segment displays are used for showing time. The last two digits show minutes and the first digit shows hour. Key words: PIC16F84A, PIC16F877A, 8 8 dot-matrix modules Introduction A scoreboard is a device that allows spectators and players to be able to know the score at every point in the game. This is critical to competition as teams usually strategize their game play based on key factors related to the information displayed on the scoreboard. In order for this information to be current and easily updateable it is best that the scoreboard be remote controlled. The infrared radiation technique is used between the keyboard data transmitter and scoreboard. Keyboard is connected to the input pin of PIC16F84A so that keyboard data is transmitted via an infrared LED that is under the control of PIC16F84A. Synchronous serial communication is used between keyboard and PIC16F84A. A software development is also implemented for keyboard data receiving, keyboard data transmitting and data receiving from keyboard data transmitter. Block diagram of developed keyboard controlled scoreboard system is shown in Fig. 1. 1. Assistant Lecturer, Department of Physics, University of Mandalay 2. Associate Professor, Department of Physics, University of Mandalay
132 Universities Research Journal 2011, Vol. 4, No. 4 Fig.1. Block diagram of keyboard controlled scoreboard Hardware Design In the Hardware Design, there are six units. They are Keyboard Data Receiving, and Transmitting Unit, Main Control Unit, Horizontal Scanning Unit, Timer Display Unit and Display Unit. Keyboard Data Receiving and Transmitting Unit This unit generates the modulated pulses for main control unit and receives the synchronous data of PS/2 keyboard. It consists of three main parts infrared LED, C1383 n-p-n transistor and PIC16F84A microcontroller. The 40 khz modulated signal energizes the infrared LED is connected with emitter of C1383. The specified numbers of modulated pulses are transmitted each time via an infrared LED under control of PIC16F84A microcontroller. The two transistors (C1383) are connected as Darlington connection (Horowitz, P. and Winfield, H.) because infrared LED is required large amount of current. Therefore, the result behaves like a single transistor with beta equal to the product of the two transistors beta. Circuit diagram of infrared transmitter unit is shown in Fig. 2.
Universities Research Journal 2011, Vol. 4, No. 4 133 +5 V Keyboard clock line Keyboard data line C1383 C1383 4.7 K 330 O 1 18 2 17 3 16 4 15 5 14 6 13 7 12 8 11 9 PIC16F84A 22pF 20 MHz 22pF Fig.2. Circuit diagram of infrared transmitter unit Main Control Unit This is the main control part of the system, which receives infrared signal from the transmitter unit, scans the data to display the character and transmits specified data to the data receiving and scanning unit. This unit performs the required mathematical operations and also generates the pulses for horizontal scanning unit and timer display unit. The infrared signal is detected by infrared receiver. Four infrared receiver are used for detect the infrared signal from every site. The control device of this unit is the PIC16F877A microcontroller manufactured by Microchip Inc. Circuit diagram of main control unit is shown in Fig.3.
134 Universities Research Journal 2011, Vol. 4, No. 4 +11V Output result of IR receiver unit C9013 all 22 pf 33 2 3 11 4 22 pf 12 15 PIC 16F877A 16 17 18 23 24 39 25 40 26 HCF017BE R Q1 CLK Q2 EN Q3 Q9 Q4 Q5 Q6 Q7 Q8 I1 I2 I3 I4 I5 I6 I7 I8 ULN2803A O1 O2 O3 O4 O5 O6 O7 O8 Fig.3. Circuit diagram of main control unit
Universities Research Journal 2011, Vol. 4, No. 4 135 Horizontal Scanning Unit The main function of this unit is horizontal scanning for the display system. It consists of three main parts HCF4017BE, ULN2803APG and two input HCF4081BP ICs. For four characters scanning, four numbers of HCF4017BE, four numbers of ULN2803APG and HCF4081BP ICs are used. The outputs of HCF4017BE are connected to the inputs of ULN2803APG. The ULN2893 outputs are connected with 8 8 dot-matrix display. HCF4081BP IC is used for the serial clock input of three HCF4017BE ICs. Circuit diagram of horizontal scanning unit is shown in Fig.4. Fig.4. Circuit diagram of horizontal scanning unit for one team
136 Universities Research Journal 2011, Vol. 4, No. 4 Timer Display Unit The main function of this unit is to display the playing time of the game. It consists of three main parts, SN74LS90 Decade counter, HFE4543B BCD to 7-segment driver, HCF4081BP 2-input AND gate. The clock and reset pin of SN74LS90 decade counter is connected with pin number 3 and pin number 4 of portb of PIC16F877A. PIC16F877A controls decade counter to display the playing time of the game. Then decade counter generates binary code to HFE4543B. Then HFE4543B generate 7-segment display pattern code that will be appearing on the 7- segment display. Display Unit It consists of two 32 8 dot-matrix displays and two 16 8 dot-matrix displays. The first will be used to show the teams in the game. The second will be used to show the marks of the team. Dot-matrix displays are constructed as 8 8 dot-matrix modules. Each module contains 64 pixels. Each pixel has four LEDs. The photograph of 8 8 dot-matrix module is shown in Fig.5. The wire connection of 8 8 dot-matrix module is shown in Fig.6. It also contains 7-segment display to show the playing time of the teams. Fig.5. The photograph of 8 8 dot-matrix module (Front and back view)
Universities Research Journal 2011, Vol. 4, No. 4 137 Fig.6. The wire connection of 8 8 dot-matrix module Software Implementation There are two main programmes in the software implementation. The first program consists of keyboard data receiving program and data transmitting subroutine. The second program receives 40 khz modulated IR signal and controls the output data for the display unit. For keyboard data receiving programmes, the control device is PIC16F84A. The assembly language is used to program PIC16F84A to receive data. The clock and data lines of keyboard are connected to the input pins (RA0 and RA1) of PIC16F84A. For the keyboard data input currently update, interrupt feature of PIC is used. PIC16F84A receives keyboard scan code and transform receive scan code to transmit code. Then PIC16F84A generates 40 khz modulated clock pulse via an IR LED. Flowchart of keyboard data receiving program is shown in Fig.7 and Flowchart of data transmitting subroutine is shown in Fig. 8.
138 Universities Research Journal 2011, Vol. 4, No. 4 Fig.7. Flowchart of keyboard data receiving program
Universities Research Journal 2011, Vol. 4, No. 4 139 1 Is CLK = 1? No Yes Yes Is CLK = 1 No Exclusive OR with data and parity, AND with 1 Is CLK = 1? Yes No Is CLK =1? Yes No No Check parity error Go to start No Yes Is the receive data =0xF0? Yes Transmit keyboard data End Fig.7. Flowchart of keyboard data receiving program (Continued)
140 Universities Research Journal 2011, Vol. 4, No. 4 In the second programme, PIC16F877A receives 40 khz modulated clock pulse via an IR receiver. The output of IR receiver is connected with the input pin (RB0) of PIC16F877A microcontroller. PIC16F877A classifies binary-1 or binary-0 according to the incoming pulse numbers. The binary-1 state is composed of 40 pulses of 40 khz modulated clock pulse. The binary-0 state is composed of pulses of 40 khz modulated clock pulse (Smitch, D.W.). According to the input data information, PIC16F877A determine character or number. Then PIC16F877A displays received information on the display screen. PIC16F877 A also determines the time during of the game from start and display the corresponding time on the 7-segment displays.
Universities Research Journal 2011, Vol. 4, No. 4 141 Fig.8. Flow chart of main control function Results and Discussion The keyboard controlled scoreboard is constructed using peripheral interface controller. The data communication between PIC16F84A and PIC16F877A is asynchronous serial communication. The output current of
142 Universities Research Journal 2011, Vol. 4, No. 4 microcontroller is not enough to transmit infrared single for a distance of 1 m. To solve this problem, Darlington connection is used. Using Darlington connection, the infrared signal can reach about 12 m. There are many illumination sources, such as fluorescent lamps or sunlight can introduce light noise that can interfere with proper data reception. To overcome this problem, it is arranged in such a way that keyboard data transmitter transmits three start bits and eight data bits. In the receiver unit, the control program exits the interrupt subroutine if the three start bit is incorrect. If the infrared receiver receives error signal, the controller is said to be ready for next infrared signal. The microcontroller does not provide the scanning for the error signal. In the data receiving system, the binary-1 state and binary-0 state are classified by the period of the low state. The active time of binary-1 state is 1 ms and binary-0 state is 0.25 ms. There is a relax time between every two data bits. So the incoming data is identical with the data format of this system. Otherwise the data receiving system does not accept the incoming data for scanning process. So other infrared transmitters cannot easily control the display system of this keyboard controlled scoreboard. The photographs of display form and internal circuit diagram of the system are shown in Fig.9 and Fig. respectively. Fig.9. The photograph of display form of the system
Universities Research Journal 2011, Vol. 4, No. 4 143 Fig.. The photograph of internal circuit diagram of constructed system Conclusion A keyboard controlled scoreboard has been designed and constructed. In the display system, the microcontroller PIC16F877A is used as a control device. The microcontroller is scanning characters on the 8 8 LED dot-matrix display screen. Generally, one microcontroller is scanning four characters. So, the duty cycle of one LED is 5 percent. Therefore, the brightness of the LED is reduced. To avoid this problem, the number of scanning characters must be reduced. Otherwise the many microcontrollers are to be used for scanning process. The display of scoreboard can be seen clearly when the bright light of site is 150 Lm. The bright light of ordinary room is between 138 Lm and 150 Lm. Therefore this scoreboard is suitable for indoor games. If this scoreboard will be used for outdoor games, the display LEDs should be replaced with super bright LEDs.
144 Universities Research Journal 2011, Vol. 4, No. 4 Acknowledgements The authors would like to thank Professor Dr Khin Swe Myint, Rector, University of Mandalay, for her encouragement. We are also grateful to Professor Dr Daw Yin Mya, Head of Department, Department of Physics, University of Mandalay. References Horowitz, P. and Winfield, H. (2006). The Art of Electronics, Cambridge University Press, United Kingdom. Smitch, D.W. (2006). PIC in Practice, Second Edition, Cepha Imaging Pvt Ltd, India.