x Abstract The main goal of this research revolves around designing and making a control circuit that can amplify the output signals of the sine and cosine coils from the three-phase PM
INTRODUCTION
Reason for choosing the topic
The need for the development and manufacturing of electric motors is being driven by numerous enterprises as electric motor-powered gadgets become more and more common and eventually replace fossil fuel engines Not to add, many nations are focusing their research and development efforts on electric-motor vehicles, and Vietnam is by no means an exception to this global trend According to [1], it is evident that the Vietnamese market has enormous potential for the development of electric vehicles; currently, 1,100 mostly imported vehicles are in use for leisure and personal use Vietnamese consumers have not truly embraced electric automobiles, nevertheless, since the economy and performance of electric motors are still not thought to be as good as those of gasoline engines, based on 33% of poll participants Referred to from a recent poll, the intention to purchase an electric automobile [2] Researchers need tools to assess engines and increase the efficiency of electric motors in order to stay up with the ongoing development of electric vehicles and the capacity to localize products Consequently, it is essential to conduct research and design electric motor testing apparatus Vietnam is one of the national being pressured to create electric vehicles, despite not being a leader in the sector
Since then, research and design have gone into creating an electric motor test bench Research, design, and production of electric vehicles based on widely used electric motors in Vietnam would eventually be feasible.
Research objective
- Calculate and design the control circuit to drive the PMSM 3-phase electric motor
- Understand the operating principles of PMSM 3-phase electric motors
- Understand the operating principles of signal amplifier circuits
- Understand and program the STM32 microcontroller to perform external
- interrupts and read ADC from signal pins to the microcontroller
- Increase the frequency of the excitation coil so that more values can be obtained in reading the ADC of the microcontroller.
Research subjects
Scope of research
Due to limited time, only three months, the team focused on developing a circuit to amplify the signal frequency of the two SIN/COSINE coils, increase the frequency of the Excitation coil and program to read the ADC signal of the two coils using How to use external interrupt using STM32 Our group only focused on finding the Theta angle to determine the position of the rotor to control the motor's operation Our team did not go into the work of calculating power or controlling the speed of the motor.
Research Methods
Use theoretical and experimental calculation methods The team researches from documentary sources, scientific articles on the Internet, basic electronics textbooks, power electronics, and microcontrollers.
Research contents
- Design of PMSM 3-phase electric motor signal amplifier
- Collects signals from the coils from the motor
- Chapter 3: System design and construction
LITERATURE REVIEW
Resolver
Resolvers are sensors that determine the position of the magnetic pole on rotors in generators or motor generators They operate based on changes in current and output waveforms from detection coils caused by rotor rotation By measuring these changes, resolvers accurately identify the rotor's position.
7 Resolver consists of a stator and a rotor The stator has one excitation coil and two detection coils (usually denoted S and C) When the rotor rotates, the distance between the stator and rotor changes because the rotor has an oval shape Alternating current with a specified frequency flows through the excitation coil [21]
Figure 2.6: Signal received from Resolver [21]
The current passing through the excitation coil creates a magnetic field in the space between the stator and rotor As the rotor rotates, the magnetic poles on the rotor interact with the magnetic field created by the excitation coil, causing changes in the current and waveform at the detection coils S and C
Detection coils S and C generate alternating currents that correspond to the magnetic pole position on the rotor The inverter and converter (MG ECU) analyze the phases and heights of these currents to determine the absolute position of the rotor.
Additionally, by calculating the change in position over a specified period of time, the CPU can use the resolver as a speed sensor to precisely measure and control the motor's rotational speed
The MG ECU monitors the output signal from the resolver and detects malfunctions, ensuring system reliability and performance [21]
According to [3], basically, the resolver (provided by Vr) and two stator windings comprise the rotary transformer, which consists of one spinning winding
8 Because the reference winding is mounted to the rotor, it rotates jointly with the shaft that passes the output windings, as explained in Figure 2.7 Resolver principle
The hardware of the resolver can be thought of as two inductive position sensors that produce two sinusoidal signals on the output in response to a sinusoidal signal applied to the input One signal's amplitude is proportionate to the sine The cosine of the shaft angle position determines the other's amplitude
Additionally referred to as output windings are both windings
The absolute position is then ascertained by analyzing the ratio of these two signals
The generated voltages, Vs and Vc, have frequencies equal to the reference voltage, Vr, and their amplitudes change based on the shaft angle θ's sine and cosine The following formula can be used to characterize the input reference signal:
𝑉 𝑟 = 𝐴0 ∗ 𝑠𝑖𝑛𝜔𝑡 (2.1) Where ω is the resolver driving frequency and A0 the input signal's amplitude
𝑉 𝑐 = 𝐾 ∗ 𝑉 𝑟 ∗ 𝑐𝑜𝑠𝜃 (2.2) Where θ is the rotor angle and K is the transformation ratio
𝑉 𝑠 = 𝐾 ∗ 𝑉 𝑟 ∗ 𝑠𝑖𝑛𝜃 (2.3) Where θ is the rotor angle and K is the transformation ratio
The Atan function makes it simple to obtain the shaft angle since it expresses the sine and cosine for the rotor angle in Eqs (2) and (3) Additionally, the shaft angle would be stated by the following equation if flaws were ignored
2.2.3 Signal conditioning for SINE/COSINE windings
In [3], One can achieve the resolver SINE/COSINE receiver circuit by using a basic differential-to-single op-amp, as seen in Figure 2.8 for the sine receiver circuit and Figure 2.9 for the cosine receiver circuit The ratio of the resistances R9/R8 in a sine receiver circuit and R13/R12 in a cosine receiver circuit is used to define the voltage gain Therefore, the signal can be changed to match the ADC's permissible range To move the signal to the middle of the ADC range, an additional DC bias needs to be provided, which may be adjusted with the help of a reference voltage The analog chain to address the sine component of the resolver is described in Figure 2.8 Schematic resolver sine receiver circuit The cos component requires the same type of architecture, as Figure 2.9 Schematic resolver cosine receiver circuit illustrates
The low pass filter added by the capacitors C5 and C6 suppresses undesired high frequencies To avoid interfering with a resolver signal and causing a considerable phase shift, the cut-off frequency of this filter needs to be selected significantly higher than the operating frequency
We can take into consideration the resistances R11 = R9 and R8 = R10, as well as the capacitances C6 = C5, in order to balance the gain and the low pass filter The following equation provides a simplified description of the transfer function:
1+𝑗𝜔𝑅 9 𝐶5 (2.5) When coupled with R9, the capacitance C5 functions as a low pass filter with a cut-off frequency 𝑓𝑝𝐿𝑝 as described in the equation: 𝑓𝑝𝐿𝑝 = 1
Figure 2.8 [3]: Schematic resolver sine receiver circuit
Figure 2.9 [3]: Schematic resolver cosine receiver circuit
2.2.4 The necessary parameters for the Sin/Cos signal amplifier circuit
The Sine/Cosine signal amplifier circuit is provided by a reference voltage source Vref
(a voltage divider bridge circuit with 1V output) calculated with the following formula:
From (7), we have the formula for the amplification results of the Sine/Cosine signal by applying the electrical superposition method:
In our application, the receiver circuit's objective is to modify the signal coming from the sin/cos winding so that an ADC may use it for digital analysis The V_out signal's range needs to be within [0 - 3,3 V], because the STM32 microcontroller only can read at this voltage level
By considering R10 = R8 = 1 kΩ, the R11 = R9 = 10 kΩ And C6 = C5 10àF
The Vref voltage was set up to 1 V in order to have a V out in the range of [0V - 3,3V]
Figure 2.10: Application schematic for sine/cosine receiver circuit [3]
2.2.5 H-Bridge Circuit uses MOSFET for change the frequency of Excitation coil
In [4], the knowledge about H-bridge circuits was presented as follows, H-bridge circuit is designed with the use of on and off capabilities from two pairs of MOSFETs that will increase the frequency at the excitation coil in the project
By wiring the circuit per the circuit diagram in Chapter 3, Section 3.3.3, the secondary coil is connected to the PMSM's excitation coil to intensify its frequency The STM32 modulates the duty cycle of the pulse, and the IC IR2103 translates high and low-level signals to enable or disable the MOSFET pairs accordingly, controlling their conduction and disconnection.
Increasing the frequency will improve the ability to read more ADC signals per cycle of the SIN and COSINE coils
+ When conducting two MOSFETs Q1 and Q4 simultaneously, current will flow from the Vbat source through Q1 - load (coil) - Q4 and to MASS
+ When conducting two MOSFETs Q3 and Q2 simultaneously, the current flows in the opposite direction from Q3 through the coil through Q2 and to MASS
NOTE: It is necessary to pay attention to the conduction and disconnection sequence of the MOSFETs to avoid short circuits
Due to the fluctuating voltage at the D pole of MOSFETs Q1 and Q3, a voltage stabilization circuit (Bootstrap circuit) is necessary at the MOSFETs' trigger pin In this article, we will utilize the IR2103 driver IC to regulate the switching action of the MOSFETs.
Figure 2.12: MOSFET trigger circuit diagram using IC IR2103 [4]
Electronic components used in the project
The following details on IC LM358P are provided based on the expressions in source [4] Low power dual pin-in (DIP) operational amplifier integrated circuit (IC) LM358P When this amplifier can do several duties in the circuit, it will have many advantages than single operating amplifiers
Because the LM358 is made up of two distinct opamps enclosed in a single package, it is referred to as a dual op amp Both of these high-gain opamps can be powered by a single or two power supply
Because it can complete more jobs with less current consumption, the IC LM358 is well-liked For this reason, they are frequently found in electrical circuits, particularly those that use batteries Used for low voltage logic circuits or microcontrollers, it has an operating voltage range of [3 – 32] VDC
17 Figure 2.19: OP-AMP IC LM358P [7] a Pin diagram of IC LM358P
Pin 1: Is the output of op-amp 1 (amplifier 1) of the IC
Pin 2: Inverting Input 1 is the inverting input of op-amp 1 (amplifier 1)
Pin 3: Non-Inverting Input 1 is the non-inverting input of op-amp 1 (amplifier 1) Pin 4: GND ground pin
Pin 5: Inverting Input 2 is the inverting input of op-amp 2 (amplifier 2)
Pin 6: Non-Inverting Input 2 is the non-inverting input of op-amp 1 (amplifier 2) Pin 7: Is the output of op-amp 2 (amplifier 2)
Pin 8: Input of LM358 supplies power to both op-amps
Figure 2.20: Pin diagram of IC LM358 [7]
18 b Technical specifications of IC LM358P
Table 2.1: Technical specifications of LM358 [16]
Input Differential Voltage Range(note1) VIDR ±32 Vdc
Input Common Mode Voltage Range(note2) VICR -0.3 to 32 Vdc
Output Short Circuit Duration Tsc Continuous
Thermal Resistance, Junction-to-Air(note3) Rà 238
Storage Temperature Range Tàg -55 to +125 0C
ESD Protection at any Pin
Operating Ambient Temperature Range TA 0 to +70 0 C
Very low operating current: About 500μA
Operating temperature range: 0 - 70 degrees Celsius
19 Thus, the LM358 operates on low voltage sources of 3V to 32V Extremely low trough power but high gain up to 100dB The 2 internal amplifiers are compatible with many different types of logic circuits
According to [14], the board the microcontroller board STM32F103C8 is based on the ST-manufactured STM32F103 F1 family chip, which has an ARM COTEX M3 core
Many programming tools are now used with the STM32F103C8 board, including IAR, Keil C, Programming libraries come in a wide variety, including Standard Peripheral Libraries, Mbed Core, STM32Cube LL, STM32Cube HAL, and STM32snippets A loader circuit is required in order to program the board; some popular loader types are ULINK, J-LINK, CMSIS-DAP, and ST-LINK
The STM32F103C8 board has a lot of power, far more than the Arduino board There are several ADC and PWM channels, and the clock can reach 72MHz The following hardware and software components are required in order to write and load code for STM32F103C8 We are using STM32CubeIDE software for this project
The STM32F103C8T6 Cortex-M3 series, with a clock frequency of 72 MHz, is intended to improve system performance while consuming minimal power It features a new low-cost microcontroller architecture that aims to rival more established 8- and 16-bit series
Clock, reset and power management:
- Management modes such as Power down reset (PDR), Power on reset (POR), and programmable voltage detector (PVD)
- Internal quartz RC 8Mhz - 40Khz
- 32.768Khz foreign quartz is used for RTC
- There are two sets, each with nine channels and 12-bit values that add up to a maximum of 4095
- Supports interrupts such Analog Watchdog Event, End of Injected Conversion, and End conversion
- Able to use trigger and auto-calibration to control ADC
- Quick switching: 1us at 65MHz
- Fast processing because of the DMA unit
For the charging circuit in this application using pulse transformers, careful consideration should be given to the microcontroller's ability to generate PWM pulses Timer blocks can generate PWM clocks that are individually read The pulse period value is created using the Auto Reload register, while pulse modulation is achieved by manipulating the PWM pulse The Capture/Compare register determines high pulse widths Pulse modulation utilizes edge-aligned pulse modulation or center-aligned pulse modulation Edge-aligned mode updates the reload register at the end of the high pulse, while center-aligned mode updates it around the cycle midpoint.
When modulating pulses using a timer, attention should be paid to:
21 The prescaler is the timer's stripper There are 16 bits corresponding to 65535 values These values can be changed during configuration
Where: f PWM : PWM frequency f TIM ∶ Timer operating frequency
In case, PSC is equal to 0 (no prescaler):
𝑓 𝑃𝑊𝑀 × (𝑃𝑆𝐶 + 1)− 1 After that, PSC needs to be increased until the ARR value fits if the value of ARR is higher than the 16-bit range
Then, the pulse width modulation is calculated as follows:
The formular show that, the duty cycle does not depend on the PWM frequency and be given by the Compare Value (CCR x ) + 1 over the Auto Reload Value (𝐴𝑅𝑅) + 1
2.3.3 Diode a Structure and working principle of diode
In [9], a diode is an electrical device composed of semiconductor material, where a p-n junction is formed by the combination of p and n semiconductor layers whereby the p semiconductor electrode is represented by electrode A (Anode) and the n semiconductor electrode by electrode K (Cathode)
A diode's most common application is to allow current to flow in one direction (referred to as the diode's forward direction) while obstructing it in the other (referred to as the
22 reverse direction) The diode can therefore be compared to an electrical check valve Direct current (DC) is created through the unidirectional process of rectifying alternating current (AC) As stated in [9], diodes can be used as rectifiers for a number of purposes, such as eliminating modulation from radio signals in radio receivers
The positive and negative terminals of the diode are linked to the A and K terminals, respectively, when the diode is forward biased The positively charged holes in the p- semiconductor are pushed toward the p-n junction by the anode, while the electrons in the n-semiconductor are pushed toward the p-n junction by the cathode, creating an attraction between the holes and electrons is able to pass through
During reverse bias, the cathode (A terminal) attracts holes away from the p-n junction, while the anode (K terminal) draws electrons toward it This prevents current flow, but an ideal diode will exhibit a small leakage current—reverse current flow through the diode.
Figure 2.23: Forward biased diode [9] Figure 2.24: Reverse biased diode [9] b Characteristics of diode
- Forward bias region: The diode starts to conduct current when 0 < VD < VTD, and this current has a very small ID value The diode's current rapidly increases and reaches the steady state when VD > VTD The forward voltage applied to the diode is now referred to as V_D where VTD stands for the voltage closure
- Reverse bias region: The current flowing through the diode drops to zero when
VD < 0, but it does not stop there; rather, it keeps going in the opposite direction
23 at the initial rate of reduction The capacity to conduct the current in the opposite way will likewise be lost after a brief period of time when the current is stopped
- Breakdown zone: when VD < -VBR, VBR is breakdown voltage, diode is destroyed
STM32CubeMX
STM32CubeMX, a part of the STM32Cube software ecosystem, is an all-in-one multi-
OS development tool, according to [13]
STM32CubeMX integrates STM32 configuration and project creation functionality from STM32CubeMX to offer an all-in-one tool experience and streamline installation and development time Initialization code is generated and the project is built after choosing a pre-configured microcontroller or microprocessor from a board or example, or an empty STM32 MCU or MPU By returning to the peripheral or middleware initialization and setup, the user can renew the initialization code at any time during development without affecting the user code
The build and stack analyzers that come with STM32CubeMX give users helpful information regarding memory requirements and project status Along with conventional and sophisticated debugging facilities, STM32CubeMX also has a live variable watch, a fault analyzer, and interfaces for Serial Wire Viewer and Memory and CPU core register views
After starting the software, the initial interface of the software is as follows:
32 Figure 2.34: Initial startup window of STM32CubeMX
Choose ACCESS TO MCU SELECTOR
Figure 2.35: Choose type of microcontroller STM32
Ex: STM32F103C8T6 Choose Start project
Enter the microcontroller name in the Commercial Part Number box, select STM32F103C8T6 and click Next to jumping to naming step After naming the Project, click Finish to complete the STM32 board selection process and start the programming process
33 Figure 2.36: STM32CubeMX select output Select System Core >> GPIO, PC13 output
Figure 2.37: Select pulse clock Select Crytal/Ceramic resonator
Figure 2.38: Project manager Setup project manager:
Set the name: Ex: LEDBlink
Select toolchain/IDE: MDK-ARM
Figure 2.39: Generate code Generate Code
Select the parameters Prescaler (PSC), and Counter Period (ARR) - the maximum value of the counter to obtain the desired PWM frequency In this project, the PWM frequency is 100KHz and the frequency is calculated following the below formula:
With 𝐹 𝑐𝑙𝑐𝑘 is timer clock, we choose the value 72 𝑀𝐻𝑧
Then, we choose PSC = 0 and ARR = 719
Figure 2.40: PWM generation mode at PA0 STM32F103 supports 2 PWM modes as follows:
- Mode 1: If using the count-up mode, the output will be at logic 1 when CNT <
CCR and vice versa, at 0 if CNT > CCR
- Mode 2: If counting up mode is used, the output will be at logic 0 when CNT
CCR
After selecting the mode for the control pins, we configure the processing time and frequency of the microcontroller
Figure 2.41: Clock Configuration Finish setting up the pins and related parameters, click Project > Generate Code, or use Alt + K shortcut to open the programming workspace, built into STM32CubeIDE
The result after operating on STM32CUBE MX software will give us a project including files STM32CUBE MX will default to KEIL opening these files
The programming code will be in “while (1) {}”
Figure 2.43: Order of setting up for loading configuration Select the Option for Target icon >> Debug >> ST-Link Debugger
37 Select Settings, the following table will display:
If the charging circuit is plugged into the computer, the charging circuit name ST- LINK/V2 will be displayed
Build and download card STM32F103C8:
On the board, hit the Reset button, then the Load button, finally the Reset button release
To view the results of the LED flashing on pin PC13, press the Reset button on the board
SYSTEM DESIGN OF RESOLVER & H-BRIDGE CIRCUIT
STM32CubeMX setup
Figure 3.1: Setup GPIO for STM32
PA0, PA1, PA2, PA3, PA6, PA7 are pins that output pulse signals after comparing with reference values A0-A5
Pin PA5 is the pin that receives the signal to interrupt, specifically here pin PA5 will perform the interrupt on the falling edge Set Pull Up so that pin PA5 has a pull-up resistor to a high level, then pin PA5 will have a high-level signal When receiving an interrupt signal from the outside, the PA5 signal will fall from high to low, the microcontroller receiving this signal will perform an interrupt If the setup is pull down, there is a pull-down resistor Whenever the microcontroller performs an interrupt, it will take one cycle of the external interrupt pulse to read the signal That's why we choose pull ups
39 Figure 3.2: Setup NVIC for STM32
Set up ADC1 for pins PB4 and PB0 with Sampling Time of 13.5 Cycles and 28.5 Cycles respectively PB4 pin is the ADC reading pin of the throttle signal when changing to increase or decrease engine speed PB0 pin is the pin that reads the ADC signal of the Sine coil when the Rotor rotates
Set up ADC1 for pins PB1 with Sampling Time of 28.5 Cycles PB1 pin is the pin that reads the ADC signal of the Cosine coil when the Rotor rotates.
System description
The system operates with a 12V DC input from a lithium-ion battery, regulated to 5V DC by an IC LM7805 for the microcontroller The microcontroller generates PWM signals to an IC IR2103, which controls MOSFET pairs based on high/low level detection The same source provides voltage to a transformer, which is filtered by capacitors and sent to an excitation coil and half-wave rectifier This creates a digital signal that the microcontroller reads to calculate the sine/cosine value and displays the arctan and rotor angle on an LCD screen.
Supply 12V voltage source to voltage regulator IC LM7805 to create 5V voltage source for IC OP AMP 358P In the Sine/Cosine collector circuit of the schematic resolver, use the 1k and 10k resistor values along with the reference voltage source from the voltage divider bridge with a value of 1V on the V+ pin of the IC OP AMP 358P to output amplification value voltage is 1.64V (this voltage level is within the range that the STM32 F103C8T6 can read the ADC) Use additional capacitors with a value of 10 àF
41 at the outputs of IC LM358P and LM7805 to filter noise from the STM32F103C8T6 input source and LM358P input source in sequence
Figure 3.5: System Simulation on PROTUES
Figure 3.6: Simulation Half wave rectifier circuit
42 All you need for a half-wave rectifier is a load resistor connected in series with a p-n junction diode The load resistance RL, a p-n junction diode, and the primary and secondary windings of the transformer make up the half-wave rectifier circuit Direct current voltage is produced from alternating current voltage using half-wave rectifiers Just one diode is needed for transformation in a halfwave rectifier circuit A rectifier that only lets half of an alternating current voltage waveform pass through while blocking the other half is known as a halfwave rectifier
The diode conducts current through the load resistor when it is forward-biased during the positive half-cycle of the AC input The diode is reverse-biased, which prevents current flow, during the AC input's negative half-cycle As a result, the output waveform only includes the AC input's positive half-cycle
The load resistor experiences forward current flow when the diode conducts during the positive half-cycle of the AC input voltage The diode functions as a closed switch since it has less resistance in this direction
When the AC input voltage is at its negative half-cycle, the diode gets reverse-biased and stops conducting During this period, no current passes through the load resistor
Consequently, only the positive half-cycles of the input voltage are present in the output voltage across the load resistor, which is a pulsing DC voltage
A capacitor filter can be used to smooth the output voltage, reducing pulsations and producing a more steady DC voltage
A half wave rectifier's output voltage is equal to half the input AC voltage's peak voltage less the diode's forward voltage drop
Figure 3.7: Input and output waveform [6]
And then thanks to the transistor constantly switching on and off, there is a continuous change in voltage The high voltage signal (3.2V) and low voltage signal (0V) are then
43 obtained as digital pulses so that the microcontroller can interrupt (is shown in figure 3.8 below)
Figure 3.8: Pusle before/after rectifier
The image shows the yellow pulse, which is the pulse before going through half-wave rectification with a transistor, which is still a sine pulse
After going through the rectifier circuit with the switching ability of the transistor, the output pulse received is a digital pulse (which is blue one)
Figure 3.9: Half-wave rectifier soldered circuit Connected to a transformer and a cement resistor with parameters 10W 10ΩJ
3.2.2 Schematic resolver sine/cosine receiver circuit
Uses of IC LM358P: used to amplify signals Apply 2 voltage values into the 2 pairs of pins V+ and V- respectively If the value “V+” > “V-”, the output signal will be amplified without phase reversal and vice versa If the value of “V+” < “V-”, the signal will be amplified output will be amplified but phase inverted
Apply a voltage value of Vref = 1V to the two “V+” pins of IC LM358P, which are pin
3 and pin 5 When the motor rotor rotates, the voltage level on the variable sin/cos coil will in turn be applied to the 2 V- pins are pin 2 and pin 6 of IC LM358P From there,
IC LM358P will compare the voltage difference between pins “V+” and “V-” to provide an appropriate amplifier voltage level within the range that the STM32 microcontroller can read (1.65V - 3.3V)
Figure 3.10: Schematic resolver sine/cosine receiver circuit
In Figure 3.11, we use a 12V "honeycomb shape" source to power two two-coil Sine/Cosine signal amplifier circuits and the STM32 microcontroller through the LM7805 voltage regulator IC Additionally, a 16x2 LCD display to output the Theta angle results will be returned each time the rotor rotates to any position during one of its cycles
45 Figure 3.11: Schematic resolver sine/cosine receiver soldered circuit
Figure 3.11 depicts the actual circuit designed based on the simulated circuit built on Proteus in Figure 3.10
And we also calculated the design of a PCB printed circuit using the Proteus application shown in the Figure 3.12 and printed the finished product shown in the Figure 3.13
Figure 3.12 depicts a simulation Printed Circuit Board (PCB), while Figure 3.13 showcases the actual PCB of the system The light green lines in Figure 3.12 represent the locations for electronic components, while the blue lines indicate the power lines situated on the underside of the circuit.
The H-Bridge circuit is designed with the sequential opening and closing of two pairs of MOSFETS to control the rotor At the same time, increase the frequency of the excitation coil to 100Hz
When pin pair A0 and A1 are high, pin "HO" of IR2103(1) will let MOSFET HIGH 1 conduct and MOSFET LOW 1 turn off At the same time, pin pair A2 and A3 will be low, at this time pin pair “LO” IR2103(2) will supply MOSFET “LOW 2” to conduct and disconnect MOSFET HIGH 2 and vice versa with the order of low and high levels changing respectively on the two pairs of pins above
To reverse the voltage in the primary coil, the pin pairs A0-A1 and A2-A3 alternate between high and low levels This alternation enables the conduction and disconnection of the MOSFET pairs in the sequences "HIGH 1 - LOW 2" and "HIGH 2 - LOW 1."
The alternating voltage after passing through the 1:1 inductor will pass through the capacitor, coil and condenser in turn to filter noise before being fed into the motor's excitation coil
Figure 3.14: H-Bridge designed in Proteus
Use a power source from a lithium-ion battery connected in series (about 16.8V) through IC LM2596 to lower the output voltage to 12V DC to provide power to the LM7805 to create a 5V DC voltage stabilizer to supply for the STM32F103C8T6 microcontroller and two IR2103 ICs
The output of the corresponding MOSFET pairs will be connected to a 1:1 ratio transformer with the power source entering the primary coil being a 12V AC source (due to the MOSFET pairs continuously conducting and interrupting)
The output of the transformer will pass through a set of capacitors, an inductor and finally 2 non-polar capacitors to filter noise before being inserted into the motor's excitation coil
EXPERIMENT RESULTS AND DISCUSSION
Control signals
First, figure 4.2 shows that the yellow signal is the signal of the Sine coil before being send to the amplifier
Figure 4.2: Output Sine signal before amplifier
Figure 4.3 depicts the amplified section of the sine wave post-processing through IC LM358P This amplified signal falls within the 0.6V - 2.1V range, ensuring compatibility with the STM32F103C8T6 microcontroller's ADC for accurate data acquisition.
Figure 4.3 illustrates the output sine/cosine signal after amplification Figure 4.4 highlights the signal component of the excitation coil after rectification using a half-wave rectifier, enabling the conversion of the sine wave signal to a digital signal for ease of processing.
50 external interrupt of the microcontroller STM32 controller with interrupt read at rising or falling edge position)
Figure 4.4: Output signal sine/cosine with excitation signal after half-wave rectifier
Figure 4.5: Signal of excitation coil without H-Brigde circuit with MOSSFET
51 Figure 4.6: Signal of excitation coil after applying H-Brigde with MOSFET
Figure 4.5 depicts the pulse width of the Excitation coil when using a 220V power source with a frequency of 50Hz, followed by Figure 4.6 determining the optimal alternative pulse width after being applied with an H-bridge circuit, with a frequency is increased in 1 cycle for the purpose of obtaining more Theta value angle with a larger number of external interrupts by the STM32.
Tested rotation period of rotor and displays the Theta angle to LCD
Figure 4.7: First position of rotor engine (0 0 ) Figure 4.8: Result testing of first position
This is the first position of the rotation period At this point the tan Theta value sinTheta/cosTheta = 0
From there we can deduce the angle Theta = arctan(tanTheta) = 0 0 (As the value displayed on the LCD screen below
52 The images below show the rotor's rotation from the starting point (0 0 ) to the end of the first magnetic section corner
Figure 4.9: Rotor at position 45 0 Figure 4.10: LCD screen value of rotor at position 44-45 0
Figure 4.11: Rotor at position 89 0 Figure 4.12: LCD screen value of rotor at position 89 0
In quadrant 3, tan Theta assumes the same values as in quadrant 1 due to their opposing angle relationship Despite the negative sine and cosine values in quadrant 3, tan Theta remains positive as a result of these opposite angles.
53 Figure 4.13: Rotor at position 180 0 Figure 4.14: LCD screen value of rotor at position 180 0 Table 4.1: Sine/Cosine values in quadrants and corresponding Theta angle values
Position Sine Cosine Sine/Cosine Theta
This is a table of voltage data from the two SINE/COSINE coils and the corresponding tanTheta and Theta angle values when when rotating the rotor in the 1 st and 3 rd quadrants
The angle value does not change greater than 90 degrees because the voltage level of the two Sine/Cosine coils is limited to approx The Theta angle value is repeated because the 1st and 3rd quadrants as well as the 2 nd and 4 th quadrants are pairs of quadrants that are opposite each other.
CONCLUSION AND RECOMMENDATION
Conclusion
During the period of implementing the project of designing analyzing position sensor for control PMSM, our group has implemented and completed the following contents:
Learning about the specifications of IC OP-AMP LM358 and its operating principle and calculation formula From there, determine the objectives, research objects, and delineate the research scope and development direction of the topic
Learn how to create a half-wave rectifier circuit to output a digital pulse signal
Searching the documentation and learning the influence and parameters of electronic components such as MOSFET 20N60, MOSFET 10N60C and IR2103 Based on those documents to conduct H-Bridge circuit creation and testing increasing frequency of output voltage
To program the STM32 microcontroller, it is crucial to understand the programming and compilation environment of STM32CubeMX and Keil C software This knowledge enables the reading of analog-to-digital converter (ADC) values, interrupting pulses to capture signals, and calculating the motor rotor's position Additionally, proficiency in drawing electrical circuits accurately and soldering circuit components is essential for successful hardware implementation.
Experimenting with wiring and electronic components while making actual circuits and correcting errors after failures to achieve results that approximate the original purpose
In the process of implementing the project, although our group has output the amplifier circuit sine/cosine from the range about [-100mV – 100mV] to [0.8V - 2.1V], there are still many shortcomings that need to be overcome However, the actual results in the working process have not yet been completely achieved, we are still limited in programming knowledge because we cannot display the position of the rotor in the 2nd and 4th quadrants (because these are quadrants with negative tan theta values) Therefore, the subject should be improved performance
In terms of operation, the amplifier circuit stability work Specifically, the amplifier voltage is always at a range where the microcontroller can read the ADC
During the ADC reading process, noise is introduced into the system due to voltage drop when connecting an oscilloscope to the output pins of the amplifier and rectifier circuits This noise can lead to errors in the ADC readings, resulting in incomplete display of the Theta angle on the LCD.
59 The next direction is to calculate more accurately and optimize the stability of the output signal, improving the ADC signal reading of the two Sine/Cosine coils in the negative quadrants Specifically, when passing through the first quadrant, the Sine signal will reverse phase and will be followed by a phase reversal of the Cosine when passing through the end of the second quadrant Pay attention to the phase reversal of the signal both signals, thereby solving the problem of phase inversion and bringing their peaks to the falling edge, helping to achieve the falling edge interrupt process to read the ADC of STM32 with 2 Sine and Cosine coils
Electric vehicles (EVs) face service issues in Vietnam, according to Nguyen and Nguyen's study at the Electromobility Challenging Issues Conference Vogel's book, "Build Your Own Electric Motorcycle," provides technical guidance for EV enthusiasts.
[2] Nguyễn, K M., “Đặc điểm và triển vọng của xe điện trên thị trường ô tô Việt Nam”, Chuỗi hội thảo IOP: Khoa học và Kỹ thuật Vật liệu, Nhà xuất bản IOP, 2020, 012007 [3] STMicrolectronics, “an5161-signal conditioning for resolver” Rev 1, May 2018 [4] STMicroelectronics, “LM358P/1620/1/LM358P,”.html
[5] I Rectifier, "IR2103PBF Datasheet," International Rectifier, 2013
[6] F S Corporation, "LM7805 - Datasheet," Fairchild Semiconductor Corporation, 2001 [7] G.Image, Internet
[8] Arduinokit, Giao tiếp I2C-LCD arduino [Online] Available: Last access November 12,2023, https://arduinokit.vn/giao-tiep-i2c-lcdarduino/
[9] W contributors, "Diode," Wikipedia, The Free Encyclopedia., 28 May 2023 [Online].Available: https://en.wikipedia.org/w/index.php?title=Diode&oldid57378806
[10] J Grover, "Diodes: Types, Symbol, Characteristics and Applications," Collegedunia, [Online] Available: https://collegedunia.com/exams/diodes-physics- articleid-751
[11] Byju’s, Half-wave rectifier, 2023 [Online] Available: https://byjus.com/physics/half-waverectifier/
[12] Prepbyte, half-wave rectifier, Updated April 11 2023 [Online]
Available: https://www.prepbytes.com/blog/digital-electronics/half-wave-rectifier- and-working
[13] L.T.Phúc, “Mô tả thiết kế mạch điều khiển động cơ không đồng bộ 3 pha – Version 1.0 – Tháng 8 năm 2023”
[14] N L K Duy, "TÍNH TOÁN, THIẾT KẾ BỘ TẠO TẢI ĐO CÔNG SUẤT ĐỘNG
CƠ ĐIỆN DÙNG TRÊN XE ĐIỆN," 2023
[15] MOSFET 20N60, datasheet, Retrieved From Electric Component Datasheet Search https://www.alldatasheet.com/datasheet-pdf/pdf/453945/UTC/20N60.html
61 [16] STMicrolectronics, “ LM358P/3245/LM358P,” Retrieved https://html.alldatasheet.com/html- pdf/22771/STMICROELECTRONICS/LM358P/3245/2/LM358P.html
[17] Đặng Văn Thành, “Giáo trình kỹ thuật điện,” NXB Đại học Quốc gia Tp HCM,
- [1] J F Gieras and M Wing, Permanent Magnet Motor Technology (Design and Application) Marcel Dekker, Inc, second edition, revised and expanded ed., 2002.- [5] Ehsan Afshari, Gholam Reza Moradi, Alireza Ramyar, Ramin Rahimi, Reactive power generation for single-phase transformerless Vehicle-to-Grid inverters: A review and new solutions, July 2017
[20] Le Thanh Phuc, Dinh Cao Tri (2022) Applying sine PWM Technique to Control Three-phase Induction Motor in Electric Motorcycles 6th International Conference on Green Technology and Sustainable Development (GTSD)
[21] 2010 Toyota Prius L4-1.8L (2ZR-FXE) Hybrid (2022, 1 4)
Code for schematic resolver SIN/COS receiver circuit
/* Private includes -*/ /* USER CODE BEGIN Includes */
/* USER CODE BEGIN PV */ volatile int sinTheta = 0; volatile int cosTheta = 0 ; volatile int tayGa = 0; char temp1[4]; char temp2[4]; volatile double theta; double val = 180.0/pi; volatile double theta1;
/* Private function prototypes -*/ void SystemClock_Config(void); static void MX_GPIO_Init(void); static void MX_ADC1_Init(void); static void MX_I2C1_Init(void); static void MX_ADC2_Init(void);
/* USER CODE BEGIN PFP */ void hienthi(double theta)
{ int n, m; char temp1 [4]; char temp2 [4]; theta = theta*100; n = (int)theta/100; m = (int)theta%100; lcd_put_cur(1,0); lcd_send_string("Theta: "); sprintf(temp1,"%d",n); lcd_put_cur(1,7); lcd_send_string(temp1); lcd_put_cur(1,8); lcd_send_string("."); sprintf(temp2,"%d",m); lcd_put_cur(1,9); lcd_send_string(temp2); lcd_put_cur(1,12); lcd_send_string("rad");
} void ADC_Select_CH4 (void)
ADC_ChannelConfTypeDef sConfig = {0}; sConfig.Channel = ADC_CHANNEL_4; sConfig.Rank = ADC_REGULAR_RANK_1; sConfig.SamplingTime = ADC_SAMPLETIME_13CYCLES_5; if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK) {
} void ADC_Select_CH8 (void)
ADC_ChannelConfTypeDef sConfig = {0}; sConfig.Channel = ADC_CHANNEL_8; sConfig.Rank = ADC_REGULAR_RANK_2; sConfig.SamplingTime = ADC_SAMPLETIME_28CYCLES_5; if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK) {
} void ADC_Select_CH9 (void)
ADC_ChannelConfTypeDef sConfig = {0}; sConfig.Channel = ADC_CHANNEL_9; sConfig.Rank = ADC_REGULAR_RANK_1; sConfig.SamplingTime = ADC_SAMPLETIME_28CYCLES_5; if (HAL_ADC_ConfigChannel(&hadc2, &sConfig) != HAL_OK) {
* @brief The application entry point
MX_ADC2_Init(); lcd_init();
64 int ADC_Sensor; double A0 = -0.1; double A1 = 0.57; double A2 = 1.72; double A3 = 8; double A4 = -1.72; double A5 = -0.57; double B1 = 0.57; double B2 = 1.72; double B3 = 8; double B4 = -3.5; double B5 = -1.78;
RCC->APB2ENR |= 0x10; /// Or 0b10000 > Anabling Preiph GPIOC GPIOC->CRH &= 0xFF0FFFFF; /// Reset the PORT C PIN 13
GPIOC->CRH |= 0x00300000; /// Set Port C PIN 13 as Output
GPIOC->ODR |= 0x2000; /// Set Port C Pin 13 while (1)
To calculate the angle theta, the sine and cosine of Ab are computed and stored as `sinAb` and `cosAb`, respectively These values are then converted to double precision (`sinAb1` and `cosAb1`) for further calculations The tangent of theta is obtained by dividing `sinAb1` by `cosAb1` Using the `atan` function, the angle theta is calculated from the tangent, and its value is stored in `theta1` The LCD screen is cleared, and the angle theta1 is displayed The LCD cursor is positioned at the top left, and the string "Theta: " is printed The angle theta is converted to an integer and displayed in degrees using the string temp1.
//xuat tin hieu dien ap Sine/Cosine
The HAL_GPIO_WritePin function is used to write the specified value to the specified GPIO pin on GPIO Port A In this case, the pin is reset for GPIO_PIN_0 and GPIO_PIN_3, and set for GPIO_PIN_1, GPIO_PIN_6, GPIO_PIN_2, and GPIO_PIN_7.
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_0, GPIO_PIN_RESET); HAL_GPIO_WritePin(GPIOA, GPIO_PIN_3, GPIO_PIN_RESET); HAL_GPIO_WritePin(GPIOA, GPIO_PIN_1, GPIO_PIN_RESET); HAL_GPIO_WritePin(GPIOA, GPIO_PIN_6, GPIO_PIN_RESET); HAL_GPIO_WritePin(GPIOA, GPIO_PIN_2, GPIO_PIN_SET); HAL_GPIO_WritePin(GPIOA, GPIO_PIN_7, GPIO_PIN_SET);
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_0, GPIO_PIN_SET); HAL_GPIO_WritePin(GPIOA, GPIO_PIN_3, GPIO_PIN_SET); HAL_GPIO_WritePin(GPIOA, GPIO_PIN_1, GPIO_PIN_RESET); HAL_GPIO_WritePin(GPIOA, GPIO_PIN_6, GPIO_PIN_RESET); HAL_GPIO_WritePin(GPIOA, GPIO_PIN_2, GPIO_PIN_SET); HAL_GPIO_WritePin(GPIOA, GPIO_PIN_7, GPIO_PIN_SET);