Embodiments described herein relate generally to a rotary encodes, a system comprising a rotary encoder and a method performed by a rotary encoder.
A rotary encoder is a device that measures the position of a shaft or an axle. In a magnetic rotary encoder (also referred to as a magnetic encoder) a magnet is attached to the shaft such that the magnetic field at a sensor varies as the shaft rotates. The rotary encoder determines the angular position of the shaft based on the magnetic field observed by the sensor.
A known rotary encoder transmits position information indicating the angular position of a shaft. There is a growing need to also know speed information (i.e. information indicating the angular velocity of the shaft). Speed information can be used for a variety of control tasks including, but not limited to, torque control on motors/gears. However, previous approaches to generating speed information either lack accuracy, or require a large communications overhead. In light of this a new approach is required.
Arrangements of embodiments will be understood and appreciated more fully from the following detailed description, made by way of example only and taken in conjunction with drawings in which:
According to a first aspect there is provided a rotary encoder comprising: a sensor configured to measure an angle of a rotating shaft; and a controller configured to: determine a first angle of the rotating shaft at a first time; determine a second angle of the rotating shaft at a second time; calculate an angular velocity based on: 1) an angular difference between the first angle and the second angle; and 2) a time difference between the first time and the second time; and transmit an output packet comprising the angular velocity.
In an embodiment the controlled is configured to determine the first angle based on an output of a sensor and is configured to determine the second angle based on an output of the sensor. In an embodiment an output of the sensor is a sinusoidal waveform indicating an angle of the rotating shaft. In an embodiment the angle is calculated directly from the output of the sensor. In an embodiment the first angle and the second angle are calculated to a same resolution as the angular resolution of the sensor output. In an embodiment the angular resolution of the sensor output is not reduced before determining the first angle and the second angle.
In an embodiment the output packet further comprises the second angle.
In an embodiment the angular velocity is calculated directly from the first angle and the second angle.
In an embodiment the controller is configured to calculate the angular velocity based on: the angular difference divided by the time difference.
In an embodiment the controller is further configured to normalise a value of the angular difference divided by the time difference.
In an embodiment the controller is configured to normalise the value of the angular difference divided by the time difference by dividing the value by ½ turn per 10 seconds.
In an embodiment the first angle and the second angle are each represented by a binary number having N bits and take a value from 2N angular resolution movements and wherein the angular velocity is determined based to a number of angular resolution movements.
In an embodiment the controller is configured to transmit the output packet using a serial communication link.
In an embodiment the controller is configured to determine the first angle and the second angle using a look up table.
In an embodiment the rotary encoder is a magnetic rotary encoder.
In an embodiment the rotary encoder further comprises: a Printed Circuit Board on which the controller and the sensor are positioned; and a layer of lacquer over the controller and the sensor. In an embodiment there is provided a system comprising: a rotary encoder according to any of the above embodiments, and a control system communicatively coupled to the rotary encoder, wherein: the control system is configured to receive the output packet transmitted by the rotary encoder.
In an embodiment the control system is configured to transmit a request for position and speed information to the rotary encoder; and wherein: the rotary encoder is further configured to: determine the first angle, determine the second angle, calculate the angular velocity and transmit the output packet to the control system, in response to receiving the request.
In an embodiment the rotary encoder has a minimum request interval and wherein the rotary encoder is configured to ignore the request for position and speed information in response to determining that an amount of time equal to the minimum request interval has not elapsed since a previously received request.
According to a second aspect there is provided a method performed by a rotary encoder comprising a sensor configured to measure an angle of a rotating shaft, the method comprising: determining a first angle of the rotating shaft at a first time; determining a second angle of the rotating shaft at a second time; calculating an angular velocity based on: 1) an angular difference between the first angle and the second angle; and 2) a time difference between the first time and the second time; and transmitting an output packet comprising the angular velocity.
In an embodiment the output packet further comprises the second angle.
In an embodiment the angular velocity is calculated directly from the first angle and the second angle.
In an embodiment the controller is configured to calculate the angular velocity based on: the angular difference divided by the time difference.
In an embodiment the controller is further configured to normalise a value of the angular difference divided by the time difference.
In an embodiment the method further comprises normalizing the value of the angular difference divided by the time difference by dividing the value by ½ turn per 10 seconds.
In an embodiment the first angle and the second angle are each represented by a binary number having N bits and take a value from 2N angular resolution movements and wherein the angular velocity is determined based to a number of angular resolution movements.
In an embodiment the method further comprises transmitting the output packet using a serial communication link.
In an embodiment the method further comprises determining the first angle and the second angle using a look up table.
In an embodiment the rotary encoder is a magnetic rotary encoder.
In an embodiment the rotary encoder further comprises: a Printed Circuit Board on which the controller and the sensor are positioned; and a layer of lacquer over the controller and the sensor.
In an embodiment there is provided a system comprising the rotary encoder and a control system communicatively coupled to the rotary encoder, the method comprising: receiving the output packet transmitted by the rotary encoder.
In an embodiment the method further comprises transmitting, by the control system, a request for position and speed information to the rotary encoder; and, in response to receiving the request: determining the first angle, determining the second angle, calculating the angular velocity and transmitting the output packet to the control system.
In an embodiment the rotary encoder has a minimum request interval and the method further comprises ignoring the request for position and speed information in response to determining that an amount of time equal to the minimum request interval has not elapsed since a previously received request.
Rotary encoders can be categorised as ‘single-turn’ or ‘multi-turn’. ‘Single-turn’ encoders measure angular displacement across 360 degrees from a defined starting position with an output that is repeated for every revolution of the encoder's shaft. A ‘Multi-turn’ encoder measures both the angular displacement across 360 degrees and the total number of revolutions of the shaft. The output of a ‘Multi-turn’ encoder uses a unique code word indicating the position and the number of revolutions.
Rotary encoders can also be categorised as ‘absolute’ or ‘relative’ encoders. An absolute encoder has a unique code/value for each shaft position and provides information indicating the absolute angular position of the shaft. A relative encoder generates an output each time the shaft rotates a certain amount, thereby providing an indication of the relative angular displacement from a given point.
In the following description reference will be made to ‘single-turn’ absolute' encoder. However it is emphasized, for the avoidance of any doubt, that the approaches described herein could be applied to other encoders.
The sensor 101 is configured to observe the magnetic field in its vicinity (which is predominantly caused by the orientation of the magnet 102 attached to the shaft 100) and output information indicating an angular position of the shaft 100. Various sensors can be used to sense the magnetic field (and therefore the angular position of the shaft 100).
In a first example the sensor 101 comprises magnetoresistive elements. Magnetoresistive (MR) elements make use of the magnetoresistive effect, which is the property of a current carrying magnetic material to change its resistance in the presence of an external magnetic field. Consequently, when magnetoresistive elements are used in a rotary encoder, the resistance of the element changes as a function of the rotation angle of the shaft 100, α.
In the example shown in
As known in the art, a Wheatstone bridge comprises four resistive elements arranged in a square formation. Specifically, in a Wheatstone bridge a first resistive element is electrically connected to a second resistive element and a third resistive element. The second resistive element is electrically connected to the first and fourth resistive element. The third resistive element is electrically connected to the first and fourth resistive element and the fourth resistive element is electrically connected to the second resistive element and the third resistive element. A power supply is connected at: 1) the connection between the first and the second resistive elements, and 2) the connection between the third and the fourth resistive elements. An output voltage is measured between: 1) the connection between the first and the third resistive elements, and 2) the connection between the second and the fourth resistive element. The measured output voltage varies between a positive voltage and a negative voltage depending on the resistance of each of the four resistive elements and is outputted by the sensor 101.
The first Wheatstone measurement bridge 103 and the second Wheatstone measurement bridge 104 each comprise four Magnetoresistive elements. Consequently, the output voltage from each Wheatstone bridge depends on the magnetic field present at each of the magnetoresistive elements, which in turn depends on the angular position of the shaft 100. In this way, each Wheatstone bridge is configured to generate an output signal that is a function of the angular position of the shaft 100. The first Wheatstone measurement bridge 103 and the second Wheatstone measurement bridge 104 are physically offset from each other by 45 degrees within a plane that is perpendicular to the axis of rotation of the shaft 100.
In
Optionally the sensor 101 is an Integrated Circuit (IC). An example sensor 101 includes the “KMZ 43T” sensor IC from Philips Semiconductors®.
As discussed above, the first Wheatstone measurement bridge 103 and the second Wheatstone measurement bridge 104 are supplied with power and generate a sinusoidal output signal that oscillates as the shaft 100 rotates about its axis.
An angular position of the shaft 100 is subsequently determined based on the first output signal 201 and the second output signal 202.
As will be apparent from
There are various ways to determine the shaft angle, α. In a first example the (analogue) output signal of the measurement bridges is digitised (such that the output signal takes any one of 2N states, N being the number of bits used to represent the output signal). A look-up-table (LUT) comprising a mapping from: each combination of the digitised first output signal and the digitised second output signal, to: an angle of the shaft 100, is subsequently used to determine an angle of the shaft 100.
In a further example the first output signal 201 and the second output signal 202 are inputted into a comparator configured to output, for each input, a binary ‘1’ when the output signal is greater than 0V, and a binary ‘0’ when the output signal is less than or equal to 0V.
In an example there are four look-up-tables (LUTs), each look-up-table associated with one of the angular segments. Consequently, in this example the angle is determined by first identifying the relevant angular segment from the output of the comparator, and then using the look-up-table associated with the current angular segment to determine the angular position of the shaft 100. This technique is described further in GB 2453580, which is incorporated herein by reference. Other techniques to determine an angle of the shaft 100 from the first output signal 201 and the second output signal 202 could also be used. In an example, the angular position of the shaft is determined according to:
Where A is the value of the first output signal 201 and B is the value of the second output signal 202.
Each of the techniques above provide an angular resolution to 180 degrees. As will be apparent from
In an example the unipolar magnetic sensor comprises an Infineon® Hall Effect Switch TLE4906K/L. In another example the unipolar magnetic sensor comprises an Allegro® A110x hall-effect switch.
The outputs of the second sensor combined with the outputs of the sensor 101 are used to determine an angle of the shaft 100 within a 360 degree angular resolution (e.g. an angle between −180 and +180 degrees).
In an example where there are two unipolar magnetic sensors as discussed in relation to
In the example above the second sensor comprises two unipolar magnetic sensors. However, for the avoidance of any doubt it is emphasized that different numbers of unipolar magnetic sensors can be used. In another example at least one unipolar magnetic sensor is provided to indicate the angular position of the shaft 100 to a precision of a half-turn.
In the example above a specific type of sensor is used (i.e. a sensor comprising a first Wheatstone measurement bridge 103 and a second Wheatstone measurement bridge 104). As a result, the methods of determining an angular displacement of the shaft 100 are discussed in relation to the output signals generated by that sensor. However, it is emphasized, for the avoidance of any doubt, that any other sensor could be used instead provided the sensor is configured to measure a rotating magnetic field and output information that can be used to determine an angular position of the shaft 100.
The sensor 301 is configured to measure a magnetic field in its proximity and output an indication of the magnetic field strength and direction. In an example, the sensor 301 comprises a first Wheatstone measurement bridge 103 and a second Wheatstone measurement bridge 104 as discussed above, and the sensor is configured to output two sinusoidal signals as the shaft 100 rotates as discussed in relation to
The controller 302 is configured to determine the angular position of the shaft 100 based on the output of the sensor 301 using the techniques described above. As will be discussed in more detail below, the controller 302 is also configured to determine an angular velocity of the shaft 100 based on the output of the sensor 301.
Optionally, the rotary encoder 300 also comprises a comparator (not shown) connected to an output of the sensor 301. The comparator 302 is configured to output an indication (i.e. ‘0’ or ‘1’) of whether the output of the sensor 301 is greater than (e.g. output ‘1’) or less than (e.g. output ‘0’) than a threshold. Optionally the threshold is 0V. The output of the comparator is connected to the controller 302. In this example the controller 302 is configured to determine an angular position of the shaft 100 based on the output of the comparator and the output of the sensor 301.
The controller 302 is configured to generate an output communication packet comprising the angular position of the shaft 100 and/or the angular velocity of the shaft 100. In an example the controller 302 is configured to output position and speed information in the same serial data packet. The controller is configured to transmit the communication packet via the input/output connector 303 to an external system.
In one example the input/output connector 303 is configured to receive data from the controller 302 and transmit the data over a serial communication link to the external system. Optionally the input/output connector is configured to communicate with the external system using an RS485 communication interface. In an example, the communication interface uses 1 start bit, 8 data bits, 1 stop bit and even parity.
Other communication mechanisms could be used. For example, in another example the input/output connector 303 is configured to receive data (i.e. the packet comprising the angular position and/or angular velocity) from the controller 302 and transmit the data over a wireless interface (e.g. over a Wi-Fi network or a cellular network).
The input/output connector 303 is configured for bidirectional communication. That is to say, the rotary encoder 300 is configured to communicate with an external system and receive communications from an external system via the input/output connector 303. Communications received via the input/output connector 303 are transmitted to the controller 302.
The rotary encoder 300 also comprises a connector to a power supply (not shown). The connector to the power supply is electrically connected to the sensor 301, the controller 302 and the Input/Output connector 303. Consequently, when a power supply is connected to the rotary encoder 300 power is supplied to the respective components so that they can perform their respective functions. Optionally the power supply to the rotary encoder is 10-30 Volts (DC). In an example the rotary encoder is configured to consume 30 mA of current.
In an example the rotary encoder 300 and the external control system 304 are configured in a master slave relationship where the external control system 304 is the master and is configured to transmit requests for the position and speed of the shaft 100 to the rotary encoder 300. In this example the rotary encoder 300 is the slave and is configured to respond to requests from the master for position and speed information. Optionally the rotary encoder 300 imposes a minimum request interval on requests (i.e. the rotary encoder 300 will only respond to a request that is received more than the minimum request interval since the previous request (being actioned) was received). Optionally the request interval minimum is 1 millisecond.
In an example the input/output connector 303 is configured to communicate data with the external control system 304 at 100 k Baud.
After receiving the request the method proceeds to step 402. In step 402 the sensor (i.e. sensor 301) is read. That is to say, in step 402 the magnetic field in the vicinity of the sensor 301 is observed. The method proceeds to step 403.
In step 403 a first angle of the shaft 100 is determined. The first angle determined in step 403 is associated with a first time. The first time being the time at which the sensors were sampled in step 402.
The first angle of the shaft 100 is determined from the output of the sensor 301. Optionally the first angle takes a value between −180 degrees and +180 degrees inclusive. In the example where the sensor 301 implements a first and a second Wheatstone measurement bridge (i.e. as discussed in relation to
In step 404 the method waits for a duration. That is to say, the controller 302 starts a timer and proceeds to step 405 once the elapsed time since starting the timer equals the duration. Optionally the duration is predetermined. Optionally the duration is 50 milliseconds.
In step 405 the sensors are read as in step 402 (i.e. the magnetic field in the vicinity of the sensor 301 is observed by recording the values of the output signals outputted by the sensor 301). After reading the sensor the method proceeds to step 406.
In step 406 the controller 302 determines the second angle at the second time. The second angle is determined based on the output of the sensor 301 obtained in step 405. In an example the controller 302 determines the first angle based on the first output signal 201 and the second output signal 202 as discussed above (e.g. by using a look-up-table or by direct calculation). After determining a second angle in step 406 the method proceeds to step 407.
In step 407 the controller 302 determines an angular velocity based on the first angle (determined in step 403) and the second angle (determined in step 406). The angular velocity is also determined based on the duration of time between measuring the first angle and measuring the second angle (i.e. the duration waited in step 404). In an example the angular velocity is calculated according to:
Where Δθ is angular the difference between the first angle and the second angle and Δt is the time difference between observing the sensor (i.e. the duration waited in step 404). Where the angle is measured in degrees and the time is measured in seconds, the calculated angular velocity is in degrees/second. Other units could be used. For example, the first and second angles can be determined in radians instead.
In an example, the controller 302 continuously tracks the rotation direction of the shaft 100. For example, the controller 302 determines whether the shaft is rotating clockwise or anti-clockwise based on at least two previous angle measurements. For example, based on whether the angle of the shaft 100 is advancing in a first direction or a second direction.
In an example, the rotation direction of the shaft 100 is used to calculate the angular difference. More specifically, the angular difference is calculated according to the angular movement required in the rotation direction between the first angle and the second angle.
By way of an example, if the first angle is 0 degrees and the second angle is 10 degrees then the angular difference could be 10 degrees in a first direction (e.g. clockwise) or 350 degrees in a second direction (e.g. anti-clockwise). In the example where the controller 302 continuously tracks the rotation direction, the angular difference is selected based on the direction that matches the tracked rotation direction. For example, if the controller 302 determines that the shaft 100 is rotating in the first direction (e.g. based on the previous angle measurements) then the angular difference in the first direction (i.e. 10 degrees) is selected as the angular difference. If the controller 302 determines that the shaft 100 is rotating in the second direction then the angular difference in the second direction (i.e. 350 degrees) is selected as the angular difference.
In the above example, the angular difference is calculated in degrees and the time difference is calculated in seconds. Consequently, the angular velocity is in units degrees/second. In another example a different set of units is used. In this example the controller 302 is configured to represent the first angle and the second angle as a binary number. Optionally the binary number has length 11 bits, thereby representing an angular resolution of 2048 steps. In this case the first angle is an 11 bit binary number and the second angle is an 11 bit binary number. In step 407 the difference between the first angle and the second angle is calculated based on the number of resolution steps between the first angle and the second angle. In an example, the rotation direction of the shaft 100 is tracked by the controller 302 and is used when determining the angular difference (in binary representation) as discussed above. The angular velocity (i.e. the speed) subsequently calculated by dividing the resolution movement by the time between observations. For example, a first angle is a 1058 resolution movements, the second angle is 1063 resolution movements, the difference between the first angle and the second angle is 5 absolute resolution movements and the time taken to complete 5 absolute resolution movements is 50 milliseconds. In this case the speed (i.e. the angular velocity) is calculated according to (1/time)×resolution movement=(1/50×1E-3)×5=100. The units being: resolution movements/second.
In another illustrative example of determining angular velocity using resolution movements instead of an angular difference in degrees, determining a first angle at a first time in step 403 comprises obtaining an angle in resolution movements, determining a second angle at a second time 406 comprises obtaining an angle in resolution movements, and the angular velocity in step 407 is determined based on the angular resolution measurements. In an example, the encoder has an angular resolution of 0.25 degrees (and therefore 360/0.25=1440 resolution movements in a full rotation). A first angle, measured at the first time in step 403 is “100” resolution movements, a duration of 0.1 second is waited in step 404, and a second angle, obtained in step 406 is “105” resolution movements. A number of resolution movements, N, is calculated based on the second angle (expressed in resolution movements) minus the first and (expressed in resolution movements). In this example, the angular velocity is calculated in degrees per minute, where the angular difference is measured in absolute resolution movements. The angular velocity in step 407 is calculated according to: angular velocity (degrees per minute)=(angular resolution *N* (60/time delay in seconds)). In this example the angular velocity is calculated as: (0.25*5* (60/0.1)) =750 Degrees/Minute.
Optionally step 407 also comprises a normalisation step. In an example the determined speed is normalised by ½ a turn per 10 seconds to generate a speed output value between 0 and 100.
Specifically, the calculated speed is divided by an angular velocity of 18 degrees per second (i.e. 180degrees/10 seconds) or, when using resolution movements per second, 102.4 resolution movements per second (i.e. 1024 resolution movements/10 seconds). Thereby generating a speed output value between 0 and 100.
Advantageously the speed is calculated by the rotary encoder 300 using the angle value obtained directly from the output of the sensor 301. This can lead to more accurate speed measurements. For example, in a different approach the speed measurement is calculated from the output of a comparator as shown in
In a further example, steps 402-407 are repeated a plurality of times before proceeding to step 408. In particular, after determining a first angular velocity value in step 407 the method returns to step 402 (optionally after a short delay). Steps 402-407 are repeated thereby generating a second angular velocity value. Optionally, the controller 302 selects the highest value (i.e. the max) of the first angular velocity value and the second angular velocity value as the angular velocity.
In a different example the controller 302 calculates the angular velocity based on an average of the first angular velocity value and the second angular velocity value. In an example steps 402-407 are repeated a plurality of times to generate a plurality of angular velocity values, and a single angular velocity value is generated based on the plurality of angular velocity values (either by selecting a max or by averaging).
After determining an angular velocity in step 407 the method proceeds to step 408 where the absolute position and the speed of the shaft 100 are transmitted. The absolute position and speed is transmitted by the rotary encoder 300 to the external control system 304. As discussed above the speed information transmitted by the rotary encoder 300 can be used for controlling the machine that comprises the shaft 100. In particular for torque control on motors/gears.
The absolute position and speed is transmitted by the rotary encoder 300 in the form of an output communication packet (also referred to as a response telegram).
Calculating the angular velocity at the rotary encoder 300 advantageously reduces the communications overhead as it avoids the need to repeatedly send absolute position information to the external control system 304. Furthermore, calculating the speed directly from the absolute position as discussed above increases the accuracy of the reported speed.
Optionally, and as shown in
In an example the protection class of the rotary encoder 300 is IP20 and the rotary encoder 300 is rated for temperatures from −25 to +75 degrees Celsius.
In an example the components of the rotary encoder 300 (i.e. the sensor 301, the controller 302 and the input/output connector 303) are implemented in hardware and located on a Printed Circuit Board. Optionally a circuit board lacquer is provided on the printed circuit board to protect against humidity.
While certain arrangements have been described, the arrangements have been presented by way of example only, and are not intended to limit the scope of protection. The inventive concepts described herein may be implemented in a variety of other forms. In addition, various omissions, substitutions and changes to the specific implementations described herein may be made without departing from the scope of protection defined in the following claims.
Number | Date | Country | Kind |
---|---|---|---|
2215751.5 | Oct 2022 | GB | national |