Controlling Remote Thlectrical AppliancesVia The Mains SupplyThis invention relates to controlling remote electrical appliances via the mains supply.
This invention is particularly concerned with an arrangement having a control terminal for transmitting and receiving mains borne data packets and a plurality of remote terminals for controlling the electrical. appliances in response to receipt oi-. such data packets. Typically each remote terminal will. be arranged to transmit a mains borne data packet tor the controller in response to receipt of a data packet from the controller for controlling an appliance associated with that terminal.
Each terminal may have a processor and the clocks of the processors may drift very s.lightly over a period of time. This may resu3t in some of the terminals sampling the waveforms at a non--optimum point, so that the message may be decoded erroneously, that is, sunless very frequent sampling is employed which is itself undesirable.
The invention provides apparatus for controlling remote electrical appliances via the mains supply, comprising a controller terminal for transmitting mains borne data packets and a plurality of remote terminals for controlling the electrical appliances in response to receipt of such data packets, each terminal being arranged to sample the mains at one rate to detect the presence o otherwise of data packets, and to sample the mains at a faster rate when a synchronisation waveform has, been detected in order to determine accurately the timing of a particular characteristic in the synchroni.sat.ion waveform, to enable the terminals to be synchronised.
The invention provides a method for controlling remote electrical appliances via the mai.ns supply in which a controller terminal. transmits and receives mains borne data packets and electrical appliances are controlled in response to receipt of. such data packets by a plurality of data terminals, each terminal sampling the mains at one rate to detect the presence or otherwise of a data hase packet and sampling the mains at a faster rate when a, synchronisation waveform is detected to determine accurately the timing of a particular characteristic in the synchronisation waveform, and synchronising the terminals.
The higher speed sampling mode to detect the particular characteristic enables the terminals to be synchronised enabling all terminals to sample messages at the optimum point without continual very frequent sampling.
The particular characteristic may be a rising or falling edge, and the synchronisation wave form may include three bits of one parity eg. three O's followed by one bit of the opposite parity eg. a "1", but preferably includes four bits of one parity followed by one bit of the opposite parity. Thus, the terminals may samp.le at a rate of once per bit of the data packets, and the detectors may be arranged to sample at a faster rate once two (or three in the case of four bits of the same parity) bits of the same parity have been detected. This will enable the rising or falling edge to be accurately detected, so that the terminals can be synchronised and sampling can be carri.ed out at an optimum point in a following bit interval.
Apparatus for and a method of controlling remot,e electric appliances via the mains supply will now be described, by way of example, with reference to the accompanying drawings in which:Figure 1 is a block diagram of the apparatus; Figure 2 shows the interface between a terminal andthe mains supply;Figure 3 shows schematically an example of si.gnalswhich could be present on the mains in a condition of highbus activity;Figure 9 shows schemati.cally an example of signalswhich could he present on the mains in a condition of lowbus act.ivit.y;Figure 5 is an enlarged view of part of Figure 3;Figure 6 shows an example of different signals whichcould be present on the bus, to the same scale as Figure 5;;Figure 7 shows the arrangement of bytes in the startof the messages and. responses shown in Figures 3 and 4; andFigure 8 shows a part of the synchronisation ode onan enlarged scale.
Referring to Figure 1, a number of electricalappliances such as a lamp 1, a temperature sensor 2, a lamp 3, and a heater 4 are connected to the mains supply via respective terminals 6 to 9. Two of the terminals 6, 8 (gateway terminals) are provided with infra-red transmitter-receivers (not shown) to communicate with handsets TRl, 1R2 also provided with transmitter-receivers.
The terminals each include micro-processors which control the electrical appliances in accordance with data packets received from a bus (mains) controller terminal 10 which also includes a micro-processor, and which is in turn controlled by a micro-computer 11, which incorporates a display 32. The handsets TR1, 1R2 also incorporate micro-processors, and terminals 6, 8 each include two micro-processors each, one for processing the infra-red signals communicated between the terminals and the handsets, and the other for receiving signals from and transmitting signals onto the mains.
Each terminal 6 to 9 and the controller 30 each include a transceiver chip 13 (Figure 2) which is controlled by the respective micro-processor of that unit..
In particular, each chip includes three connections Din (data in), Dout (data out), and T/R connected to the respective micro-processor. When the connection T/R' is high, the chip transmits data from the micro-processor to the mains, and when it is low, the chip receives data from the mains. In the former situation, the output connection o/p transmits a carrier wave of approximately 15 volts peak to peak to the winding on one side of transformer 14, which forms a tuned circuit with capacitor 15. A blocking capacitor 15a connects the other winding to the mains.The transformer is 3:1 step-down transformer so that approximately a 5 volts peak to peak carrier wave is impressed on the mains voltage. in the case of a system for use within a household, a filter is provided at the fuse hox to prevent the data packets being transmitted onto the mains outside the household, as well as to attenuate noise already on the mains that is being fed in. The chip uses frequency shift keying (FSK) the carrier frequencies being 130 or 134 -kHz, and data can be transmitted and received at. the rate of 2400 bits/second.
Referring -to Figures 3 and 4, in a condition of high bus activity, messages wi]l be transmitted by the controller terminal to respective remote terminals and, after prede.termined delays, responses will be sent. out by the respective remote terminals. The messages will be queued in the micro-computer 11 and fed to an internal queue in the controller 10 in turn at appropriate intervals. Thus, message 3 could be an instruction to turn lamp 1 on and message 2 could be an instruction to read temperature. In each case, the message duration is 35 bytes (8 bits to a byte) although the message could he up to 43 bytes long. A message specifies where the message is being sent from, the destination to which it is being sent, and the data content representing the operation to be performed.After the message 1 is transmitted by .the controller, each terminal receives it and start decoding it to ascertain if it is intended for that terminal. As soon as it terminal has decoded the signal sufficiently to ascertain that it is not intended for that terminal, it discards the remainder of that message.
When the terminal for which the message is intended confirms that the message is intended for itself, and after the message has itself ended, that terminal transmits, after a delay of 22 bytes from the end of the message, a response to the controller to confirm the message has been received. The response is in the same format as the message i.e. address of originating terminaL, address of destination terminal and data content, and also lasts for a duration of 15 bytes (but could be up to 43 bytes).
The other terminals will also receive the response, and will discard them when they have read its destination address, so that only the controller will respond to the data in it. After a delay of 22 bytes from the end of the response, the next message is sent out, and this could be for example an instruction to read temperature sensor 2.
The regular transmission of messages and receipt of responses only applies of course in a period of high bus activity eg. when the micro-computer is holding a stack of messages to be sent out. In a situation ,.of low bus activity dummy messages of length 16 bytes are sent out at regular intervals, this time spaced by the longer interval of 87 bytes. The messages preserve the structure of the normal messages but do not result in any operation being preformed on any appliance. The purpose of these dummy messages is to maintain synchronisation of the terminals, each of which has its own clock. This will be explained hereinafter in detail with reference to Figures 7 and 8.
In either case of high or low bus activity, it will be noted that a delay follows each message or dummy message. This is made use of (Figure 5 and Figure 6) in, the following way. Various given times in the delay are allocated to various functions to enable the controller to receive messages in the delay period.
Thus, safety/security or failure notification messages from the terminals commence at the second byte,IR1 handset messages commence at the sixth byte, IR2 handset messages commence at the tenth byte, and there is provision for the fourteenth and the eighteenth bytes to be allocated to additional IN handsets. There are three bytes between those in which transmission can commence, to enable terminals to recognise that a data packet is being transmitted and hence inhibit transmission.
In a conventional bus communication system where a controller is provided, no terminal would be able to transmit onto the bus unless it had first received a message from the controller. It would in theory be possible to adapt this to the use of handsets in the sense that a handset would signal to a terminal that it wished to pass a message to the controller and the controller could periodicalLy poll the terminals to ascertain if any messages were waiting. In practice, however, it would lead to an unacceptably . long delay before the message had been communicated to the controller and a response had been received at the handset, unless very rapid poling was employed, which would be extremely inefficient on the bus time.
The allocated byte slots circumvent this problem without subst.antialjy increasing the risk of collision.
Thus, TR1 can signal to terminal 6, or to any other gateway terminal able to receive and transmit infra-red radiation and, after sending an acknowledgement to the handset to confirm receipt of the message, the gateway terminal is ready to send a message to the controller.' In the sixth byte slot. after the end of a message, or a response to a message, or a dummy message, the terminal transmits its gateway message onto the mains.
The other remote terminals read this message and, since it is not addressed to them, discard it. However, where the last data packet on the mains was a message to a particular remote terminal, that terminal refrains from sending the response it was going to send. The controller receives the message and sends out an acknowledgement of duration 7 bytes to confirm detection of the message. At this point, the terminal that was due to send its response, having detected the acknowledgement now transmits its, response. The controller then generates the appropriate message to fulfill the instruction given by the handset.
This is followed by a response in the usual way.
Fach terminal, that is controller or remote terminals, has to count the "bytes slots in order to insert or look or a message at the appropriate time.
Consequently, at the end of each message, or response, or gateway message or acknowledgement or dummy message, all terminals re-set so that the first byte following thereafter is counted as number one by all terminals.
Similarly, 1R2 and the two further possible handsets can have rapid access to the bus without destroying the collision avoidance arrangement.
The second byte slot is allocated to a safety/security and failure notification messages which need very rapid access to the bus for obvious reasons and, since they are transmitted in the second byte, this gives them priority of over all other messages. For example, one terminal could be connected to a smoke detector or another to a infra-red proximity detector focussed on an area outside the household using the system. Equally, a lamp could fail and its terminal would need to signal this.
Thus, any remote terminal might need to send a message to, the controLler. Consequently, in the second byte, any such terminal can signal to the controller, which responds after a delay at the end of that message with a special acknowledgement to verify detection of the message. A suitable warning could be activated in the household. or example, in the case of a proximity detector focussed on an area outside the front door, an image of any person outside could be inset on a television being viewed.
Such messages will not arise often, so the fact that collision is possible here will not cause a problem. -In the event of two remote terminals attempting to transmi't at the same time, the message will he garbl.ed and the controller will not be able to detect any message. Thus, if the messages do not receive an acknowledgement, they each try to re-transmit in the second byte slot after a pseudo-random number of frames i.e. message-gap-response periods.
Referring to Figures 7 and 8, the method of synchronisation of the clocks in each of the terminals will now be described. The first two bytes of each message, response, dummy message or acknowledgement are respectively, a preamble and synchronisation code. The preamble is in the form of alternate 1 bits and 0 bits...
Al3 terminals are designed to synchronise to the carrier frequency, detect such a pattern, and set any automatic gain controls. The next bytes of each data packet is a synchronisation code consisting of four 0 bits followed by 1 bit: the following three bits can each be either 0 or 1.
Each terminal samples the mains at the rate of once per bit. The need for the synchronisation code arises because each terminal has a separate clock which could drift relative to the others, perhaps only be a few hundereds of micro-seconds, between messages. While this might not matter if muLtiple samples, say, 2 or 4 per ' bit were employed, which carries the penalty of .a resultant loss of background processing time, it does matter in the case where a single sample per bit is taken, because the sampling may then take place at a non-optimum point in a bit interval (i.e. not at the centre of the bit, the optimum point) causing the message to be decoded erroneously.
Consequently, referring to Figure 8, in the next byte, each terminal samples three O's, because no matter where the sampling takes place in a time drifted period, three O's will always be detected. Once three O's have been detected, the processor of each terminal changes to a higher speed sampling mode (8 times per bit), awaiting the rising edge of the "]" following. If no "1" appears in the next two bit periods, then once per bit sampling is reverted to. This gives the processor of each terminal maximum time for other tasks. In an FSK environment, the data line is very rarely stable in the presence of just noise, so the high speed sampling scheme is called for only occasionally.
Once a rising edge has been fond, each processor waits for half a bit, and then reverts to sampling once.per bit The processors are now sampling at the optimum -time in each bit.
The remainder of the synchronisation code is then read in and checked. If it is a valid code, then there is a high probability that a message has just appeared on the mains. If desired, the following byte can be coded to give a further check that the genuine data packet is being received. The message proper could then commence after this fo3Jowing byte.
If three O's are detected, but a rising edge is not detected (i..e. X further 0 is detected), or if the remiander of the synchronisation code is found to b incorrect, the processors revert to their previous timing.
Of course, instead of looking for four O's followed hy a 1, the synchronisation code could instead use four l's followed by a 0. These five hits could appear in any position within a byte,. Further, a code consisting of three O's and one o or three 3's followed by one 0, or consisting of two O's followed hy one 1 or two 11s followed by one 0, could be used instead, the principle of detecting the rising edge at a faster rate being the same.
Of course, various modifications may be.made without departing from the scope of the invention thus, different message lengths, gap lengths and acknowledgement lengths as well as dummy message lengths may be employed. Equally, more infra-red s3ots could be provided in the inter-message gap. Also, all terminals could be provided with a infra-red communicating facility, inc3uding the controller, and the display of the controller could be provided with a touch-sensitive screen in order to enable commands to be entered at the controller. Further, although the infra-red communicating gateway terminals have been described as controlling an electrical appliance, they need not do so and could simply act as the interface between the infra-red handsets and the bus. Equally, although it has been stated that infra-red handset messages control the respective electrical appliance via the controller 10 (in the sense that the controller 10 issues the command to the remote terminal controlling the electrical appliance), it would be possible for the gateway message placed on the bus by the gateway terminal to address (and control) the terminal related to the appliance it is desired to control directly.