Motor control method
By establishing a communication network between the microcontroller and the position sensor, requesting and compensating angular position and speed information, the problem of difficult high-accurate control of low-cost position sensors in low motor speed or torque noise applications is solved, achieving higher control accuracy and greater sensor selection flexibility.
Patent Information
- Application Number
- CN202411453290.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-10-18
- Filing Date
- 2024-10-17
- Publication Date
- 2025-04-18
AI Technical Summary
In applications where low-level motor speed or torque noise are required, it is difficult to achieve highly accurate control while maintaining low costs when using relatively low-cost position sensors.
By establishing a communication network between the microcontroller and the position sensor, rotor angular position and velocity information is periodically requested, and aging signals are used for compensation, the modified angular position signal is generated to improve the accuracy of angular position estimation.
This method can effectively reduce the impact of time delay on position measurement results, reduce noise, improve the accuracy of motor control, and provide greater sensor selection flexibility.
Smart Images

Figure CN119853508A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a method of controlling a brushless electric motor and a motor circuit including a motor, in particular but not limited to a brushless DC motor. Background Art
[0002] There are many types of electric motors known, and there are also many methods of controlling these motors. For applications that require very accurate motor torque control at low speeds, brushless motors, i.e. direct current DC motors, are often provided. Such motors have a long service life and high efficiency because they do not contain commutation brushes. The motor is controlled by applying a modulated signal to each motor phase. One particularly common form or modulation is pulse width modulation (PWM), in which a fixed voltage is applied to a set of switches that are turned on and off in a controlled manner to apply a pulse width modulated waveform to each phase. The output of the switches is then connected to each phase of the brushless DC motor. The average voltage applied to each phase is set by the duty cycle of the waveform, and the ON time of each energized phase can vary between 0% and 100% within each PWM cycle. The switches are usually arranged in an H-bridge pattern, with a pair of switches for each phase, allowing that phase to be connected to a positive DC supply or ground at any time.
[0003] Since the motor has no brushes, the controller that generates the pulse width modulated waveform must receive information about the position of the motor’s rotor. This ensures that the phases are energized and de-energized at the correct times, depending on the relative electrical position of the rotor and stator, thereby electronically commutating the motor.
[0004] In a typical PWM approach, the duty cycle is set to a fixed frequency and the voltage or current in the motor is adjusted to achieve the desired motor behavior. To achieve precise control, the position of the motor and the value of the voltage or current flowing in the motor are fed back to a PID-type controller, which changes the PWM signal to reduce the error between the actual motor behavior and the desired motor behavior. Any error in the position measurement or the voltage or current measurement is fed back and can generate a lot of noise in the motor. This can include harmonics in the audible frequency range, which can produce unwanted noise and, in the case of motors in steering systems, can also produce unpleasant vibrations that can be felt on the steering wheel.
[0005] The motor rotor position can be measured relatively easily using a sensor such as a Hall Effect type sensor, which detects the relative position between a target magnet fixed to the motor rotor and the sensing head of the Hall Effect sensor. The sensing head can have one or more discrete sensors offset from each other, and there can be more than one magnet fixed to the rotor at different positions. Such position sensors can be purchased off the shelf, and the cost of the device varies with the level of performance it achieves. Higher performance and generally more expensive sensors will have high resolution, high accuracy, and low latency. Latency in this article refers to the delay between making subsequent position measurements, with shorter delays providing lower latency.
[0006] Many sensors are also capable of making both rotor position measurements and rotor speed measurements. The latter can be achieved if the sensor has a buffer to store the current measurement and the previous measurement, and processing circuitry that can process the difference between these measurements and the time elapsed between measurements to provide a speed measurement. Speed values can often be obtained from relatively low-cost sensors, as the additional functionality is an entirely software feature that can be implemented using only a low-capacity buffer and a few lines of code.
[0007] Applicants have set out to at least partially ameliorate the problems that arise when using relatively low-cost position sensors in motor control circuits that require low levels of motor speed or torque noise. Such systems may be particularly well suited for use in automotive applications such as brake-by-wire, steer-by-wire, or electric power steering - all of which require highly accurate control while keeping costs relatively low. Summary of the invention
[0008] According to a first aspect, the invention provides a method of controlling an electric motor in an apparatus, the apparatus comprising:
[0009] A motor having a rotor,
[0010] a sensor that periodically generates an estimate of the angular position of the rotor and an estimate of the speed of the motor rotor,
[0011] microcontroller, and
[0012] a communication network connecting the microcontroller and the position sensor,
[0013] The method comprises the following steps:
[0014] periodically sending a request for rotor angular position from the microcontroller to the sensor via the network;
[0015] receiving a response from the sensor over the network indicating the rotor position and the speed of the rotor, together with an aging value indicating the age of the rotor position value sent over the network,
[0016] modifying a received rotor angular position value using the aging signal and the speed signal at the microprocessor to generate a modified angular position signal, the modified angular position signal being an estimate of a current rotor position; and
[0017] The modified angular position signal is used by the microcontroller to generate a set of control signals for the motor.
[0018] The method step of modifying the rotor position value may comprise adding a compensation value to the angular position value, the compensation value being determined by combining the received speed with the age of the signal, such that for any given speed, the greater the age, the greater the magnitude of the compensation value.
[0019] The method can use the following functions to perform the modification step:
[0020] Modified angular position = angular position + (age x speed).
[0021] where angular position is the motor position most recently received from the position sensor;
[0022] Age indicates the time that has passed since the angular position value was calculated relative to when it was read from the sensor and sent to the microcontroller, and
[0023] Speed is the speed received from the position sensor.
[0024] The sensor may generate an aging signal indicating the time that has elapsed since the sensor generated the angular position and velocity values and loaded them into the microcontroller as a response to a request.
[0025] In one arrangement, the aging signal may have a value indicative of the relative time at which a request is received from the microcontroller within each cycle of the sensor, and the method may process this to produce an aging value indicative of the elapsed time using a transformation.
[0026] For example, the sensor may generate a count value Fsync that varies linearly from the beginning to the end of each cycle, the sensor generates each angular position estimate at a fixed value of Fsync in each cycle, and then the sensor may send the Fsync value when these values are loaded onto the communication network to the microcontroller. This Fsync value will be greater than the value when the angular position was calculated, or in the case of a read request received at a point in the sensor cycle before a new estimate for that cycle is calculated, the Fsync value may be less than the value when the angular position was calculated.
[0027] For example, the count may go from 0 to 31, and the angular position may be read at count 22 in each sensor cycle. If a read request is received before the count reaches 22, the sensor will send back to the microcontroller the most recent angular position value, which will be the value determined in the previous sensor cycle. If a request is received shortly after the counter reaches 22, the value sent back will be the most recently calculated angular position from the current sensor cycle.
[0028] In the case where the period of the read request is not an integer multiple of the sensor read period, the value of Fsync will vary from read to read, causing the age of the value to vary from read to read. The present invention compensates for this age variation, thereby providing greater flexibility in sensor selection for a given application, and in particular allowing the use of sensors with relatively high latency. Latency in this specification refers to the time between the sensor storing the rotor position and loading that value into the network following a read request. Unless the sensor and microcontroller are synchronized, they will drift in and out of sync, resulting in variable latency.
[0029] Thus, the method may comprise requesting the rotor position at fixed time intervals that are non-integer multiples of the time interval between successive estimates of the angular position generated by the position sensor.
[0030] Most preferably, the frequency of the requested rotor position and speed is an integer multiple of the motor control signal frequency.A suitable motor control strategy that may be used which requires accurate rotor position information as input is pulse width modulation PWM.
[0031] The method may include determining the modified position using the value returned in response to the request after the request has been sent to the signal, all before a next request is sent to the sensor. Alternatively, where the time taken to receive the value over the communications network is long relative to the time between requests, the calculation may be performed at the next cycle (i.e. after the next request is sent). In either case, the calculation is performed after the response to the request has been received, so the calculation is performed using the latest value available to the microprocessor.
[0032] For example, requests may be sent with a period of 200 microseconds, the period of the PWM waveform may be 50 microseconds, and the sensor may generate new angular position estimates with a period of between approximately 20 microseconds and 60 microseconds. In the case of using an off-the-shelf sensor, this will depend on the sensor design.
[0033] The communication network may include a serial peripheral interface. The request sent by the microcontroller may include a word sent via the interface. Prior to this, a wake-up signal for waking up the sensor may be placed on the interface.
[0034] The communication network may include one of a variety of other protocols, such as a fast synchronous serial interface SSC, an interface using a single edge nibble transmission protocol SENT, or an integer integrated circuit I2C protocol, among others.
[0035] The sensor may transmit the angular position, the speed and the aging value as continuous words over the interface in response to receiving a request word from the microcontroller.
[0036] The sensor may generate the velocity value by processing the most recently determined angular position value and the immediately preceding angular position value together with calculating the time between these two values.
[0037] The sensor can determine the time based on the frequency of calculation of the angular position values. In the case where the time varies with the cycle, the actual elapsed time determined from the sensor's internal clock can be used.
[0038] According to a second aspect, the present invention provides a motor circuit, the motor circuit comprising:
[0039] A motor having a rotor,
[0040] a sensor that periodically generates an estimate of the angular position of the rotor and an estimate of the speed of the motor rotor,
[0041] microcontroller, and
[0042] a communication network connecting the microcontroller and the position sensor,
[0043] Wherein, the circuit is configured to execute the steps of the method of the first aspect of the present invention.
[0044] The motor may include a brushless motor.
[0045] The circuit may form part of an automotive system. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] One embodiment of the present invention will now be described, by way of example only, with reference to and as illustrated in the accompanying drawings, in which:
[0047] Figure 1 is a block diagram showing key functional components of an embodiment of a motor circuit according to a second aspect of the present invention;
[0048] Figure 2 is a timing diagram showing the relative start and end times of a series of microcontroller cycles and a series of position sensor cycles;
[0049] Figure 3 is the speed on the vertical axis and Figure 2A diagram showing the relationship between the period and cycle in Figure 1, showing the timing of the sensor determining the rotor position and speed values and the delay relative to the read request received by the sensor, where the actual speed of the rotor is shown next to the speed determined by the microcontroller when processing only the received motor position signal;
[0050] Figure 4 shows the signal flow from the sensor to the microcontroller and the generation of a modified angular position signal for generating a PWM waveform;
[0051] Figure 5 is a flow chart of key method steps performed by the circuit during each microcontroller according to the first aspect of the present invention;
[0052] Figure 6 is a timing diagram showing, from the top, the signals sent over the SPI bus over time, the triggering of calculating a new PWM duty cycle, the timing of requesting to read and determine the modified rotor position value, and the resulting PWM waveform;
[0053] Figure 7 shows what would happen if the microcontroller used only the unmodified rotor position signal value for more PWM cycles Figure 3 The velocity error in , and the relationship between the error and the FSYNC value at the sensor. DETAILED DESCRIPTION
[0054] like Figure 1 As shown, the motor circuit comprises a brushless DC motor 6 having 3 phases. Of course, the invention can be applied to motors having more than 3 phases, and motors having more than one channel, such as a dual channel motor with 3 or more phases for each channel. It can also be applied to brushless motors, although self-commutated, but unusually requiring position measurement to control such motors.
[0055] Although not shown in detail, the motor 6 includes a stator and a rotor having a set of permanent magnets buried a small distance below the surface of the rotor and arranged with alternating north and south poles. The stator in this example surrounds the rotor and has a cylindrical yoke with a set of pole teeth that protrude inwardly from the yoke and terminate slightly above the surface of the rotor to define a small air gap. Coils of wire are wound around the poles to form three separate coil groups, each of which defines a phase of the motor. The coils in this example are all connected at a common point called the star point, and the opposite ends of the coils are free to connect to the motor drive bridge, which will be explained later.
[0056] The rotor and stator share an axis about which the rotor is free to rotate when no current is applied to the phase windings. When voltage is applied to one or more of the phase windings, it causes current to flow, which in turn generates a magnetic field. This field interacts with the field of the permanent magnets and, depending on the relative positions of the rotor, stator, and energized windings, can cause the rotor to rotate in one direction or the other or remain locked in place.
[0057] The voltage is applied to each phase through the drive bridge 5, which is a conventional H-bridge. It can have three pairs of switches, each pair comprising a top switch and a bottom switch connected in series between the supply and ground. The center tap between two series switches is connected to the free end of the corresponding phase. By closing the upper switch in a pair and opening the lower switch, the corresponding phase will be connected to the supply voltage (minus any voltage drop across the upper switch), and by closing the upper switch and opening the lower switch, the phase can be connected to ground.
[0058] The opening and closing of the switches of the drive bridge 5 is achieved by applying control signals to the gates of the individual switches. These control signals include a pulse width modulated waveform generated by a PWM generator. This in turn is a response to a voltage demand signal output by a microcontroller. The PWM generator and microcontroller can be combined into a single processing circuit.
[0059] Figure 6 Three traces are shown, representing the PWM signals applied to the various phases when the device is in use. It can be seen that the three signals in this example have the same duty cycle and are offset from each other. The PWM period chosen in this example is 50 microseconds.
[0060] The voltage demand signal is calculated every 200 microseconds and passed to the PWM generator, which updates the duty cycle of the PWM signal. The value chosen for the duty cycle depends on the torque or speed required by the motor, the motor properties, and more importantly, the angular position of the motor rotor relative to the stator.
[0061] like Figure 1 As shown, the motor circuit 1 includes a position sensor 2 that measures the angular position of the rotor. Sensor 2 repeatedly takes measurements at intervals of 42.6 microseconds. Specifically, sensor 2 repeatedly starts reading the motor rotor angular position at 22 / 32 of each cycle and saves it in the sensor's buffer. The counter FSYNC within sensor 2 counts from 0 at the start of the cycle until it reaches 31, then loops back to zero to mark the start of the next calculation cycle. Therefore, in this example, when the count is 21, the motor position is updated in the buffer. Within the loop, sensor 2 also calculates the speed of the rotor by calculating the difference between the position value stored in the current cycle and the position value stored in the previous cycle and combining it with the known 42.6 microsecond elapsed time between the values. This is also stored in the buffer.
[0062] The circuit 1 also includes a current sensor 7 which enables the controller 3 to be used within a feedback loop to drive the measured current towards the desired current in the motor. In this example, the controller is a PID type controller using only PI terms, but those skilled in the art will appreciate that this should not be seen as limiting the scope of the invention.
[0063] The current measurements and the motor rotor angular position are fed into a PI controller 3 together with an error value representing the difference between the required current and the measured current. The signals are transferred between the sensor and the microcontroller via an SPI interface 4.
[0064] When used by the PI controller 3, the motor position must be accurate. In particular, it is very important to use the most recent position measurements possible. If old measurements are used, they will be wrong because they will lag behind the actual position of the rapidly moving rotor. The applicant has realized that the cycle frequency of the position measurement of 42.6 microseconds is both a large fraction of the PWM period and that the PWM period is also a non-integer multiple of the sensor frequency. Therefore, the microcontroller will request a position measurement from the sensor at a set point in the PWM period (usually at the beginning), but this can correspond to any time within the sensor cycle. At this time, the sensor may have just determined a new position measurement, for example, the request coincides with the sensor's counter at 23 or 24, or it may be just before that time, such as at 20 or 21. In the first case, the returned position will be very new and therefore relatively accurate, in the latter case it will be older and less accurate. This will vary from request to request over time, introducing a variable delay to the signal.
[0065] exist Figure 2 and Figure 3 This drift can be seen in Figure 7 This can be seen over more PWM cycles. Figure 2 As shown in the figure, the microcontroller cycle is 200 microseconds, and the sensor cycle shown below is 42.6 microseconds. The former is a non-integer multiple of the latter. Figure 2 In the example, the starting point of the first microcontroller cycle is aligned with the starting point of the sensor cycle, and then in the next three microcontroller cycles, the starting point moves along the sensor cycle until it returns to the starting point.
[0066] Figure 3The effect of this misalignment on the age of the rotor angular position measurements sent to the microcontroller within each microcontroller cycle is shown. The figure also shows the timing of the position measurements made within the sensor and the timing of the read requests within each microcontroller cycle. The delay between the latest measurement and the read request varies from one microcontroller cycle to the next, introducing a non-constant error. This can create noise in the control loop if not controlled.
[0067] Figure 1 The microcontroller in the sensor overcomes the effects of latency by requesting the most recently calculated angular position of the motor rotor and the most recently calculated velocity and counter value FSYNC at the time of the read request (rather than the counter value at the time of the last measurement, which in this case always occurs at the sampled value of FSYNC due to the design of the sensor). The effect of the sensor using the old and most recent positions to determine velocity is that it lags behind the actual velocity by a small fixed amount, which can be compensated to some extent within the sensor, however it is not a noise signal as it does not contain the variable latency calculated within the sensor.
[0068] Once the signal is received, the rotor angular position is modified to produce a modified position value using the following formula:
[0069] Modified angular position = motor rotor angular position + (age x speed).
[0070] Note that the Fsync values in this example must be transformed in order to be fed into the equation as age values, so an Fsync value of 22 corresponds to the shortest time delay and an age of zero, while an Fsync value of 21 corresponds to the longest time delay and the highest age value. This transformation will require knowledge of how often the position values are generated in order to generate an age value in the real-time domain.
[0071] The effect of time delay on the position measurement can be improved by taking into account the time since the last position measurement and modifying it with the speed measurement. The speed of the motor is assumed to remain constant during the PWM cycle, which is reasonable when the cycle is very short and the motor has high inertia.
[0072] The position value is fed to a PI controller 3 which generates the motor demand voltage for a PWM generator 3a. This generates a set of motor control waveforms which are applied to the motor drive stage. The present invention can be implemented using other motor control strategies, but PWM is by far the most common strategy in widespread application. By eliminating the variable delay, the control signal is found to be much less noisy than if no modification was made.
[0073] Figure 6The timing diagram shows an exemplary process based on the use of a position sensor connected to a microcontroller via an SPI bus. In this example, the following parameters of the device are defined:
[0074] The PWM period is 50 microseconds
[0075] The microcontroller runs via an interrupt with a period of 200 microseconds
[0076] Requests to read the motor rotor position and speed are made at the beginning of each microcontroller cycle and about 100 microseconds before the PWM generator starts calculating the PWM duty cycle for the next few PWM cycles.
[0077] The position and speed of the motor rotor are read back from the sensor - in the first half of the microcontroller cycle and before the PWM generator starts calculating.
[0078] PWM interrupt - the timing signal that starts each PWM cycle - every 50 microseconds.
[0079] Sensor latency – 42.6 microseconds, not synchronous with the microcontroller or PWM generator.
[0080] The approach taken by the circuit is summarized below and is Figure 5 are listed in the flow chart.
[0081] At the start of each microcontroller cycle, a short trigger signal is applied to the CS line of the SPI bus 4 to wake up 100 the position sensor. A word is then transmitted 101 from the microcontroller 2 to the sensor 4 on the MOSI line of the SPI, telling the sensor to request a new set of measurements. This always occurs at the same fixed point within the microcontroller cycle. The sensor responds by loading three words onto the SPI bus: the first word gives the value of the counter FSYCNC at the time the position and speed signals were read from the buffer; the second word gives the most recently determined value of the motor rotor angular position (motor angle), which may be very recent or at most one sensor cycle ago; and the most recently determined value of the motor speed. The microcontroller reads 102 these values from the SPI bus and stores them in the microcontroller's buffer for use in the next microcontroller cycle.
[0082] Once the next microcontroller cycle begins, the microcontroller takes all three stored values from the previous cycle held in the buffer and calculates 103 the modified motor position. This is then stored back into the buffer for use by the PWM generator until the next time the modified motor position is determined, overwriting the previous value. Optionally, the motor speed is calculated 104 using the most recent and last modified position signal values. The reason it cannot perform this calculation before sending the next read request is simply due to the length of time it takes to receive information from the sensor, which is approximately 150 microseconds, plus the time it takes to wake up the sensor and send the request, as well as other factors.
[0083] Finally, the modified angular position signal value is used together with the measured current to determine the PWM duty cycle. Figure 5 The steps will continue as long as the motor is running.
Claims
1. A method of controlling an electric motor in a device, the device comprising: - a motor having a rotor, a sensor which periodically generates an estimate of the angular position of the rotor and an estimate of the speed of the motor rotor, - microcontroller, and - a communication network connecting said microcontroller and said position sensor, The method comprises the following steps: - periodically sending a request for the rotor angular position from the microcontroller to the sensor via the network; - receiving, from said sensor via said network, a response indicative of said rotor angular position and of a speed of said rotor, together with an aging value indicative of an age of said rotor angular position value sent via said network; - modifying a received rotor angular position value using the aging signal and the speed signal at the microprocessor to generate a modified angular position signal, the modified angular position signal being an estimate of the current rotor position; and - generating, by the microcontroller, a set of control signals for the motor using the modified angular position signal.
2. The method according to claim 1, wherein: The step of modifying the rotor position value comprises adding a compensation value to the angular position value, the compensation value being determined by combining the received speed with the age of the signal, such that for any given speed, the greater the age, the greater the magnitude of the compensation value.
3. The method of claim 2, comprising modifying the rotor position value using the following function: Modified angular position = rotor angular position + (age x speed).
4. A method according to any one of the preceding claims, wherein: The sensor generates an aging signal indicating the time that has elapsed since the sensor generated the rotor angular position value and the speed value and loaded them into the microcontroller in response to a request.
5. A method according to any one of the preceding claims, wherein: The sensor generates a count value Fsync that varies linearly from the beginning of each cycle to the end of the cycle, and the sensor generates each angular position estimate at a fixed value of Fsync in each cycle. The sensor can then send the Fsync value when these values are loaded onto the communication network to the microcontroller, which Fsync value will be greater than the value when the angular position was calculated, or in the case where a read request is received at a point in the sensor cycle before a new estimate for that cycle is calculated, the Fsync value can be less than the value when the angular position was calculated.
6. A method according to any one of the preceding claims, wherein: The communication network comprises a serial peripheral interface and the request sent by the microcontroller comprises a word sent via the interface.
7. The method according to claim 6, wherein: The sensor transmits the rotor angular position, the speed and the aging value as continuous words over the interface in response to receiving a request word from the microcontroller.
8. A method according to any one of the preceding claims, wherein: The sensor generates the speed value by processing the most recently determined rotor angular position value and the immediately preceding rotor angular position value together with calculating the time between these two values.
9. A motor circuit, comprising: - a motor having a rotor, a sensor which periodically generates an estimate of the angular position of the rotor and an estimate of the speed of the motor rotor, - microcontroller, and - a communication network connecting said microcontroller and said position sensor, The circuit is configured to perform the steps of the method according to any one of claims 1 to 8.