IMPROVEMENTS RELATING TO ROTARY ENCODERS
This invention relates to a speed measurement device for measuring the speed of rotation and/or determining the angular position of a rotating member such as, for example, a shaft.
It is often desirable or even necessary to be able ' to determine the speed of rotation and/or determine the angular position of a rotating shaft driven by, for example, an electric motor. The need to control the speed of a rotating shaft arises in a wide range of situations. For example, in an industrial process it may be necessary to deliver fluid at a predetermined pressure to a particular location. A control system could be built in which the speed of an electrical motor is accurately monitored and controlled whereby the predetermined fluid pressure could be achieved.
A number of shaft encoders are available and are designed to provide speed and/or positional information relating to a rotating shaft in either absolute or incremental terms. A shaft encoder typically comprises an encoder disc mounted on the shaft and a number of sensors mounted at a static location nearby to the encoder disc, and optionally includes simple processing
electronics to amplify the outputs from the sensors prior to transmission over a transmission medium. The encoder disc includes markings arranged in a predetermined pattern which may be on one or both sides of the disc. The markings are detected by the sensors which produce signals corresponding to the markings and these signals can be interpreted by a control system to gain information relating to the speed and/or position of the shaft.
Figure 1 shows an example of typical signals which are produced by such a shaft encoder. Two pulse train signals A and B, of equal frequency, but with a phase displacement of 90 are produced having a frequency proportional to the speed of rotation of the shaft. The 90° phase displacement enables the direction of rotation of the shaft to be determined. For example, if A leads B the shaft may be defined to be rotating clockwise and if B leads A the shaft may be defined as rotating anti¬ clockwise- The encoder is arranged to produce a predetermined number of A and B pulses per revolution of the shaft. In addition to the two pulses A and B the encoder may include a once per revolution marker pulse M. The marker pulse M can be generated in a similar manner to the A and 3 pulses and may be used to determine when the shaft is in a predetermined position. By combining the information provided by the A, B and M pulses with
the knowledge that a predetermined number of A and B pulses correspond to one revolution of the shaft ttie control system is able to provide speed and directional information and is additionally able to determine the instantaneous angular pos.ition of the shaft; the angular position resolution being limited only by the number of A and B pulses produced per revolution of the shaft.
The on-off nature of the A, B and M signals dictates the best method of detection of the signals as being edge detection, that is the detection of a quick change in condition from on to off or from off to on. However, edge detection systems are particularly sensitive to noise when the signals are transmitted over any distance. Thus, if noise is allowed to corrupt the signal, any glitches generated by noise in the signal are likely to be detected as additional pulse edges. Any additional pulse edges thus detected in the signal result in the speed as measured by the control system being incorrect; leading to inaccurate control of the shaft.
Many techniques have been proposed to prevent pulsed signals from being corrupted by electrical noise. One of the more successful techniques is the use of 15V transmission levels applied to differential line drivers and receivers connected via shielded cables. Correctly applied, these techniques can be very succesful;
-1* -
incorrectly applied they can lead to disaster. For example, shielding the cables is a simple matter theoretically. However, in practice it is not uncommon for the power supply to a motor driving a shaft to be independent from the power supply to the signal and control system, in which case there will be separate ground planes for the motor power supply and the signalling system; and it is all too easy to inadvertently connect the cable shield to the power ground instead of the signal ground in which case the cables will not be protected by the shield but will instead be subject to additional noise injected via the shield.
The abovementioned techique of information transmission requires up to four twisted-pair cables all of which must be shielded to prevent corruption of the signals by electrical noise. The cost of installing these cables in a system where the controller is any great distance from the shaft it is controlling is very high. In addition, repeaters placed at suitable intervals along the length of the cable may be required if the length of the cables exceeds about 100m.
An alternative method of information transmission between the shaft encoder and the controller has also been proposed and is also readily available. This
alternative method uses a single twisted-pair shielded cable and associated electronics to transmit information serially from the encoder to the controller. Since there are three signals sharing the one twisted-pair cable, the electronics within the encoder must multiplex them into data packets and onto the cable. In addition to the information contained in the A, B and M signals, serial transmission requires so-called start and stop bits at the beginning and end of a data packet respectively to identify the start and finish of each data packet as it arrives from its source.
Figure 2 shows how such a data packet may be arranged during transmission. The three-bit data field holds information about the three signals A, B and M.
To avoid confusion between a start field and a data field, the start field contains a unique -4-bit data pattern which can be identified by the controller as signifying the start of a data packet. A 1-bit stop field identifies the end of the data packet. This arrangement requires an 8-bit data packet to transmit 3 bits of information (the sampled values of A, B and M) . Moreover, the A, B and M signals must be sampled at least twice as fast as the highest frequency of the signals, i.e. greater than twice the pulse frequency corresponding to the highest speed of revolution of the shaft, if
information is not to be lost. In practice the sample rate is greater than twice the frequency corresponding to' the maximum speed of revolution of the shaft and may be greater than eight times the speed of revolution. At this rate, the number of -data packets, and hence the number of information bits, transmitted per second is very high. At high frequency the band width of the twisted pair cable, that is the capacity of the cable to carry information, is a significant factor in determining the maximum controllable speed of the shaft. For example, If the three data signals A, B and M are sampled at eight times over frequency, it can be shown that the maximum controllable speed of the shaft (N) is calculated from the equation
N = 60 x B = revolutions per minute ... (1) 8 x p x n
Where: B is the Bandwidth of the transmission medium, that is the maximum data rate in
Bits/Sec;
P is the encoder resolution in pulses per revolution of the shaft;
N is the maximum speed of rotation of the encoder in Rev/Min; n is the bit length of the data packet.
Thus, the maximum controllable speed of the shaft is limited by the bandwidth of the transmission medium, the resolution of the encoder, and the bit length of the data packet. Moreover, in a particularly noisy environment, such as that which is commonly found where shaft encoders are used, a data packet transmitted over a twisted-pair cable may include additional error checking bits to compensate for any detrimental noise effects. Additional error checking bits increase the bit length of the data packet resulting in a corresponding reduction in the maximum controllable speed of the shaft.
The present invention aims to overcome these and associated problems by providing a secure medium for pulse transmission over which the three information signals A, B and M are transmitted and by providing an electronic circuit to transmit data relating to the three signals along the secure medium.
Thus in one aspect it is an object of the present invention to maximise the controllable speed of rotation of the shaft within the confines laid down by the bandwidth of the medium and the resolution of the encoder by minimising the number of bits in a data packet.
Thus in one aspect the invention provides a method of compressing the information signals into a narrower
bandwidth whereby an increased amount of information may be transmitted. For example, in an encoder arrangement deriving A, B and M signals as hereinabove described, the encoder can be arranged such that there are only a limited number of A, B, M combined states so that, rather than having to process Information representative of each A, B, and M signal which requires an extended bandwidth, it is necessar»y in accordance with the invention to process only information representative of a relatively low number of states.
As described hereinafter with reference to an exemplary embodiment of the invention, A, B and M signals can each be either "on" or "off" and the combinations available for A, B and M can have only five unique states namely 000, 010, 100, 110 and 111. By defining the encoder disc and associated sensors such that these five unique states, can be identified, and arranging to transmit a pulse of a length uniquely representing the identified state, the bandwidth requirement for transmission of the encoder information can be much reduced. The embodiment thus proposes to incorporate into the shaft encoder the transmission electronics necessary for formulating a pulse length signal from the three A, B and M signals from the encoder disc sensors, and this signal can be decoded at a remote receiver simply by detecting the pulse length. Advantageously a
fibre optic transmission is utilized between the encoder/transmitter and the remote receiver.
In accordance with a further aspect of the invention, which may utilize the above-described encoding format but need not, it is proposed to integrate into the encoder the means for preprocessing of the encoder signals and derivation of direction and speed or other indications so that the data transmitted from the encoder is in a form which may be directly interpreted by the control system without need for further processing.
In order that the invention may be well understood two embodiments thereof will be described by way of example only with reference to the accompanying drawings in which:
Figure 1 shows three signals A, B and M which contain information relating to the speed and direction of rotation of a rotating shaft;
Figure 2 shows a data packet for transmitting data serially according to the prior art;
Figure 3 shows an encoder state truth table in accordance with the invention;
Figure *4 shows a signal format used in the transmission of state data from an encoder to a controller;
Figure 5 shows a system according to a first embodiment of the invention; and
Figure 6 shows a schematic diagram of a custom chip included in a second embodiment of the invention.
The first embodiment employs fibre optic cable as a secure means of transmission, and employs an electronic transmitter circuit at the shaft encoder to multiplex the three signals onto one optical fibre and an electronic receiver circuit to demultiplex the three signals at a remote receiver. The second embodiment employs a microprocessor adapted to preprocess the pulses A, B and M and derive the speed of the shaft within the encoder itself. Again, fibre optic cable may be used as a secure transmission medium between the encoder and the remote receiver.
Referring now to Figure 3 of the drawings, the encoder can in accordance with the invention, be arranged so as to provide only five different combinations of the signals A, B and M, that is to say only five different states. There are four possible combinations of A and B namely 00, 01, 10 and 11. If M is gated by the electronics such that M is high only when A and B are both high, this limits the maximum number of states to the five states shown in Figure 3-
In the prior art arrangement of Figure 2 the start field was required to uniquely identify the beginning of the data packet. Because at least four bits were required to uniquely define the start of the data packet, at least 50 of the data packet is taken up with a start field the data in which, apart from its use in identifying the start of the packet, is redundant. That is, at least 50$ of the information in the data packet is redundant. If the length of the start field can be reduced, each data packet will contain less redundant information and will therefore be more efficient. In addition, if the length of the data packet can be reduced, the amount of information transmitted and hence the maximum controllable speed of the motor will increase in accordance with equation 1 discussed hereinabove.
Figure -4 shows a format for encoding the five states of Figure 3- The format includes a single start bit which is active low to define the start of a data packet. The subsequent bits in the data packet represent the state of the shaft. The data frame always goes high immediately after the low start character. The time for which the data frame remains high indicates the state of the shaft. Thus, if the values of A=B=M=0 the data frame will remain high for one bit period; similarly, if the values of A=B=M=1 the data frame will remain high for 5 bit periods, the bit periods depending upon the frequency
of transmission over the medium. The end of the fifth bit period signifies the end of the data packet. Hence, the need for a stop-bit to positively indicate the end of a data packet is eliminated. When the 0 to 1 transition from the start bit to the first data bit is detected, the receiver automatically synchronises its own reference clock so that the state can be determined from the length of the data frame.
The format shown in Figure 4 cannot use the classic serial link decoding scheme since there is no unique start pattern for the receiving electronics to lock onto. Instead, the receiver is adapted to measure the length of the transmitted pulse and thus to determine the state of the input data. However, the system must still lock onto the start of the message frame and derive a sampling clock from the transmitted bit rate if the state Is to be correctly determined.
Figure 5 shows a system.which is adapted to transmit data serially along a fibre optic link using the format shown in Figure 4. The system Includes an encoder module 1 which is mounted at a static location near the rotating shaft and comprises an encoder 2 operating as previously described and supplying output pulse packets to a six bit shift register 3- a receiver circuit 4 connected to a control module (not shown) located remote¬ ly from the encoder module, and a fibre optic link 5
along which signals from the encoder module are passed to the receiver module which decodes the signals from the encoder module and passes them to the control module for further analysis and interpretation. The decoder module 4 includes a phase locked loop (PLL) circuit 6 which is used to lock onto the 0 to 1 transition of the message as the first data bit is received. By using a divide-by-six circuit 7 in the feed back loop of the PLL the receiving circuit generates a sampling clock which is equal in fre¬ quency to the bit rate and which is locked onto it. Thus, even if the transmission frequency changes the re¬ ceiving circuit 4 will automatically compensate so that the data will always be sampled in the centre of each data bit.
The sampled data is collected in a six bit shift register 8. When the 0 to 1 transition from the start bit to the first data bit. is detected, the corresponding data bits in the shift register are latched into four bit latch 9 as the data is received. Data from the latch is then decoded by decoder 10 back into A, 3 and M thus re¬ constituting the encoder waveforms.
A demonstration system has been built using plastic fibre optic cable. The rated maximum transmission frequency of this cable is 3Mbits/Sec. Using an industry standard encoder disc of 1000 pulses/rev encoder shaft speeds of 3750 RPM can be measured. The encoder signals may be transferred over distances of up to 60m using the
chosen fibre optic cable; longer transmission distances may be obtained by using repeaters. It should be noted that the present limit of 3750 RPM is due to the maximum transmission frequency of the chosen fibre optic cable system, using fibre optic cables with higher transmission data rates will proportionately increase the maximum speed of the encoder shaft in accordance with equation 1.
Although twisted-pair cables could be used with this encoding scheme, their susceptibility to contamination from electrical noise would eliminate much of the usefulness of this technique.
The second embodiment of the shaft encoder according to the invention is based on a microprocessor controlled system. The pulse trains transmitted from an encoder disc and sensors mounted on a rotating shaft are normally processed at the receiving end by the control system. This processing normally consists of a counting process; by counting the frequency of the received pulses over a fixed period of time a measure of speed may be obtained. If the system is adapted to count the total number of pulses during a given control operation the position of the shaft can also be determined.
The preprocessing of the pulses, direction detection and counting functions executed on the received signals by the control system are common to most control
applications. If these functions are performed in an encoder much of the processing overheads and hardware will be removed from the control system. Furthermore, if the processed data is transmitted over a serial link, the security of that link will be enhanced and its complexity reduced since the processed signals from the encoder can be adapted to include error checking and correcting formats such as, for example, Hamming code.
In this second embodiment of the invention, the pre¬ processing and counting functions are performed in a cus¬ tom chip 20 which is shown schematically in Figure 6. The custom chip comprises preprocessing circuitry 21 , a counter 22, two latches 23 and 24, and a control section 25. The control section 25 receives instructions and the like from the micro-processor (not shown) and data is re¬ turned from the two latches (A and B) along a data bus 26 to the microprocessor. The preprocessing unit 21 receives the three signals A, B and M, in the raw form in which they are produced, from the encoder sensors. The preprocessor unit 21 is provided to change the signals from this form to a form which is acceptable to the rest of the system; this form could be for example TTL logic voltage levels. The preprocessed signals are then ana¬ lysed logically to determine direction of rotation (DIR) and to count the total number of pulses (XOR) in the A and B signals. The counter 22 is arranged to count the number of pulses in the
signals A and B and to store an instantaneous indication of the direction of rotation of the shaft. When the microprocessor requests data from the counter 22, the data is loaded into latch A and the counter is then reset to zero. The data is simultaneously transferred from latch A to the microprocessor via the data bus. Thus, the. transfer sequence is transparent to the micro-processor, the transfer sequence execution being supervised by the control section 25 of the custom chip. The counting capacity of the counter 22 determines how frequently it must be read by the microprocessor to prevent overflow, and thus the intervals at which it must be regularly serviced. As mentioned hereinabove, loading latch A with the data held in the counter results in the counter being reset, thus losing information relating to any previous condition of the shaft. Latch B is provided to enable the microprocessor to read the instantaneous contents of the counter without the counter being reset to zero. Latch B may be used to read the counter during, for example, positioning applications. In response to a predetermined event, for example a status flag within the microprocessor resetting, latch B can be loaded with the instantaneous data in the counter. The data in latch B may subsequently be used in determining the position of the shaft by acting as an offset value to the data transferred to latch A.
The data read from the counter via either latch A or latch B is converted into a suitable format or serial transmission, for example, the format described hereinabove with reference to Figure 4. The microprocessor accumulates pulse counts and sends data packets over a fibre optic cable at predetermined intervals, whereby the frequency of transmission of the data is determined by the algorithms controlling the operation of microprocessor. The use of a microprocessor in the encoder module introduces flexibility into the system and enables the encoder to be configured in different arrangements depending upon the required application. The maximum speed of the shaft is not limited so significantly by the bandwidth of the transmission medium since additional algorithms can be included to provide further signal analysis so that, for example, the transmitted data contains information relating only to changes in speed of rotation, position and direction.
The flexibility offered by the invention as described hereinabove enables the encoder to be connected directly to a wide range of control and processing equipment from dedicated control systems to personal computers. Moreover, the invention is not limited to the control of rotating shafts and may be adapted to measure desired parameters •_ any rotating component.