MCU (Microprogrammed Control Unit)-based rotary transformer software decoding method and device
Through the MCU-based rotary transformer software decoding method, the software decoding of the rotary transformer is achieved by using the MCU and analog circuit components, and the problems of high cost and low accuracy of the axis angle solution system of the rotary transformer in the prior art are solved, and high-precision and low-cost axis angle solution are achieved.
Patent Information
- Application Number
- CN202411808877.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-10
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2044-12-10
AI Technical Summary
In the prior art, the axis angle solution system of the rotary transformer is costly and it is difficult to achieve high-precision axis angle solution.
Using the MCU-based rotary transformer software decoding method, the sinusoidal data table is triggered to be transmitted to the DAC module through the timer in the MCU, an analog high-frequency sinusoidal signal is generated, and a synchronous demodulation of the output signal of the rotation transformer is achieved through circuit components such as excitation amplifier circuit and analog multiplier, and the envelope signal containing rotor position information is obtained.
The cost of the axis angle solution system of the rotary transformer is reduced, high-precision axis angle solution is realized, the circuit is simplified, the secondary delay problem caused by communication with the decoding chip is eliminated, and the sampling accuracy of the ADC is improved.
Smart Images

Figure CN119761270A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of motor control, and more specifically, to a method and device for software decoding of a rotary transformer based on an MCU. Background Art
[0002] like Figure 1 As shown in the figure, as a high-precision and anti-interference position sensor, the resolver is widely used in the electronic control system of new energy vehicles. The resolver needs a matching decoder to obtain the rotor position information. The current mainstream decoding solution is hardware decoding based on a dedicated decoding chip, but the dedicated decoding chip is expensive. At the same time, the high-precision motion control system also puts forward new requirements for the resolver shaft angle resolution technology.
[0003] In view of the above problems, in the context of the rapid development of microprocessor performance, implementing software solution of the resolver based on a microprocessor is a feasible solution. Summary of the invention
[0004] The present invention aims to solve at least one of the technical problems existing in the prior art, and provides a software decoding method and device for a rotary transformer based on an MCU, which can reduce the cost of a rotary transformer shaft angle resolution system and achieve high-precision shaft angle resolution.
[0005] As a first aspect of the present invention, a software decoding method for a rotary transformer based on an MCU is provided, comprising:
[0006] Step S1: The sine data table is transmitted to the DAC module through the timer in the MCU, and the digital high-frequency sine signal D in the sine data table is converted into exc Converted into analog high-frequency sinusoidal signal Usinωt;
[0007] Step S2: The analog high-frequency sinusoidal signal Usinωt is amplified by an excitation amplifier circuit and then output as an excitation signal U exc , and the excitation signal U exc Acting on the primary winding of the rotary transformer, the first secondary winding and the second secondary winding of the rotary transformer respectively output a first induction signal KUsinωtsinθ and a second induction signal KUsinωtcosθ;
[0008] Step S3: The excitation signal U excThe first induction signal KUsinωtsinθ is input into a first four-quadrant analog multiplier for modulation to output a first modulation signal, and the first modulation signal is input into a first low-pass filter for demodulation to output a first analog envelope signal KUsinθ containing the actual position angle θ of the motor rotor; at the same time, the excitation signal U exc and the second induction signal KUsinωtcosθ are input into a second four-quadrant analog multiplier for modulation to output a second modulation signal, and the second modulation signal is input into a second low-pass filter for demodulation to output a second analog envelope signal KUcosθ containing the actual position angle θ of the motor rotor;
[0009] Step S4: inputting the first analog envelope signal KUsinθ into the first conditioning circuit for level adjustment to output the first analog envelope signal KUsinθ after level adjustment, and converting the first analog envelope signal KUsinθ after level adjustment into the first digital envelope signal KUsinθ through the first ADC module; at the same time, inputting the second analog envelope signal KUcosθ into the second conditioning circuit for level adjustment to output the second analog envelope signal KUcosθ after level adjustment, and converting the second analog envelope signal KUcosθ after level adjustment into the second digital envelope signal KUcosθ through the second ADC module;
[0010] Step S5: Get the motor rotor decoding position angle at the last moment And according to the motor rotor decoding position angle at the last moment The first digital envelope signal KUsinθ at the current moment T and the second digital envelope signal KUcosθ at the current moment T Calculate the current motor rotor decoding position angle
[0011] Furthermore, the method of transmitting the sine data table to the DAC module by triggering the timer in the MCU further includes:
[0012] The sine data table in the MCU is transferred to the DAC module via DMA.
[0013] Furthermore, the step S5 further includes:
[0014] Step S51: Decode the motor rotor position angle at the previous moment As the instantaneous phase, the digital sinusoidal signal of the previous moment is generated by looking up the table. And the digital cosine signal of the previous moment
[0016] Step S52: The first digital envelope signal KUsinθ at the current moment is T The digital cosine signal of the previous moment Multiply to get the first product The second digital envelope signal KUcosθ at the current moment T The digital sine signal of the previous moment Multiply to get the second product Then multiply the first product Subtract the second product The product difference is obtained. The calculation formula of the product difference is as follows:
[0017]
[0018] Among them, K is the effective turns ratio of the rotary transformer, and U is the amplitude of the excitation signal;
[0019] Step S53: Perform trigonometric operations on the product difference, and calculate the actual position angle θ of the motor rotor at the current moment. T Decoded position angle of the motor rotor at the previous moment Calculate the deviation signal △θ at the current moment * ,Right now According to L'Hôpital's rule of trigonometric functions, when △θ * approaches 0, then sin△θ * ≈△θ * , the deviation signal △θ at the current moment * Perform PI adjustment operation to calculate the motor rotor speed ω at the current moment c , the calculation formula is as follows:
[0020]
[0021] Among them, K p is the magnification, K i is the integration coefficient;
[0022] Step S54: The current motor rotor speed ω c Perform integral operation to calculate the motor rotor decoding position angle at the current moment The calculation formula is as follows:
[0023]
[0024] As a second aspect of the present invention, a software decoding device for a rotary transformer based on an MCU is provided. The software decoding device for a rotary transformer based on an MCU includes an MCU, an excitation amplifier circuit, a first conditioning circuit, a second conditioning circuit, a first four-quadrant analog multiplier, a second four-quadrant analog multiplier, a first low-pass filter and a second low-pass filter. The MCU includes a timer, a DAC module, a first ADC module and a second ADC module. The DAC module is connected to the excitation amplifier circuit. The excitation amplifier circuit is respectively connected to the primary winding of the rotary transformer, the first input end of the first four-quadrant analog multiplier and the first input end of the second four-quadrant analog multiplier. The first secondary winding of the rotary transformer is connected to the second input end of the first four-quadrant analog multiplier. The second secondary winding of the rotary transformer is connected to the second input end of the second four-quadrant analog multiplier. The output end of the first four-quadrant analog multiplier is connected to the first ADC module through the first low-pass filter and the first conditioning circuit. The output end of the second four-quadrant analog multiplier is connected to the second ADC module through the second low-pass filter and the second conditioning circuit.
[0025] Furthermore, the MCU also includes a memory, and the sinusoidal data table is stored in the memory.
[0026] Furthermore, the model of the MCU is STM32G431.
[0027] The MCU-based rotary transformer software decoding method and device provided by the present invention have the following advantages: no dedicated decoding chip is used, and the software decoding of the rotary transformer is realized by relying on the high computing power and rich peripherals of the microprocessor, eliminating the secondary delay problem caused by communication with the decoding chip, simplifying the circuit, and saving design costs. The four-quadrant analog signal multiplication circuit and low-pass filter circuit built by discrete components realize synchronous demodulation of the rotary transformer output signal to obtain the envelope signal containing the rotor position information, simplifying the software decoding calculation amount and saving decoding time. At the same time, without increasing the hardware cost, the oversampling technology is used to increase the sampling rate and increase the effective sampling accuracy of the ADC, thereby improving the accuracy of the rotary transformer shaft angle solution. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] The accompanying drawings are used to provide further understanding of the present invention and constitute a part of the specification. Together with the following specific embodiments, they are used to explain the present invention, but do not constitute a limitation of the present invention.
[0029] Figure 1 The electrical schematic diagram of the rotary transformer.
[0030] Figure 2The present invention provides a flowchart of a software decoding method for a rotary transformer based on an MCU.
[0031] Figure 3 A schematic diagram of modulating and demodulating the first sensing signal KUsinωtsinθ provided by the present invention.
[0032] Figure 4 This is a structural diagram of the MCU-based rotary transformer software decoding device provided by the present invention. DETAILED DESCRIPTION
[0033] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following is a detailed description of the specific implementation, structure, features and effects of the MCU-based rotary transformer software decoding method and its device proposed by the present invention in combination with the accompanying drawings and preferred embodiments. Obviously, the described embodiments are part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0034] In this embodiment, a software decoding method for a rotary transformer based on an MCU is provided. Figure 2 As shown, the MCU-based resolver software decoding method includes:
[0035] Step S1: The sine data table is transmitted to the DAC module through the timer in the MCU, and the digital high-frequency sine signal D in the sine data table is converted into exc Converted into analog high-frequency sinusoidal signal Usinωt;
[0036] Preferably, the method of transmitting the sine data table to the DAC module by triggering the timer in the MCU further includes:
[0037] The sine data table in the MCU is transferred to the DAC module via DMA.
[0038] Step S2: The analog high-frequency sinusoidal signal Usinωt is amplified by an excitation amplifier circuit and then output as an excitation signal U exc , and the excitation signal U exc Acting on the primary winding of the rotary transformer, according to the principle of electromagnetic induction, the first secondary winding and the second secondary winding of the rotary transformer respectively output a first induction signal KUsinωtsinθ and a second induction signal KUsinωtcosθ;
[0039] Step S3: Figure 3 As shown, the excitation signal U excThe first induction signal KUsinωtsinθ is input into a first four-quadrant analog multiplier for modulation to output a first modulation signal, and the first modulation signal is input into a first low-pass filter for demodulation to output a first analog envelope signal KUsinθ containing the actual position angle θ of the motor rotor; at the same time, the excitation signal U exc and the second induction signal KUsinωtcosθ are input into a second four-quadrant analog multiplier for modulation to output a second modulation signal, and the second modulation signal is input into a second low-pass filter for demodulation to output a second analog envelope signal KUcosθ containing the actual position angle θ of the motor rotor;
[0040] Step S4: inputting the first analog envelope signal KUsinθ into the first conditioning circuit for level adjustment to output the first analog envelope signal KUsinθ after level adjustment, and converting the first analog envelope signal KUsinθ after level adjustment into the first digital envelope signal KUsinθ through the first ADC module; at the same time, inputting the second analog envelope signal KUcosθ into the second conditioning circuit for level adjustment to output the second analog envelope signal KUcosθ after level adjustment, and converting the second analog envelope signal KUcosθ after level adjustment into the second digital envelope signal KUcosθ through the second ADC module;
[0041] It should be noted that after the first ADC module and the second ADC module complete the conversion, the 4 consecutive samples are 4 The data are accumulated and the accumulated result is shifted right by 4 bits for extraction to improve the 4-bit ADC resolution and the angle resolution accuracy.
[0042] Step S5: Get the motor rotor decoding position angle at the last moment And according to the motor rotor decoding position angle at the last moment The first digital envelope signal KUsinθ at the current moment T and the second digital envelope signal KUcosθ at the current moment T Calculate the current motor rotor decoding position angle
[0043] Preferably, the step S5 further includes:
[0044] Step S51: Decode the motor rotor position angle at the previous moment As the instantaneous phase, the digital sinusoidal signal of the previous moment is generated by looking up the table. And the digital cosine signal of the previous moment
[0046] Step S52: The first digital envelope signal KUsinθ at the current moment is T The digital cosine signal of the previous moment Multiply to get the first product The second digital envelope signal KUcosθ at the current moment T The digital sine signal of the previous moment Multiply to get the second product Then multiply the first product Subtract the second product The product difference is obtained. The calculation formula of the product difference is as follows:
[0047]
[0048] Among them, K is the effective turns ratio of the rotary transformer, and U is the amplitude of the excitation signal;
[0049] Step S53: Perform trigonometric operations on the product difference, and calculate the actual position angle θ of the motor rotor at the current moment. T Decoded position angle of the motor rotor at the previous moment Calculate the deviation signal △θ at the current moment * ,Right now According to L'Hôpital's rule of trigonometric functions, when △θ * approaches 0, then sin△θ * ≈△θ * , the deviation signal △θ at the current moment * Perform PI adjustment operation to calculate the motor rotor speed ω at the current moment c , the calculation formula is as follows:
[0050]
[0051] Among them, K p is the magnification, K i is the integration coefficient;
[0052] Step S54: The current motor rotor speed ω c Perform integral operation to calculate the motor rotor decoding position angle at the current moment The calculation formula is as follows:
[0053]
[0054] As another embodiment of the present invention, Figure 4As shown, a rotary transformer software decoding device based on MCU is provided, and the rotary transformer software decoding device based on MCU includes an MCU, an excitation amplifier circuit, a first conditioning circuit, a second conditioning circuit, a first four-quadrant analog multiplier, a second four-quadrant analog multiplier, a first low-pass filter and a second low-pass filter. The MCU includes a timer, a DAC module, a first ADC module and a second ADC module. The DAC module is connected to the excitation amplifier circuit, and the excitation amplifier circuit is respectively connected to the primary winding of the rotary transformer, the first input end of the first four-quadrant analog multiplier and the first input end of the second four-quadrant analog multiplier. The first secondary winding of the rotary transformer is connected to the second input end of the first four-quadrant analog multiplier, and the second secondary winding of the rotary transformer is connected to the second input end of the second four-quadrant analog multiplier. The output end of the first four-quadrant analog multiplier is connected to the first ADC module through the first low-pass filter and the first conditioning circuit, and the output end of the second four-quadrant analog multiplier is connected to the second ADC module through the second low-pass filter and the second conditioning circuit.
[0055] Preferably, the MCU further comprises a memory, and the sinusoidal data table is stored in the memory.
[0056] Preferably, the model of the MCU is STM32G431.
[0057] The working principle of the rotary transformer software decoding device based on MCU provided by the present invention is described with reference to the above description of the rotary transformer software decoding method based on MCU, which will not be repeated here.
[0058] The software decoding method for a rotary transformer based on an MCU provided by the present invention does not use a dedicated decoding chip, but relies on the high computing power and rich peripherals of a microprocessor to realize software decoding of a rotary transformer, thereby eliminating the secondary delay problem caused by communication with a decoding chip, simplifying the circuit, and saving design costs. The synchronous demodulation of the rotary transformer output signal is realized by a four-quadrant analog signal multiplication circuit and a low-pass filter circuit constructed by discrete components to obtain an envelope signal containing rotor position information, thereby simplifying the software decoding calculation amount and saving decoding time. At the same time, without increasing the hardware cost, an oversampling technology is used to increase the sampling rate, increase the effective sampling accuracy of the ADC, and thereby improve the resolution accuracy of the rotary transformer shaft angle.
[0059] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. Although the present invention has been disclosed as a preferred embodiment as above, it is not used to limit the present invention. Any technician familiar with this profession can make some changes or modifications to equivalent embodiments of equivalent changes using the technical contents disclosed above without departing from the scope of the technical solution of the present invention. However, any simple modification, equivalent change and modification made to the above embodiments based on the technical essence of the present invention without departing from the content of the technical solution of the present invention still falls within the scope of the technical solution of the present invention.
Claims
1. A software decoding method for a rotary transformer based on MCU, characterized in that: The steps include: Step S1: The sine data table is transmitted to the DAC module through the timer in the MCU, and the digital high-frequency sine signal D in the sine data table is converted into exc Converted into analog high-frequency sinusoidal signal Usinωt; Step S2: The analog high-frequency sinusoidal signal Usinωt is amplified by an excitation amplifier circuit and then output as an excitation signal U exc , and the excitation signal U exc Acting on the primary winding of the rotary transformer, the first secondary winding and the second secondary winding of the rotary transformer respectively output a first induction signal KUsinωtsinθ and a second induction signal KUsinωtcosθ; Step S3: The excitation signal U exc The first induction signal KUsinωtsinθ is input into a first four-quadrant analog multiplier for modulation to output a first modulation signal, and the first modulation signal is input into a first low-pass filter for demodulation to output a first analog envelope signal KUsinθ containing the actual position angle θ of the motor rotor; at the same time, the excitation signal U exc and the second induction signal KUsinωtcosθ are input into a second four-quadrant analog multiplier for modulation to output a second modulation signal, and the second modulation signal is input into a second low-pass filter for demodulation to output a second analog envelope signal KUcosθ containing the actual position angle θ of the motor rotor; Step S4: inputting the first analog envelope signal KUsinθ into the first conditioning circuit for level adjustment to output the first analog envelope signal KUsinθ after level adjustment, and converting the first analog envelope signal KUsinθ after level adjustment into the first digital envelope signal KUsinθ through the first ADC module; at the same time, inputting the second analog envelope signal KUcosθ into the second conditioning circuit for level adjustment to output the second analog envelope signal KUcosθ after level adjustment, and converting the second analog envelope signal KUcosθ after level adjustment into the second digital envelope signal KUcosθ through the second ADC module; Step S5: Get the motor rotor decoding position angle at the last moment And according to the motor rotor decoding position angle at the last moment The first digital envelope signal KUsinθ at the current moment T and the second digital envelope signal KUcosθ at the current moment T Calculate the current motor rotor decoding position angle 2. The MCU-based resolver software decoding method according to claim 1, characterized in that: The method of transmitting the sine data table to the DAC module by triggering the timer in the MCU also includes: The sine data table in the MCU is transferred to the DAC module via DMA.
3. The MCU-based resolver software decoding method according to claim 1, characterized in that: The step S5 further includes: Step S51: Decode the motor rotor position angle at the previous moment As the instantaneous phase, the digital sinusoidal signal of the previous moment is generated by looking up the table. And the digital cosine signal of the previous moment Step S52: The first digital envelope signal KUsinθ at the current moment is converted into T The digital cosine signal of the previous moment Multiply to get the first product The second digital envelope signal KUcosθ at the current moment T The digital sine signal of the previous moment Multiply to get the second product Then multiply the first product Subtract the second product The product difference is obtained. The calculation formula of the product difference is as follows: Among them, K is the effective turns ratio of the rotary transformer, and U is the amplitude of the excitation signal; Step S53: Perform trigonometric operations on the product difference, and calculate the actual position angle θ of the motor rotor at the current moment. T Decoded position angle of the motor rotor at the previous moment Calculate the deviation signal △θ at the current moment * ,Right now According to L'Hôpital's rule of trigonometric functions, when △θ * approaches 0, then sin△θ * ≈△θ * , the deviation signal △θ at the current moment * Perform PI adjustment operation to calculate the motor rotor speed ω at the current moment c , the calculation formula is as follows: Among them, K p is the magnification, K i is the integration coefficient; Step S54: The current motor rotor speed ω c Perform integral operation to calculate the motor rotor decoding position angle at the current moment The calculation formula is as follows:
4. A rotary transformer software decoding device based on MCU, used to implement the rotary transformer software decoding method based on MCU according to any one of claims 1 to 3, characterized in that: The MCU-based rotary transformer software decoding device includes an MCU, an excitation amplifier circuit, a first conditioning circuit, a second conditioning circuit, a first four-quadrant analog multiplier, a second four-quadrant analog multiplier, a first low-pass filter and a second low-pass filter. The MCU includes a timer, a DAC module, a first ADC module and a second ADC module. The DAC module is connected to the excitation amplifier circuit. The excitation amplifier circuit is respectively connected to the primary winding of the rotary transformer, the first input end of the first four-quadrant analog multiplier and the first input end of the second four-quadrant analog multiplier. The first secondary winding of the rotary transformer is connected to the second input end of the first four-quadrant analog multiplier. The second secondary winding of the rotary transformer is connected to the second input end of the second four-quadrant analog multiplier. The output end of the first four-quadrant analog multiplier is connected to the first ADC module through the first low-pass filter and the first conditioning circuit. The output end of the second four-quadrant analog multiplier is connected to the second ADC module through the second low-pass filter and the second conditioning circuit.
5. The MCU-based resolver software decoding device according to claim 4, characterized in that: The MCU further comprises a memory, and the sinusoidal data table is stored in the memory.
6. The MCU-based resolver software decoding device according to claim 4, characterized in that: The model of the MCU is STM32G431.
Citation Information
Patent Citations
Software decoding circuit of rotary transformer
CN115683175A
Rotary transformer shaft angle software decoding method
CN116184905A
Soft decoding method for rotary transformer
CN118611521A