Microcomputer Based Multipoint Time Operated Power Switching System (With Overload Protection)

The objective of this research is to design a “Microcomputer Based Multipoint Time Operated Power Switching System” (


INTRODUCTION
The subject of time and the traditions surrounding it is sometimes taken for granted, especially in Africa where we do things and say "African Time". But have we ever considered an industrial production process where events done in time, were neglected for once or to heat a delicate substance for a specified period of time was over looked; losses may amount. Even our day to day activities is guided by time, time to sleep, time to wake, time to eat etcetera. Hardly anything is done without time. Time can be set from a few seconds to several hours converted in seconds as one chooses. Microcomputer Based Multipoint Time Operated Power Switching System" (with overload protection) can time events, intervals of time and can definitely control A.C. appliances; it will trigger a relay when it has timed down [1,2]. It may be used for dark room or PC board exposure timer, exit room timer. It can be used in laboratories, kitchens, washers, dishwashers, driers, and for competitions in educational institutes, and can power any electrical appliance rated below 1000 Watts or more. Also other parameters or features implemented in the research are the overload protection, voltage level display which is measured using a voltage monitor and an Analog to digital converter (ADC0804). The research can find uses in several applications [3].
This research is justified on the basis of the purpose and importance of Timed Control and Power regulation in various aspects. Timers are in homes, Laboratories, Industries, Sports arena, Gadgets or devices and Schools, and even in Offices. The main purpose of a Timer is not always only to keep interval of preset time but can also be used to control devices according the preset time, e.g. an alarm clock, a VCR, an egg timer or a time bomb [4].
Practically all computers depend on an accurate internal clock signal to allow synchronized processing [5]. A few researches are developing CPUs based on asynchronous circuits. Some computers also maintain time and date for all manner of operations whether they are for alarms, event initiation or just to display the time of day. This simple and flexible timer is accurate like the real-time clock of the computer used for the purpose [6]. The timer is software based; the program written in Visual Basic is selfexplanatory. In this research, "Microcomputer Based Multipoint Time Operated Power Switching System", exposition will be done on how application software can be used to implement Timer and Control functions on a Microcomputer [7].

The Timer
A Timer is a specialized type of clock. A timer can be used to control the sequence of an event or process [5,8]. Examples include: Mechanical timers, Electromechanical Timers, Digital Timers and Computer Timers.

Parallel port basics
In computers, ports are used mainly for two reasons: Device control and communication [9,10]. We can program PC's parallel ports for both. Parallel ports are mainly meant for connecting the printer to the PC. But we can program this port for many more applications beyond that.
Parallel ports are easy to program and faster compared to the serial ports. But main disadvantage is it needs more number of transmission lines. Because of this reason parallel ports are not used in long distance communications [11]. Let us know the basic difference between working of parallel port and serial port. In serial ports, there will be two data lines: One transmission and one receive line. To send a data in serial port, it has to be sent one bit after another with some extra bits like start bit, stop bit and parity bit to detect errors [12]. But in parallel port, all the 8 bits of a byte will be sent to the port at a time and an indication will be sent in another line. There will be some data lines, some control and some handshaking lines in parallel port [13].

Design Approach
Each individual module was designed and constructed separately. After successful simulation and testing, they were put together to create the finalized version.

Software Development
There are different types of interfaces depending on the application, but they are all used to convert a program so that an electrical or a robotic device can be controlled. Interfaces can be connected to any computer because they all do the same job [14,15]. A typical example is a relay board. A 'Relay Board is a Smart Box', a common interface and they can be connected to most types of computer with parallel port. It is possible to connect up to eight devices such as motors temperature sensors, movement sensors; light sensors and data acquisition etc.

Fig. 2. Typical parallel port interface
Digital outputs are items such as speakers, lights, buzzers, LEDs and circuits etc. Digital inputs are devices such as micro-switches and relays. They are either 'on' or 'off'.

Out Putting Data to the Parallel Port: Relay Interface
To output data to a parallel port is simple and straight forward. All that is needed is a 25 pin D connector, a relay board that comprises of Resistor to limit current, Transistors or relay driver modules like (ULN2803) and 5V power supply. Then locate the parallel port data lines (D0-D7) which are pins (2-9) and the port ground pins (18-25); then attach the board.
Using a typical Visual basic code -Port out (port address, value), example Port Out (888, H01); this will energize relay at D0 (Pin2) particularly. This relay will have a Logic 1or High (5V) data written to the data line. Subsequently a logic zero (0) written to the data line well de-energize the relay.

Reading Data from the Parallel Port
Parallel port status and control lines for reading data from the parallel port is explained in the figure below. However to avoid conflicts and non-compatibility, the Nibble mode is the preferred way of reading 8 bits of data without placing the port in reverse mode and using the data lines [19,20]. Nibble mode uses octal buffers and line drivers with 3state outputs (74ls244) or a Quad 2 line to 1 line multiplexer (74LS157) to read a nibble of data at a time. Then it "switches" to the other nibble and reads it. Software can then be used to construct the two nibbles into a byte. The only disadvantage of this technique is that it is slower. It now requires a few I/O instructions to read the one byte, and it requires the use of an external IC.

Fig. 4. Input interface
The diagram above shows 4 input lines of the parallel port.

Voltage Measurement and Calibration
This is done using the ADC0804 input channels (D 0-D1). Here to set the voltage, the potentiometer VR. Adj is connected to +9V half wave rectifier through the 5V zener diode. For the purpose of testing, you can vary VR1 to adjust the voltage from 0 to 5V.
For this, transformer half wave rectified supply provides a proportional voltage to the ADC chip. The VR. Adj. point gives a voltage that varies with mains voltage. At exactly 220V mains, the 9V transformer gives a peak voltage of approximately, 9V -Diode drop (0.7V) = 8.3V. At point V R Adj the value is 2.3 V. It increases approximately to 5V when the mains voltage rises to 259V and drops to zero when mains voltage drops to 172V in effect, giving 0 to 5V over this range. The Value of VR1 is in such a manner that the output Voltage is never greater than 5.0V.

Fig. 5. Voltage measurement
With this arrangement the high voltage and low voltage protection can be implemented. Likewise the overload protection function is also implemented and it arises when there is low voltage the component being power will tend to draw more current causing an overload [21,22]. However this is prevented, by detecting the low voltage and high voltage situations. Also when a short circuit happens, the current increases drastically and voltage drops drastically this situation is also detected by low voltage function.

Voltage Calibration
The input voltage from normal AC to worst case conditions 259V can be adjusted from 0 to 5V because the ADC can only measure voltages between 0 -5V and represent the values measured as a 8 bit binary number from 0 -255.
In order to determine the voltage increments which can be measured one has to divide the scaled input voltage by 255 and that equals: 15V/255 = 58.8 mV.approx 59 mV.
This means that at every count of ADC voltage increases by 59mV. With this idea the AC voltage can easily be measured.

Functional Description
The ADC0804 contains a circuit equivalent of the 256R network [23]. Analog switches are sequenced by successive approximation logic to match the analog difference input voltage [V in (+) − V in (−)] to a corresponding tap on the Rnetwork. The most significant bit is tested first and after 8 comparisons (64 clock cycles) a digital 8-bit binary code (11111111 = full-scale) is transferred to an output latch and then an interrupt is asserted (INTR makes a high-to-low transition). A conversion in process can be interrupted by issuing a second start command [16]. The device may be operated in the freerunning mode by connecting INTR to the WR input with CS =0. To ensure start-up under all possible conditions, an external WR pulse is required during the first power-up cycle.
On the high-to-low transition of the WR input the internal SAR (Successive Approximation Register) latches and the shift register stages are reset. As long as the CS input and WR input remain low, the A/D will remain in a reset state. Conversion will start from 1 to 8 clock periods after at least one of these inputs makes a low-tohigh transition.
A functional diagram of the A/D converter is shown in Fig. 6. All of the package pin outs are shown and the major logic control paths are drawn in heavier weight lines. The converter is started by having CS and WR simultaneously low. This sets the start flip-flop (F/F) and the resulting "1" level resets the 8-bit shift register, resets the Interrupt (INTR) F/F and inputs a "1" to the D flop, F/F1, which is at the input end of the 8-bit shift register. Internal clock signals then transfer this "1" to the Q output of F/F1. The AND gate, G1, combines this "1" output with a clock signal to provide a reset signal to the start F/F. If the set signal is no longer present (either WR or CS is a "1") the start F/F is reset and the 8-bit shift register then can have the "1" clocked in, which starts the conversion process. If the set signal were to still be present, this reset pulse would have no effect (both outputs of the start F/F would momentarily be at a "1" level) and the 8-bit shift register would continue to be held in the reset mode. This logic therefore allows for wide CS and WR signals and the converter will start after at least one of these signals returns high and the internal clocks again provide a reset signal for the start F/F. After the "1" is clocked through the 8-bit shift register (which completes the SAR search) it appears as the input to the D-type latch, LATCH 1. As soon as this "1" is output from the shift register, the AND gate, G2, causes the new digital word to transfer to the TRI-STATE output latches. When LATCH 1 is subsequently enabled, the Q output makes a high-to-low transition which causes the INTR F/F to set. An inverting buffer then supplies the INTR input signal.
Note that this SET control of the INTR F/F remains low for 8 of the external clock periods (as the internal clocks run at 1⁄8 of the frequency of the external clock). If the data output is continuously enabled (CS and RD both held low), the INTR output will still signal the end of conversion (by a high-to-low transition), because the SET input can control the Q output of the

Fig. 6. ADC function diagram
INTR F/F even though the RESET input is constantly at a "1" level in this operating mode. This INTR output will therefore stay low for the duration of the SET signal, which is 8 periods of the external clock frequency (assuming the A/D is not started during this interval).
When operating in the free-running or continuous conversion mode (INTR pin tied to WR and CS wired low), the START F/F is SET by the high-to-low transition of the INTR signal. This resets the SHIFT REGISTER which causes the input to the D-type latch, LATCH 1, to go low. As the latch enable input is still present, the Q output will go high, which then allows the INTR F/F to be RESET. This reduces the width of the resulting INTR output pulse to only a few propagation delays (approximately 300 ns).
When data is to be read, the combination of both CS and RD being low will cause the INTR F/F to be reset and the TRI-STATE output latches will be enabled to provide the 8-bit digital outputs.
The complete circuit diagram, Visual Basic Timer program and the Visual Basic Timer program are presented below.

SYSTEM IMPLEMENTATION
Analysis of the theories in design and specifications was made to govern the construction. After successful simulation and testing, the research was put together to create the finalized version.

Component Sourcing
Gathering of components from the specification in the circuit design precedes assembly or construction of the project. We started with listing the component according to types and values.

Strip/Vero Board Construction
This involves the actual construction, which is the hard wiring of the circuit already prototyped. This consists of thin copper strips on one side and plain insulator board on the other side with hole at 0.1-inch matrix interval. Components are mounted on the plain side and soldered on the copper side. The copper strip runs from left to right and all components soldered on the strip are automatically joined together; where that is not required the strip is cut at appropriate point with drill or sharp object. All the components were mounted and soldered taking care that the transistors, electrolytic capacitors, diodes and the regulator were mounted the correct way round. While soldering the solder blobs should not touch the adjacent tracks otherwise there will be short circuit. Finally the IC should be mounted on the IC socket and tracks under the socket were cut to separate the pins.

Regulated Power Supply Design
This module will consist of a center tapped Transformer that will step down the AC voltages from 220V to 12 Vrms. Then this will pass through a Full Wave Bridge Rectifier and then a filtering capacitor to achieve close to DC voltage level.
The transformer, 220 to 12 volts. The secondary rms voltage is 12 Volt; we can calculate the V peak after the diodes, using the formula:

SYSTEM IMPLEMENTATION
Analysis of the theories in design methodology and specifications was made to govern the construction. After successful simulation and testing, the research was put together to create Implementation Included Four d Implementation. Strip/Vero Board Construction.
Gathering of components from the specification in the circuit design precedes assembly or construction of the project. We started with listing to types and values.

Strip/Vero Board Construction
This involves the actual construction, which is the hard wiring of the circuit already prototyped. This consists of thin copper strips on one side and plain insulator board on the other side punched inch matrix interval. Components are mounted on the plain side and soldered on the copper side. The copper strip runs from left to right and all components soldered on the strip are automatically joined required the strip is cut at appropriate point with drill or sharp object. All the components were mounted and soldered taking care that the transistors, electrolytic capacitors, diodes and the regulator were While soldering the solder blobs should not touch the adjacent tracks otherwise there will be short circuit. Finally the IC should be mounted on the IC socket and tracks under the socket were cut to separate the Design consist of a center tapped Transformer that will step down the AC voltages from 220V to 12 Vrms. Then this will pass through a Full Wave Bridge Rectifier and then a filtering capacitor to achieve close to DC voltage . The secondary rms voltage is 12 Volt; we can calculate the V peak after the diodes, using the formula: V DC(peak) = 12√2 -1.4 = 17 - 1.4 This is the maximum value, for knowing the minimum we need to subtract the ripple: Let's assume that the circuit we are going to feed requires that V ripple is not more than 2 Volt. Vmin = 15.6 -2 = 13.6V Choosing the Right Capacitor: The nearest available size is 2200uF. Now we need to know what is the maximum voltage that the capacitor is going to be exposed to. We must consider the worst case; this is the V rectified peak in no-load condition, which means without deducting the voltage drop on diodes: Available commercial values are 16V, 25V, 35V, 50V, 63V. Well, 25V is ok for us. So, our capacitor is completely defined as "Electrolytic capacitor 2200uF x 25V".

≈ 15.64V
This is the maximum value, for knowing the minimum we need to subtract the ripple: the circuit we are going to feed requires that V ripple is not more than 2 Volt.
The nearest available size is 2200uF. Now we need to know what is the maximum voltage that the capacitor is going to be exposed to. We must consider the worst case; this is load condition, which means without deducting the voltage drop on es are 16V, 25V, 35V, Well, 25V is ok for us. So, our capacitor is completely defined as "Electrolytic

The VB Programming Process
Create a new application or load an existing application. Insert the necessary object and adjust their properties and code where necessary. Test your application with the debugging tools Visual Basic supplies. The debugging tools help you ate program errors (or ) that can appear despite your best efforts to keep them out. A bug is a program error that you must correct (debug) before your program will execute However VB has quick compiler that once you are typing your program, it is compiling as you move to the next line. Then finally run your finished application Connect your computer interface and run the program, observe what happens.

Inspection and Resistance Tests
Inspection and resistance tests has to be performed before connecting power to the constructed circuit, to avoid system blowing up and hours of efforts will be frustrated. By inspection, it was ensured that all components had been well soldered and no bridges across conducting path. Using the ohmmeter at lowest range, it was ensured that there is no short circuit between supply live and neutral, and DC +ve and -ve lines. Then the system was connected to power.

D.C Voltage (Power Supply) Tests
The output voltage of the power supply was measured to be 12V and 5V respectively, which is the output of the voltage regulator in line with the specification.

Functional Test
Here the system is checked for performance as expected by connecting the system as show in the diagram below. The computer system was powered up, and then the Visual Basic Application program (Relay Board Timer) started. Next the control box was powered. An ON is set anytime it is intended to leave a device powered in the timer application software, finally the timer is started.
From observations, after a thorough testing of the program and the system in general, the system performed as expected, switching on the device and then switching it off immediately the preset time has elapsed. The timer program is interesting and shows features like elapsed time, ON (Green) and OFF (Red) Indicator colors, timer input error checks and voltage isolation features of the control box and so on.

CONCLUSION
The research, "Microcomputer Based Time Operated Power Switching System (with overload protection)", proved to be a very interesting research to embark on, however whenever there is a task to perform, there could be problems likely to come up. In the course of this research different designs were tried in other to come up with easier and simplified approach to the "Timer Program". Creating an error check in the program proved to be a challenging experience that demands a lot of thinking and trials.