An Embedded System for Position and Speed Measurement Adopting Incremental Encoders Marco Faccio, Paolo Grande, Francesco Parasiliti, Roberto Petrella, Marco Tursini Department of Electrical Engineering, University of L'Aquila Monteluco di Roio, L'Aquila, I-67040, Italy
[email protected],
[email protected],
[email protected],
[email protected],
[email protected] Abstract - This paper presents an embedded digital system for incremental encoders allowing for high dynamic performance and accuracy speed measurement in all the operating conditions for the application in digital servo drives. The idea aims at embedding processing capabilities inside traditional position transducers in order to develop a smart measuring system. The base processing algorithm employs a novel mixed time and frequency measurement technique of the encoder signals. The iterative formulation of the algorithm and the limited hardware requirements allows its implementation by means of a standard microcontroller (e.g. TMS 320F24x) or by dedicated hardware. Communication between the smart sensor and the servo drives is preliminary realised via high-speed serial peripheral interface. Keywords: incremental encoders, measurements, embedded systems, smart sensor.
I.
INTRODUCTION
Position and rotor speed are required for high performance servo drive systems, where rotary incremental encoder is probably the most frequently adopted position transducer. A low level information is provided in the form of two trains of pulses or digital coded parallel binary data, respectively for the incremental and the absolute devices. The low-level information is transmitted to the control system which calculates actual rotor position and speed needed for motor control (Fig. 1a). Consequently some of the processing resources available at the drive controller level must
Servo drive
Quadrature signals
E.
a)
Rotor position and speed calculation
Servo drive
Motor
High speed communication link
Rotor position and speed
S.E.
Rotor position and speed calculation
Motor
b)
Fig. 1 – Standard a) and the proposed smart encoder b) architectures. This research has been partially sponsored by the Centre of Excellence DEWS “Architectures and Design Methodologies for Embedded Controllers, Wireless Interconnect and System-on-chip” and the European Community Project IST-200138314 Columbus “Design of Embedded Controllers for Safety Critical Systems”.
be dedicated to those two tasks, which can be relatively complex and/or time consuming. Sometimes additional hardware, e.g. a field programmable gate array or a programmable logic device, is adopted at servo drive level to provide a higher accuracy and bandwidth speed measure, also reducing the overall processing requirements for the drive controller. When incremental encoders are considered as position transducers, the available output signals are normally provided as differential pairs in order to allow a reliable transmission through the communication link, thus compensating for the effects of a certain level of common mode noise entering into the transmission path. As the transmitted signals contain no coding and redundancy information, any transmission error will result in information loss and possible problems in the motor control task. The idea which is proposed in this paper aims at embedding some processing capabilities inside traditional position transducers, e.g. optical incremental encoders, in order to develop a smart encoder (S.E.), as it is shown in Fig. 1b. Incremental position is therefore acquired at the encoder level and rotor speed is calculated by the embedded µC and transmitted to the remote servo drive. The choice of the speed calculation algorithm is a critical point, being a function of the accuracy and bandwidth required by the particular application, the processing performance of the µC, system cost and complexity. In common cases a strong trade-off exists among those features. A novel mixed time and frequency measurement technique of the encoder signals is proposed assuring very high accuracy and bandwidth for the calculated rotor speed. The iterative formulation of the algorithm and the limited hardware requirements allows its implementation by means of a standard µC or by simple dedicated hardware, which is embedded inside the sensor. Communication between the smart encoder and the servo drive system must satisfy the real-time requirements of the controller and has then to be realised via high speed communication link. The reliability of the exchanged information has to be guaranteed in all the operating conditions, leading to the introduction of fail-proof communication protocol, both at the physical and data link layers. In the preliminary results presented in this paper data transmission has been realised via high-speed serial peripheral interface and differential signaling is adopted at the physical layer. The implemented communication protocol allows to detect any faulty information at the servo drive level and a
request for a new transmission is sent back to the smart encoder. The synchronization between servo drive and smart encoder is one of the most important tasks which is to be taken into account for the considered real-time application. An optimization of the time needed to achieve a reliable transmission is proposed and analysed. Bi-directional information exchange is also considered in order to allow the complete configuration of the smart encoder from the remote servo drive, i.e. a certain number of parameter can be adapted on-line such as the number of the encoder pulses per revolution, the observation window width, the assumed base values for speed calculation, etc.. II.
SPEED MEASUREMENT ADOPTING INCREMENTAL ENCODERS
The classical and probably the simplest method to measure rotor speed is the direct measurement of the frequency of the encoder pulses [1]. Typically the number of the observed pulses inside a given and constant-width time-window is counted. Angular speed is then approximated to the discrete incremental ratio, that is constant speed is supposed inside the observation window:
ω=
60 ⋅ ∆N dθ ∆θ 2π ⋅ ∆N [ rad ⋅ s −1 ] → [ RPM ] ≅ ≅ N p ⋅ Tsc dt Tsc N p ⋅ Tsc
(1)
where Np is the number of pulses per revolution (after quadrature decoding), Tsc is the time-window and ∆N is the number of observed pulses inside that window. As a result, one
Speed [RPM]
A ctu al spe ed
M e asured spe ed a)
Speed [RPM]
A ctu al spe ed
M e asured spe ed b)
T im e [s] Fig. 2 – Speed quantisation errors by means of pure frequency measurement (simulation results, a) Np=1000, Tsc=400µs; b) Np=4000, Tsc=100µs).
Fig. 3 – Speed quantisation error obtained by means of pure frequency measurement.
has a quantisation error superimposed to the effective mean speed inside the observation window which depends on the uncertainty on the measured number of pulses ∆N and is due to the lack of synchronisation between encoder pulses and the observation window itself. The speed measurement quantisation error ∆ω is: ∆ω =
2π [ rad ⋅ s −1 ] → N pTsc
60 [ RPM ] N pTsc
(2)
Equation (2) shows that the quantisation error is independent from the operating speed and it depends only on the number of encoder pulses per revolution and the observation time window. In Fig. 2 both transient and steady-state operating conditions are simulated with different values of the number of pulses per revolution (Np) and the observation window (Tsc). Actual and measured speed by adopting a pure frequency measurement are shown. In Fig. 2a a longer observation window (400µs) is considered with a low resolution encoder (1000 pulses/revolution), whilst in Fig. 2b a shorter observation window (100µs) is considered with a higher resolution encoder (4000 pulses/revolution). As the product NpTsc is constant for both cases, the absolute measurement error is the same and is independent on speed value as shown in (2). In Fig. 3 this situation is resumed in graphical format for some practical cases. In middle and high speed region the quantisation error causes a percentage error which in many cases is acceptable, but in very low speed region the amplitude of the quantisation error is the same as the effective speed and the percentage error becomes intolerable. One way to reduce that error is to switch from frequency to time measurement at a certain level of speed, which is realised by counting the number of periods of a high frequency signal inside two (or more) encoder pulses [1]. But, for small values of speed, this can lead to saturation problems within the digital timer employed for measurement and proper hardware structures have to be introduced [2][3][4]. Moreover a proper commutation between the two different methods must be implemented.
Another commonly adopted way to reduce quantisation error is to increase the speed control period, but this solution reduces the bandwidth of the speed control loop. Moreover, requirements for cost reduction suggest the use of low resolution transducers. This causes a reduction in the system performance, especially at low speed. Several methods have been developed in order to obtain high precision position and speed detection which are commonly addressed as “estimation methods”. Proper state models of the dynamic behaviour of mechanical subsystem (including position, speed, acceleration, etc.) are in fact arranged providing speed estimation in real-time based on easily measurable quantities and system parameters by means of state observers and estimators. In [5] and [6] an extended Kalman filter is adopted for speed estimation where a nonlinear state model is built based on the orthogonal components (sincos) representation of a rotating space vector, generated from the encoder position. The filter allows to estimate both the components of the vector position (sin-cos) and the frequency (ω) with an accuracy which is independent from the transducer’s resolution. Moreover one sample of the estimated orthogonal components and the estimated frequency is available at each execution of the EKF, that is roughly 100÷200µs. In [7] a similar approach has been adopted but a linear system is considered, thus allowing the use of stationary Kalman filter and reducing the number of real-time operations to be performed. Moreover acceleration estimation is also provided by the same observer. All the observer-based methods share the feature of providing a good accuracy of the speed estimation with satisfactory dynamic performance. But they suffer from the dependence on system parameters or design parameters which have to be carefully chosen during system development and tuning. Moreover the obtainable steady-state and transient performance are often a function of the operating conditions, e.g. speed and/or acceleration values. In some cases a design trade-off exist between low steady-state speed estimation errors and high dynamic performance, which could lead to the adoption of complex adaptive observers. Finally, the implementation effort and execution times of those methods could be very high and normally require high performance processing systems. The novel algorithm which is proposed in this paper is
Teq,k-1 Tsc
∆Th-1
step h-1
based on a mixed time and frequency measurement of the encoder signals and provides very high dynamic performance and accuracy in all the operating conditions The iterative formulation of the algorithm and the limited hardware requirements allows its implementation by means of a standard µC or dedicated hardware which is embedded inside the incremental encoder. III.
A. Description of the algorithm The basic idea of the proposed algorithm is to compensate for the quantisation error of pure frequency measurement (2) due to the lack of synchronisation between encoder signals and observation window. This can be done by measuring the time intervals (∆Th in Fig. 4) between the bounds of the (basic) observation window (that is Tsc in (1)) and incoming encoder pulses.
In this way it becomes possible to adapt the window width (Teq) to the nearest integer number of pulses being received, thus zeroing quantisation error. A high accuracy measure of speed within each control cycle (e.g. 100µs) is obtained if one pulse is received at least within it. In case no pulse enters in the basic observation window (low speed operations), an extended observation window is considered made up of an integer number of basic windows and speed information is updated only after the reception of a valid pulse. In this case the width of the extended observation window (ΣTsc,acc) can be expressed by the sum of each Tsc. The expression of speed can be simply expressed by:
ω=
step h
ΣTsc, acc
ΣTsc, acc
∆N 2π ⋅ + ∆Th −1 − ∆Th N p
∆N 60 ⋅ + ∆Th −1 − ∆Th N p
[ rad ⋅ s −1 ] → (3) [ RPM ]
where ∆N is the number of encoder pulses received within the observation (basic or extended) window. The strength of the method can be identified inside its iterative nature, as a consequence of the fact that always the same kind of time interval is measured within each cycle. A
Teq,k Tsc
∆Th
THE PROPOSED MEASUREMENT ALGORITHM
Teq,k+1 Tsc
∆Th+1
step h+1
encoder pulse
∆Th+2
Fig. 4 – Explanation of the proposed measuring method.
time
very important consequence of this fact is that the same algorithm and speed calculation formula is adopted for both low and high speed operations, that is no commutation between different measuring algorithms is to be provided. This allows to adopt a simple hardware subsystem, normally found inside common µCs (timer plus capture unit) with no recourse to additional hardware. B. Measurement errors The accuracy of the method is limited only by the quantisation error which is inevitably introduced in time measurement performed by digital counter, whose effect on speed measurement error is almost always negligible. Then the provided accuracy is comparable to that of a pure time measurement in low speed region. In the high speed region the accuracy is always higher and asymptotically reaches that of frequency measurement. In fact, after a certain (high) value of speed, the period of the high frequency counter (Thf) used for time interval measurements becomes comparable to the period of the encoder signals. The corresponding quantisation error becomes then non-negligible with respect to the accuracy of pure frequency measurement. The measuring error provided by the proposed method is a function of the operating conditions, in terms of speed value and synchronisation between encoder pulses, measuring window width and period of the high frequency counter. It could be demonstrated that its value is given by the following expression:
eω % =
2 ⋅ Thf ΣTsc , acc + ∆Th −1 − ∆Th + 2 ⋅ Thf
⋅ 100 .
(4)
C. Implementation issues The main problem to be faced in the implementation of the proposed measurement algorithm is the correct sampling of the data needed for speed calculation. The experimental set-up adopts a µC DSP (Texas Instruments TMS320F243) and the successive discussion will focus on the available peripherals of that µC. As the hardware subsystems required by the measuring method is limited to timer and capture unit, similar results can be obtained by other µC. At a certain time instant within each speed calculation cycle the number of acquired encoder pulses ∆N and the time interval ∆Th have to be measured, together with the width of the observation window (Tsc or ΣTsc,acc). From each set of acquired data, (3) can be applied for speed calculation within that cycle. From a logical point of view, information gathering and speed calculation can be regarded as two independent steps. This simple concept will demonstrate to be very useful when the smart encoder software architecture and the related synchronisation with the servo drive will be analysed and discussed. The number of the encoder pulses ∆N is provided by the quadrature decode logic and the associated counter (namely T2CNT) by means of a 16-bit word. The time interval ∆Th is obtained through a capture unit associated with a free running
Digital function generator
Quadrature signals generator
µC DSP
RS-232 Link
Host PC
Fig. 5 – Experimental set-up adopted for the verification of the proposed measuring algoritm.
timer unit (T1CNT). The capture unit provides the last two captured values of the timer T1 by means of a first-in-first-out two-level memory structure (FIFO). The associated control register (CAPFIFO) allows to know the instantaneous number of captured data. Time interval ∆Th can be calculated in a first approximation as the difference between the instantaneous value of the timer T1 counter and the last captured value contained in the FIFO. In a similar manner, the observation window width can be calculated as the difference between T1 counter values in two successive cycles. From a theoretical point of view, the access to the set of registers should be realised in a parallel fashion in order to sample the instantaneous situation of all the registers, thus providing always coherent data. This can be done very easily in the case the measuring algorithm is implemented by means of dedicated hardware. But this is not possible through a standard µC and each access has therefore to be realised in a sequential fashion. Independently from the sequence of the accesses, incoherence of sampled data can occur due to the incoming encoder pulses, e.g. a pulse can enter after the reading of T2CNT but before accessing to T1CNT and FIFO. Different cases originating incoherence of sampled data have been fully identified and studied in order to compensate for them. The provided solution makes use of a repetitive access to the same set of registers. Based on the analysis of the obtained results with respect to pre-determined design situations, only one set of coherent data is extracted to be used for speed calculation. Deeper details will not be discussed here as it goes beyond the scope of the present paper. IV. SPEED MEASUREMENT ALGORITHM: SIMULATION AND EXPERIMENTAL RESULTS The measurement algorithm has been simulated under Matlab/Simulink environment, where the exact model and synchronisations between encoder signals, measuring system and high frequency counter has been included. Then the proposed algorithm has been experimentally validated and the obtained results demonstrate that optimal performance are achieved by a standard processing system, with no recourse to additional hardware. A simple specific hardware subsystem has been developed in order to emulate the behaviour of an incremental encoder, which in a real system would be mounted on the shaft of the motor (see Fig. 5). Twice the frequency of the signals out of the emulated incremental encoder is defined with high accuracy by a digital signal generator. A proper processing circuit provides the required 90 degrees phase shift needed to the generation of the two quadrature signals which are then fed into the µC. The results of the processing can be acquired onand off-line by a host PC for debugging and verification purposes.
1 .000 8
1 .000 6
Maximum expected values
Speed [RPM]
Percentage speed error
1 .000 7
1 .000 5
M easured speed
1 .000 4
1 .000 3
1 .000 2
Measured values
Actual speed
1 .000 1
1
0 .999 9
Actual speed [RPM]
0
0.05
0.1
0.1 5
0.2
0.25
0.3
0.3 5
0 .4
0.45
0.5
Time [s]
Fig. 7 – Low-speed steady-state operating condition (experimental result).
Fig. 6 – Steady-state percentage measuring errors (measured and maximum expected values).
Tests have been performed inside a wide speed range, that is 0.1 up to 6000 RPM, both in steady-state and transient conditions, with the aim of evaluating static and dynamic performance and accuracy of the proposed measuring method. The following parameters have been considered for both simulation and experimental results: Tsc =100µs, Thf =50ns, Np =4000. A. Steady-state performance In Fig. 6 measured (experimental) and maximum expected steady state errors (from (4)) are compared, confirming both the effectiveness of the method and very small percentage errors, even with the small considered value of observation window of 100µs. Three different regions can be distinguished: (0;150), [150;300), [300;∞] RPM.
In the second region one encoder pulse is received within each basic observation window and a speed measure is provided. Also in this region the relative measuring error corresponds to that of pure period measurement, continuing to be linear up to 0.2% (300 RPM), which also represents the maximum relative error provided by the proposed solution with the chosen system parameters. In the third region more than two encoder pulses are received within the basic observation window and the relative measuring error decreases with speed, reaching asymptotically the value of 0.1%.
1 .0 1 5
Actual speed 1.01
Measured speed [RPM]
In the first region no encoder pulse is received within a basic observation window (100µs), which is thus adapted to the frequency of the incoming pulses. Speed measure is provided as soon as one pulse is acquired. The relative measuring error corresponds to that of pure period measurement and is therefore linear up to 0.1%.
Fig. 8 – Asymmetric encoder pulses condition.
1 .0 0 5
M easured speed 1
0 .9 9 5
0.99
0
0 .0 5
0.1
0 .1 5
0.2
0 .2 5
0.3
0 .3 5
0.4
0 .4 5
0.5
T ime [s]
Fig. 9 – Low-speed steady-state operating condition in case of asymmetric encoder pulses (experimental result).
Frequency measurement always provides higher relative errors up to the speeds of 150000 RPM and 5000 RPM for the observation windows of 100µs and 3ms respectively.
µC. In this case a speed measure is provided every 15ms, that is as soon as each encoder pulse is received. This means that about 33 measures are plotted in Fig. 7 and allows to highlight that always the same measure is obtained within the same operating condition. This confirms both the stability of the measuring algorithm and the reliability of the encoder emulating system.
When a low-speed steady-state operating condition is considered, e.g. 1 RPM (see Fig. 7), the measured speed by the proposed algorithm is about 1.00052 RPM, which leads to a 0.052% measuring error. The accuracy of this result could be related to the accuracy of the clock generator for the adopted
Some experiments have been done at the same constant operating speed of 1 RPM, when a certain phase error is considered in the two emulated quadrature signals, that is the duty cycle of the signal out of the function generator in Fig. 6 is not 50% (see Fig. 8). This condition leads to a different time
Measured speed [RPM]
Measured speed [RPM]
3
Time [s]
Percentage speed error
Percentage speed error
ZOOM
Time [s]
distance between each edge of the two quadrature signals (i.e. the acquired pulses). The corresponding measured speed is shown in Fig. 9. One can notice that speed measurement tracks the asymmetry of encoder pulses and leads to about ±1% pulsating measuring error whose frequency is twice the frequency of the incoming encoder pulses. This problem could simply be overcome by considering only rising or falling edges of the encoder pulses for speed measurement purposes, leading to a reduced measurement update frequency. B. Transient performance As far as transient performance concern, Fig. 10 shows the case of measuring a triangular speed with a relatively small value of acceleration (3 RPM/ms), starting from an initial value of 1500 RPM. Both measured speed and instantaneous measurement error are shown respectively, the last one being always less than 0.2%. If a pure frequency measurement is considered and the observation window is fixed to 3ms, the percentage speed error is higher but remains however limited to less that 1% due to the slow dynamics of the actual speed (Fig. 11). The advantages of the proposed measuring algorithm over the traditional frequency measurement is clearly evident when high acceleration are considered. In Fig. 12, in fact, the result of the
A ctu al sp eed
Percentage speed error
M ea su red sp eed
Tim e [s]
Fig. 13 – Fast transient response with triangular speed (frequency measurement with Tsc=100µs, simulation result). A c tu a l s p e e d
Speed [RPM]
Fig. 11 – Slow transient response with triangular speed (frequency measurement with Tsc=3ms, experimental result).
0
M e a su r e d sp e e d
Percentage speed error
Percentage speed error
Time [s]
1
Fig. 12 – Fast transient response with triangular speed (proposed method, experimental result).
Speed [RPM]
Measured speed [RPM]
Fig. 10 – Slow transient response with triangular speed (proposed method, experimental result).
2
T im e [s ] Fig. 14 – Fast transient response with triangular speed (frequency measurement with Tsc=3ms, simulation result).
Measured speed [RPM]
speed calculation algorithm, as the one presented in this paper, also imposes the availability of rotor speed at servo drive level at each control period. If rotor position and speed are calculated within the servo drive, no synchronisation problem exist between the encoder and the servo drive itself. In fact, a dedicated hardware provides the proper quadrature decoding and counting of the encoder pulses and the servo drive calculates rotor speed from position information.
Measured speed [RPM]
In the proposed system, communication requirements, in term of transmission time, reliability and synchronisation between the smart encoder and the servo drive, has to be accurately taken into account. The problem arises from the following considerations: two real-time interacting algorithms (drive controller and speed calculator) are physically allocated into two different processing systems, they could have different sampling periods and execution times and one of them uses the results of the other one. Tim e [s]
Fig. 15 – Response to a sinusoidal speed (proposed algorithm and pure frequency measurement, experimental results).
measurement of the same triangular speed is shown where the value of the acceleration is now 5000 RPM/ms, starting from an initial value of 0 RPM. Measured speed and instantaneous measurement error are shown respectively. One can notice that the percentage speed error is about 1 percent towards the peak of the triangle (0.01s). The error becomes very high when approaching to low and zero speed due to the high dynamics of the signal that would require a higher resolution encoder and a narrower observation window. The comparison between the proposed solution and pure frequency measurement is possible by means of the simulation results shown in Fig. 13 and Fig. 14. The same fast transient response is tested in the case the observation window is fixed to 100µs and 3ms respectively. In the first case the measurement error is always much higher than that obtainable by the proposed algorithm and the shape of measured speed clearly shows the quantisation effect (2) due to the limited resolution of the position transducer (Fig. 13). A simple solution for the reduction of quantisation error is often adopted, that is to consider a larger observation window, e.g. 3ms (Fig. 14). Both a reduction in the speed control loop frequency and a time delay are suddenly introduced, worsening the accuracy and dynamical performance of the servo drive controller. Finally Fig. 15 shows the response of the measuring algorithm to a sinusoidal speed. Low speed (60 RPM mean and 90 RPM peak value) and relatively slow operations (2 Hz) are considered. A qualitative comparison with the pure frequency measurement is shown confirming that the proposed solution always provides better results. V. COMMUNICATION BETWEEN SMART ENCODER AND SERVO DRIVE Sophisticated motor control algorithms require absolute rotor position information at each control period, a common adopted value being about 100µs or less. Absolute rotor position is extracted from the incremental information which is provided by the encoder. The adoption of a high performance
In order to simplify data exchange and to reduce communication overhead and synchronisation efforts, the servo drive has been chosen to be the master of a bi-directional data transfer. This means that servo drive can start communication but measurement data from smart encoder (slave) is expected to go in the opposite direction. As high-speed serial peripheral communication (SPI) is adopted, three signals are needed, namely: clock, slave-in-master-out and slave-out-master-in. The clock signal is generated by the master and the frequency of 2.5Mbit/s has been chosen, which corresponds to the maximum allowed value for the µC equipping the servo drive (TMS320F240). The master also drives the primary communication line (slave-in-master-out) which is used to transmit serial data to the slave. The secondary communication line (slave-out-master-in) allows opposite direction data transmission (slave to master). This means that measurement data from smart encoder is exchanged in parallel with the master-to-slave transmission and master must start a transmission in order to obtain data from the slave. This apparently limiting feature can however be efficiently employed for data reliability check and error correction. Details will not be given as they go beyond the scope of the paper. Data word width has been fixed to 8 bit due to limitations for the µC equipping the servo drive. The allowed maximum clock frequency and word width limit the performance of the transmission but can simply be improved by adopting a more recent µC. Let us take into account the software architecture of the smart encoder. Two different processes are allocated into its µC: speed measurement and communication handler. As discussed in a previous section, the speed measurement algorithm can be divided up into two different logical tasks: information gathering and speed calculation. The first one is related to the multiple access to the set of µC registers. The second one relates to the processing of the gathered information needed to obtain a valid speed value and is executed only after information gathering, that is no concurrence with the first task can occur in any way. The communication handler aims at packing the received data into messages and parsing them. As the smart encoder is not the master of the communication, concurrence between communication handler and speed measurement can occur.
n
o p
n
q
r
t
s
q
allowing 16-bit data word width, contributes to the reduction of that transmission time. Finally some additional messages have been introduced in order to allow the complete configuration of the smart encoder from the remote servo drive. A certain number of parameters can be adapted on-line, e.g. the number of the encoder pulses per revolution, the observation window width, the assumed base values for speed calculation, etc.. This allows to adapt the smart encoder processing engine to any incremental encoder without the need to modify the firmware. VI.
Fig. 16 – A simple data transmission between smart encoder and servo drive.
Particularly the concurrence is limited only to the information gathering task, which cannot be interrupted as coherence of collected data could be corrupted. Speed calculation task can instead be interrupted. A simple data transmission example is shown in Fig. 16, as collected from the experimental set-up. The upper trace corresponds to the clock signal generated by the master. Each burst contains eight periods of the clock signal, corresponding to the transmission of eight bits. The signals in the middle and lower traces are instead generated from the smart encoder and servo drive respectively and provide an indication on their actual state. The following actions can be identified: 1. information gathering task is triggered by the transmission of a synchronising message by the servo drive; 2. smart encoder receives and recognises the synchronising message and performs information gathering task; 3. smart encoder performs speed calculation and goes into an idle state waiting for a message from servo drive; 4. the result of the speed calculation is requested by the master through the transmission of a data request message at the beginning of the control period; 5. the reception of that message from the slave starts data exchange routine; 6. slave prepares the last byte to be transmitted; 7. master transmits (and receives) the last byte, after which data transmission is complete. Master organises the received data and completes motor control algorithm. The adopted communication protocol requires N+4 basic transmission cycles in order to exchange N bytes from the smart encoder, being N the number of bytes data can be decomposed into. The additional 4 cycles are introduced for error detection purposes. In the present case two 16-bit words have to be transmitted, i.e. rotor position and speed. This means that for the considered baud rate, the theoretical required time to complete the transmission should be about 25µs. The actual time is however much higher (about 50µs) due to the operations needed at slave level between each transmission cycle, which have not been fully optimised in the considered experimental set-up. The communication handler optimisation could easily lead to complete the transmission within about 10 µs. Moreover the adoption of a different version of the µC,
CONCLUSIONS
In this paper an embedded digital system for incremental encoders allowing for high dynamic performance and accuracy speed measurement in all the operating conditions has been proposed. The idea aims at embedding some processing capabilities inside a traditional optical incremental encoder in order to develop a Smart Encoder. Incremental position is therefore acquired and rotor speed is calculated at the encoder level by the embedded µC and transmitted to the remote servo drive. A high performance speed calculation algorithm has been proposed and fully analysed by means of extensive simulation and experimental results. A real-time communication protocol has been proposed for data exchange between the smart encoder and the servo drive system, aiming at guaranteeing the reliability of the exchanged information in all the operating conditions. Bi-directional information exchange has been implemented in order to allow the complete configuration of the smart encoder from the remote servo drive allowing to adapt the processing engine to any incremental encoder without any need to modify the firmware. Future developments will focus both on the reduction of the complexity of the communication layer and the implementation of a wireless data exchange technique. REFERENCES [1]
[2]
[3]
[4]
[5]
[6]
[7]
[8]
F. Briz, J. A. Cancelas, A. Diez, ”Speed Measurement Using Rotary Encoders for High Performance AC Drives,” IEEE Transactions on Industrial Electronics. Milan Prokin, ”Extremely Wide-Range Speed Measurement Using a Double-Buffer Method,” IEEE Transactions on Industrial Electronics, Vol. 41, No. 5. Jeumont-Schneider, “Dispositif de mesure de la fréquence d’un générateur d’impulsions et système de commande numérique comportant un tel dispositif”. Nino StojKovic, Zoran Stare, Neven Mijat, “Dual-Mode Digital Revolution Counter,” IEEE Transactions on Instrumentation and Measurement. B.J. Brunsbach, G. Henneberger, Th. Klepsch, “Speed Estimation with Digital Position Sensor,” Proc. of ICEM’92, pp. 577-581, Manchester, 1992. M. Labbate, R. Petrella, M. Tursini, “Fixed point implementation of Kalman filtering for AC drives: a case study using TMS320F24x DSP,” Proc. of the 3rd European DSP Education and Research Conference, CDROM, Paris, 2000. A. Bellini, S. Bifaretti and S. Costantini, “Identification of the mechanical parameters in high-performance drives,” in Proc. of the EPE Conference, CD ROM, Gratz, 2001. L. Di Cintio, F. Parasiliti, R. Petrella, M. Tursini, “A novel approach to speed measurement for incremental encoders featuring high accuracy and bandwidth,” in Proc. of the 11th International Power Electronics and Motion Control Conference, 2-4 September 2004, Riga, Lavtia, in press.