Abstract:
A microcontroller for providing remote control of electrical switches and comprising a control unit and a switch unit. The control unit comprises a telephone interface, a keyboard, a central processing unit and a character pattern interface. The switch unit comprises a data decoder, a central processing unit and a plurality of solid state relays, wherein the solid state relays are controlled to selectively connect power to loads or disconnect power therefrom, in response to commands sent from the keyboard directly, or through a telephone or radio telephone or a computer network from the keyboard.

Description:
BACKGROUND OF THE INVENTION 
     The present invention relates to microcontrollers, and more particularly, the present invention relates to a microcontroller used in controlling switches by means of the operation of a software program controlled keyboard and central processing units. 
     Conventionally, an On/Off switch used in controlling an electric appliance is operated manually. Therefore, a conventional On/Off switch can&#39;t be controlled remotely through a telephone. Further, when several On/Off switches and several loads are to be connected to a common electric socket, more electric wires are to be used, and more labor is required. 
     SUMMARY OF THE INVENTION 
     The present invention has been accomplished under the aforesaid circumstances. It is therefore an object of the present invention to provide a microcontroller which permits a switch or switches to be controlled through a telephone, a mobile telephone, or a computer network. It is another object of the present invention to provide a microcontroller for controlling electrical switches, which greatly reduces electrical wiring materials and labor cost. 
     According to the present invention, a microcontroller is generally comprised of a switch unit controlled by a control unit. The control unit comprises a central processing unit (CPU), an address latch, a read only memory, a character pattern interface, a keyboard decoder, a keyboard, line drivers/line receivers, dual tone multifrequency (DTMF) unit, an electrically erasable programmable read only memory (EEPROM), and a transmitter interface. The switch unit comprises a power source, a data decoder, a central processing unit (CPU), an electrically erasable programmable read only memory (EEPROM), and a plurality of solid state relays. Transmit codes, function codes, switch codes and execution codes are given through the keyboard and sent through the transmitter interface to the central processing unit of the switch unit via its data decoder, to control designated solid state relays, and in response, the loads at the designated solid state relays are controlled. By means of the telephone interface, instructions can be sent to the control unit through a standard telephone or a mobile telephone, or through a computer network. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is a block diagram of the control unit and the switch unit of the preferred embodiment of the present invention; 
     FIG. 2 is a circuit diagram of a solid state relay according to the present invention; 
     FIG. 3 is a plan view showing that the solid state relay has been made in the form of an integrated circuit; 
     FIG. 4A is a circuit diagram of a system for power distribution according to the prior art; 
     FIG. 4B is a circuit diagram of a system for power distribution according to the present invention; 
     FIG. 5 is a structural chart of a data code according to the present invention; and 
     FIG. 6 is a chart showing the distribution of a high frequency carry and transfer data according to the present invention. 
    
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT 
     Referring to FIG. 1, the present invention is generally comprised of a control unit A which comprises a central processing unit (CPU) 101, an address latch 102, a read only memory (ROM) 103, a character pattern interface (CPI) 104, a keyboard decoder 105, a keyboard 106, a first line driver/line receiver 107, a dual tone multifrequency (DTMF) unit 108, a second line driver/line receiver 109, an electrically erasable programmable read only memory (EEPROM) 110, and a transmitter interface 111; and a switch unit a which comprises of a power supply 300, a data decoder 30], a central processing unit (CPU) 302, an electrically erasable programmable read only memory (EEPROM) 303, and a plurality of solid state relays 304. 
     The CPU 101 is a micro controller which controls the operation of all the interfaces of the control unit A and a counter therein. The oscillating frequency of the CPU 101 is determined according to the desired application. The address latch 102 is an interface for coupling the the CPU 101 and the ROM 103. The ROM 103 provides a means for storing the programs to be used. The nature and capacity of the ROM 103 is determined according to the function of the control unit A and the number of switches in the switch unit B. The character pattern interface 104 comprises a character pattern board and is used in displaying a transmit code, function code and switch code from the CPU 101. The keyboard decoder 105 decodes the data from the keyboard. The keyboard 106 achieves data input using a process of multiplex scanning. Scanned data from the keyboard 106 is decoded by the keyboard decoder 105 and is then sent through the first line driver/line receiver 107 to the CPU 101. The data will further be transmitted from the CPU 101 of the control unit A to the CPU 302 of the switch unit B via the transmitter interface 111 and the data decoder 301. When a ringer data is produced through the telephone interface of a telephone, the ringer data immediately causes the CPU 101 to stop its operation. One to five seconds after ringing, the telephone is automatically connected, and the ringer data is sent to the DTMF unit 108 for decoding. After decoding, the data is sent through the second line driver/line receiver 109 to the CPU 101, and is then transmitted to the CPU 302 of the switch unit B via the transmitter interface 111 and the data decoder 301. The EEPROM 110 is directly coupled to the CPU 101 to prevent registered data from being erased during a power failure. The transmitter interface 111 is a high frequency transmitter for transmitting output data from the CPU 101 to the switch unit B through a distribution line for an AC power source. Output data from the CPU 101 includes a transmit code for recognition by the switch unit B, function code for controlling an On/Off status of the switch unit B and its other specific functions, and switch code to give each switch of a plurality of switches connected to the switch unit B a communication code designating a particular one of the switches. 
     The high frequency transmitter signal from the transmitter interface 111 of the control unit A is detected and decoded by the data decoder 301 and is converted into a low frequency signal for the CPU 302. Input data from the data decoder 301 is compared with a default in the CPU 302. After recognition, the CPU 302 gives an output voltage to the two input terminals 504 and 505 (shown in FIG. 2) of the corresponding solid state relay 304. This causes an input indicator lamp 501 to be turned on. If the two terminals 506 and 508 of a load receive electric power from the two output terminals 506 and 507 of the solid state relay 304 and the two AC power supply terminals 507 and 508, the load is electrically connected, and therefore, the output indicator lamp 502 is turned on. If the input data from the data decoder 301 is not in conformity with the default, the CPU 302 gives no output voltage, and therefore, the relays 304 are at an &#34;OFF&#34; status. The power source 300 provides the the data decoder 301, the CPU 302 and the EEPROM 303 with the necessary working voltage. The EEPROM 303 is provided for storing the default, namely, the predetermined transmit code, function code and switch code. 
     Referring to FIG. 1 again, the default of the predetermined transmit code, function code and switch code is stored in the EEPROM 303 and controlled by the software program designated at the &#34;S&#34; key of the keyboard 106. The software program which compares an input signal with the default, is stored in the read only memory inside the CPU 302. The switch unit B of the present invention can be fastened to industrial control equipment and controlled by the control unit A through a telephone, a radio telephone or a computer data network. The operation of the present invention is outlined hereinafter. The &#34;S&#34; key of the keyboard 106 is pressed for system set up. When the system is set up, it provides three functions. The first function of the system setup program is to get the control unit A ready to start On or Off operations. Pressing the &#34;S&#34; key of the keyboard 106 causes the keyboard 106 to send a signal to the key board decoder 105. After decoding by the key board decoder 105, the signal from the keyboard 106 is sent through the first line driver/line receiver 107 to the CPU 101 for processing, causing the CPU 101 to provide a signal to the ROM 103 via the address latch 102. Upon receipt of the signal, the ROM 103 triggers the character pattern interface 104 to display a cross bar directing input of a password. The number of elements in the cross bar is not limited. The option of password function may be designated at the &#34;1&#34; key or any of the other numeric keys. The second function of the system setup program is to set a telephone control code. When a user wishes to control the microcontroller through an external telephone, the user dials the subscriber&#39;s telephone number, the telephone control code, the function code, and the switch code. The telephone control code may be designated as the &#34;2&#34; key or any of the other numeric keys. The third function of the system setup program is counting time. A time count is simultaneously displayed through the character pattern interface 104. The option of the time counting function may be designated at the &#34;2&#34; key or any of the other numeric keys. However, the option key for the function of setting the telephone code shall not be used for the function of counting time. The &#34;R&#34; key of the keyboard 106 is designated as the function key. For executing an &#34;ON&#34; operation, the &#34;*&#34; key is pressed or a numeric key is set. For executing an &#34;OFF&#34; operation, the &#34;#&#34; key is pressed or another numeric key is set, and then the &#34;Q&#34; key is pressed. The &#34;Q&#34; key is equivalent to a RUN key. Before pressing the &#34;Q&#34; key, the character pattern interface 104 operates in the same manner as the operation controlled by the &#34;S&#34; key. When the &#34;Q&#34; key is pressed, the CPU 101 converts the data in its internal random-access memory into a series information code and sends the series information code to the data decoder 301 of the switch unit B through the transmitter interface 111. The series information code from the CPU 101 may be modulated into a high frequency signal for transmitting to the data decoder 301 through the electric line of the AC power source. The series information code from the CPU 101 may also be transmitted to the data decoder 301 by the transmitter interface 111 using a radio frequency transmission. 
     Referring to the circuit diagram of the solid state relay 304 as shown in FIG. 2, there are provided a power indicator lamp 503, an output indicator lamp 502, and an input indicator lamp 501. The power indicator lamp 503 denotes the connection of electrical power to the switch unit B. The input indicator lamp 501 is for indicating and &#34;ON&#34; or &#34;OFF&#34; execution of the operation. The output indicator lamp 502 denotes the connection of electrical power to the load. When electrical current passes through the load, the output indicator lamp 502 is turned on. When there is no electrical current sent through the load, the output indicator lamp 502 is turned off. By means of the aforesaid arrangement, the operation of the switch unit B is completely indicated, and therefore, no digital display is required. FIG. 3, wherein illustrates the solid state relay as being made in the form an IC. Shown externally on the IC are the load terminals 508 and 506, the power input terminals 508 and 507, the input indicator lamp 501, the output indicator lamp 502 and the power indicator lamp 503. 
     Referring to a conventional technique illustrated in FIG. 4A, four electrical lines are required in order to control two lamps and one socket through two switches. Referring to the circuit diagram of FIG. 4B, for controlling two lamps and one socket through two switches according to the present invention, only two electric lines are required. As illustrated in FIG. 4B, the control unit 601 is connected to the electric lines at any suitable location, and the two lamps and the one socket include the switch unit 602. Therefore, the present invention makes wiring easy. 
     Referring to FIG. 2 again, the solid state relay 304 is a zero voltage closing relay. Besides the three indicator lamps, the solid state relay 304 adopts a photoelectric cell coupling method to effect electrical coupling of the socket. When the diode of the photoelectric cell coupler 509 is electrically driven, the photoelectric cell provides a voltage in response to light from the diode. The intensity of the voltage from the photoelectric cell may be determined according to the capacity of the photoelectric cell used. The voltage from the photoelectric cell is sent to a first silicon-controlled rectifier (first SCR) 510 between its gate and negative pole, thus causing the SCR 510 to be turned on. DC high voltage from the first SCR 510 is then sent to the gate of a second silicon-controlled rectifier (second SCR) 511 causing it to be electrically conductive. When the second SCR 511 is electrically conductive, the bridge rectifier 512 is electrically connected to turn on a TRIAC 513, and therefore, the two terminals 506 and 508 of the load are electrically connected to the power input. The resistors 514 and 515 and the transistor 511 constitute a zero voltage closing circuit for controlling the operation of the gate of the second SCR 511. If rectified impulse high voltage is higher than a specified voltage, the transistor 516 is turned on. Therefore, the rating voltage of the resistors 514 and 515 controls the operation of the transistor 516. When the transistor 516 is turned on, the gate of the second SCR 511 becomes short-circuited, and the corresponding solid state relay turns off. When the DC high voltage is below the specified voltage, the transistor 516 is off, the second SCR 511 is electrically conductive, and therefore, the corresponding solid state relay turns on. 
     Referring to FIG. 5, therein illustrated is a chart showing the structure of the data code according to the present invention. The transmit codes 701, the function codes 702 and the switch codes 703 are respectively formed of a pulse. Each unit pulse represents a bit. A start code 704 is set for each data code. A stop code 705 is provided when a data code is terminated. The start code 704 and stop code 705 are provided for recognizing the transmit codes 701, the function codes 702 and the switch codes 703 from one another. 
     Referring to FIG. 6, the high frequency data code 801 is placed on the sinewave of the 60 HZ or 50 HZ AC power source 802. The high frequency data is transmitted twice within a 360° cycle of the power sources sinewave. In particular, 90° and 270° are the points of demarcation. In other words, the band width for the high frequency data code 801 is defined between the 90° point and the 270° point electric of the sinewave.