AN1307 FULL STEP MODE PHASE VOLTAGE AND PHASE CURRENT MICROSTEPPING WITH 1/4 STEP SIZE
|
|
|
- Baldwin Kelly
- 9 years ago
- Views:
Transcription
1 Stepper Motor Control with dspic DSCs AN1307 Author: INTRODUCTION Sorin Manea Microchip Technology Inc. This application note describes how to drive a stepper motor with a dspic33f motor control family DSC. The eight PWM channels (six pins from the PWM1 module and two pins from the PWM2 module) are used to control a stepper motor in all possible ways, whether it is bipolar or unipolar, using full step or microstepping, open or closed loop, without the need for external jumpers or complicated logic circuitry. The dspicdem MCSM Development Board Kit (DV330022) was used in this application note. This kit includes the dspicdem MCSM Development Board, Stepper Motor, Power Supply, and Plug-in Module (PIM). The hardware topology is very simple, consisting of just the dspic DSC, the drivers and two H- bridges. Each MOSFET in the dual H-bridge is controlled by one PWM signal. The powerful PWM module of the dspic DSC features independent or complementary control over each of the four PWM pairs, plus an additional override function on each pin, which gives even more control over the power MOSFETs. FIGURE 1: 3.3V S1 POT The dspic DSC is used to achieve high-speed microstepping in closed loop current control. For this task, voltages higher than the motor rated voltage are needed to force the current quickly through the motor windings. These high voltages require a high PWM frequency with a synchronized ADC for fast and accurate current control. Fast timers and high processing power are also needed since one microstep can be as short as one PWM period. The dspicdem MCSM Development Board was designed to work with drive voltages of up to 80V and therefore accommodate a wide range of stepper motors and driving algorithms. Since high voltages are used relative to the stepper motor rated voltage, a very fast reacting controller is needed. A PWM frequency of 40 khz was chosen to have the smallest possible reaction time. For example, having a stepper motor with 2.3 ohm and 4 mh per phase driven at 80V, the current needs just 70 microseconds to reach the rated level of 1.4A. This is under three PWM periods with 100% duty cycle. At 24V, 10 PWM periods (250 microseconds) are needed to reach 1.4A. dspicdem MCSM DEVELOPMENT BOARD BLOCK DIAGRAM Regulator 3.3V dspic33fjxxxmcxxx PIM 24VDC J6 PWM1H1 PWM1L1 PWM1H2 PWM1L2 PWM1H3 PWM1L3 PWM2H1 PWM2L1 IMOTOR1 Regulator 15V rs BP1 BP2 J5 J7 M1 M2 M3 M4 J8 M1 M2 M3 M4 M Amplifier J1/J2 ICD2 IMOTOR2 J4 USB UART to USB FAULT Comparator Amplifier Safe Current Level 2009 Microchip Technology Inc. DS01307A-page 1
2 OVERVIEW OF CONTROL TOPOLOGIES This application note discusses several operating modes for stepper motor control. The following is a summary of the control methodology used in this application note, which can be selected using simple defines in the code or in real time through DMCI: Open Loop Fixed Voltage Open Loop Fixed Current Closed Loop Current Control Each of these methods can be operated with a different granularity of voltage steps fed to the motor windings. The different granularity options available in this application note are: Full Step Mode (1/1 Step) Half Step Mode (1/2 Step) Microstepping: - 1/4 Step - 1/8 Step - 1/16 Step - 1/32 Step - 1/64 Step Different decay modes are also implemented in this application note, which can also be combined with any control method and with any number of steps (full, half or microstepping). The available decay modes are: Fixed Mode, which is configurable to either slow or fast decay Alternating, which combines both slow and fast decay modes are described in detail in upcoming sections of this application note. FULL STEP, HALF STEP AND MICROSTEP In applications where high positional accuracy and low vibrations and noise are needed, the ideal waveform for driving a stepper motor winding is a sine wave. A two-phase stepper motor is driven by two sine waves shifted 90 degrees apart driving each of the motor windings. All stepping modes are derived from the sinusoidal mode by adjusting the granularity of the driving sine wave. A full step is the largest step and it consists of 90 degrees of one sine wave period. A half step represents half of that and so on. Microstepping is used to increase the rotor position resolution and to reduce vibration and noise in motor operation. With typical motors, a microstepping value of 1/32 is more than enough to achieve the best performance. Going over this point will not usually bring significant improvements to positional accuracy, although running noise may decrease. The motor inductance and drive voltage play a key role here. Lowering the motor inductance value or increasing the drive voltage will give a better resolution to smaller microsteps. A microstep table consisting of desired current or voltage levels is generated starting from a cosine, as shown in Figure 2. The x-axis is divided into evenly spaced intervals based on the desired microstep size. This application note uses a resolution of 1/64 microsteps, thus resulting in a number of 256 points per period. However, in the software implementation, one cosine period is divided into 1024 points. This allows the microstep resolution to be easily increased up to 1/256 if needed. The values of the cosine at each of these time intervals is stored in a look-up table that will later be used to reconstruct the original cosine at any desired resolution. The properties of the cosine function allows us to store only the first quadrant of the function in the look-up table (256 values, one-fourth of a period), while the other three quadrants are reconstructed from this first one. FIGURE 2: MICROSTEP GENERATION Quarter Step Half Step Full Step Wave Full Step Two-Phase ON ¼ ½ ¼ ¼ ½ ¼ ½ ½ DS01307A-page Microchip Technology Inc.
3 The values represented in the microstep table represent different things depending on the operating control mode. If the control mode is open loop voltage control, then this table represents desired voltages to be applied to each winding. If the operating mode is closed loop current control, the values in the microstep table represent current references. In both cases, the table is scaled with the maximum allowed voltage or current, as appropriate. Figure 3 shows the voltage and current waveforms for full step generation in closed loop current control. The squared line represents the voltage command. The larger signal represents the current for the commanded voltage. In Figure 4 microstepping is shown. Notice how the reference voltage has greater granularity than in Figure 3. This is because a 1/4 microstepping is used. FIGURE 3: FULL STEP MODE PHASE VOLTAGE AND PHASE CURRENT FIGURE 4: MICROSTEPPING WITH 1/4 STEP SIZE 2009 Microchip Technology Inc. DS01307A-page 3
4 Users can change microstep granularity by changing the value of the stepsize variable. The value of this variable can range from 0 to 6, which represents the granularity detailed in Table 1. TABLE 1: stepsize value STEP MODES Step Mode Total of Steps Per Cycle 0 Full Step 4 1 Half Step 8 2 1/4 Step /8 Step /16 Step /32 Step /64 Step 256 Note that when the value of stepsize increases, the number of microsteps also increases. When operating in Full Step mode (stepsize = 0), two options are available to drive the motor controlled by using the variable fullstepmode: FULLSTEP_WAVE_DRIVE: With this mode, only one phase is ON at any moment in time. This mode is enabled when the variable fullstepmode is FULLSTEP_WAVE_DRIVE FULLSTEP_TWO_PHASE_ON: With this mode, two phases are always ON, but the polarity changes every two steps. This mode is enabled when the variable fullstepmode is FULLSTEP_TWO_PHASE_ON FIGURE 5: WAVE DRIVE MODE CURRENTS FIGURE 6: TWO-PHASE ON MODE CURRENTS DS01307A-page Microchip Technology Inc.
5 OPEN LOOP CONTROL METHODS There are two open loop control methods implemented in this application note. One is fixed voltage control, which is an open loop control and does not adjust PWM duty cycles according to feedback. The second control method is fixed current control. In this method, the duty cycle is corrected every four full steps (one sine wave period) in order to reach a desired current amplitude set point. Both methods are described in the following two sections. Fixed Voltage Control In classic voltage control, the rated motor voltage is applied to the windings. When a higher power supply is used, such as 24V, the motor rated voltage is achieved with the use of a chopper, which is implemented with the Pulse Width Modulation (PWM) module. Stepper motors are designed to run reliably at the rated current, as instructed by the manufacturer. The rated motor voltage is based on that current and the winding resistance. However, the voltage across the motor can be higher than that, as long as the current is kept at all times at the rated value or lower. As shown in Figure 1, the motor is connected to two H-bridges powered at 24V and driven by PWM signals. By carefully choosing the PWM duty cycle, the appropriate average voltage for driving the motor at the rated current is generated, as shown in Figure 7. FIGURE 7: MOTOR CURRENT AND PWM 2009 Microchip Technology Inc. DS01307A-page 5
6 This application note implements fixed voltage control by generating the desired voltage levels with the appropriate PWM duty cycles. Microstepping operation applies to open loop voltage control as well. If a particular application requires very low noise operation, open loop voltage control with microstepping would be the best choice. Figure 8 shows the practical results of open loop voltage control. As shown by the red line in the graph, the current increases depending on the voltage magnitude; however, since there is no current control, the shape is not perfect. As shown in the figure, there are 8 steps per revolution in Half Step mode. The flag, ugf.controlmode, is used for control method selection. If this flag has the value of FIXED_VOLTAGE, the control method selected is fixed voltage. Fixed Current Control When using fixed voltage control, the motor is driven with the rated voltage, which allows the current to rise from zero to the rated current value in a fixed amount of time. At a certain motor speed, which depends on the motor inductance and the drive voltage, the current will not rise fast enough through the motor coil to reach the rated motor current and torque will be lost. This presents a problem when higher speeds are required by the system. As the motor speeds up, the step time is getting smaller and the current amplitude is falling more and more, until the rotor eventually stalls. To overcome this problem, the easiest solution is to increase the drive voltage as the motor speeds up in order to have a maximum current amplitude equal to the rated motor current and extend the maximum torque versus speed range. Figure 9 shows the voltage and current for fixed voltage control. The voltage level is low and the measured current is rising slowly until the voltage drops. The desired level is far away and the motor torque is low. FIGURE 8: OPEN LOOP VOLTAGE CONTROL WITH HALF STEP Note: The voltage reference is scaled to make it visible. FIGURE 9: FIXED VOLTAGE CONTROL AT 120 RPM WITH ALTERNATE DECAY Note: The voltage reference is scaled to make it visible. DS01307A-page Microchip Technology Inc.
7 Figure 10, on the other hand, shows how the current amplitude is controlled to a higher value by applying a higher voltage. Only the current amplitude is controlled in this mode, not the shape or phase. FIGURE 10: FIXED CURRENT CONTROL AT 120 RPM WITH ALTERNATE DECAY Note: The voltage reference is scaled to make it visible. A simple control loop is used for controlling the current amplitude. The maximum amplitude of the current in both motor windings is sampled during one complete sine wave. If the maximum current amplitude is lower than the desired value, the drive voltage is increased gradually by adjusting the PWM duty cycle until the desired current amplitude is reached. If the current is too high the duty cycle is decreased, but not less than the initial value corresponding to the rated motor voltage. As long as the drive voltage is higher than the motor rated voltage, this method provides an extended speed range over the classic open loop approach. Another advantage to using this algorithm is that there is no need to retune for different motors. As long as the starting voltage produces a lower current than desired, the algorithm will increase this voltage until the desired current level amplitude is reached. This control method is selected by assigning FIXED_CURRENT to the ugf.controlmode flag. DECAY MODES When a motor winding is turned OFF by the PWM, such as in a chopping circuit, the current through that winding starts to decay until it reaches zero or until the winding is energized again. The rate at which the current decays depends on the configuration of the H- bridge at that specific moment. The different current decay methods are called decay modes. There are two decay modes discussed in this application note: Fast : This mode is active when the voltage across the de-energized winding is reversed, which produces a fast current drop, hence the name Fast mode Slow : This mode is active when the motor winding is shorted. Current drop is much slower, since there is no voltage applied to the winding These two modes are used in this application note in two different ways: Fixed : Users can select this option where only one of the six decay modes is used by the controller at all times. It is recommended to use one of the slow decay modes in this configuration Alternating : The controller uses two selected decay modes and switches between them at the appropriate time Fast In Fast mode, when the current is flowing through a motor s winding and all MOSFETs are switched off, the voltage on that winding will be equal to the negative of the supply voltage plus the drop voltage on two freewheeling diodes, as shown in Figure 11. The decay rate can be adjusted slightly by shorting one or two diodes in the circuit with their corresponding MOSFETs. However, the reverse voltage applied to the coil will not change significantly since the voltage drop across a diode (1V) is much smaller than the supply voltage (24V). Still, the advantage of using this method is that the decaying current is flowing through the MOSFET body diodes only briefly, until the MOSFET turns ON. The MOSFET has a lower ONresistance and thus, the dissipated power will be much lower, which presents an advantage to the overall system power dissipation. Another advantage of Fast mode is the simplicity of the current feedback circuit, since motor current can be read from the simple shunt resistor at all times. When the winding is driven, the current is positive. While the current is dropping during Fast mode, the current will be negative since the voltage is reversed across the winding. Therefore, current is available on the shunt resistor at all times Microchip Technology Inc. DS01307A-page 7
8 FIGURE 11: FAST DECAY CURRENT FLOW FIGURE 13: FAST DECAY (REVERSE) CURRENT FLOW FIGURE 12: FAST DECAY PWM TIMING DIAGRAM FIGURE 14: FAST DECAY (REVERSE) PWM TIMING DIAGRAM PWM1H1 PWM1L1 PWM1H2 PWM1L2 PWM1H1 PWM1L1 PWM1H2 PWM1L2 TABLE 2: FAST DECAY DRIVE SIGNALS Mosfet Driving Signal Value PWM1H1 PWM PWM1L1 0 PWM1H2 PWM PWM1L2 0 With a slight variation on the drive signals, we have something called Reverse mode. Reverse mode behaves like Fast mode until the current reaches zero, at which point it forces the current in the opposite direction. For short decay times though, until the current reaches zero, this is not an issue. If reverse decay is continued after the current has dropped to zero, then negative current will be generated when a positive current is desired, and vice versa. Reverse decay generates the lowest possible dissipated power in the fast decay configuration. TABLE 3: FAST DECAY (REVERSE) DRIVE SIGNALS Mosfet Driving Signal Value PWM1H1 PWM PWM1L1 PWM PWM1H2 PWM PWM1L2 PWM Fast decay and reverse decay modes can be set in software by changing the initialization value of variable alternate to each of the following defined values shown in Table 4. Fast decay is not recommended as a base decay since the current may drop faster during Fast than it is actually rising when the supply voltage is applied to the winding. TABLE 4: FAST DECAY MODES Variable Name Initialization Value Active Components During base D_FAST Low Side Diode + Opposite High Side Diode alternate D_REVERSE Low Side MOSFET + Opposite High Side MOSFET DS01307A-page Microchip Technology Inc.
9 Slow Slow decay is entered by shorting the motor winding when it is not driven by the supply voltage. This is achieved by keeping one of the drive MOSFETs opened at all times (see the or MOSFETs in Figure 15). The current recirculates through the motor winding, drive MOSFET and the opposite MOSFET or its body diode. If two MOSFETs are ON (lower ones or upper ones) the diodes are shorted allowing less power dissipation and less current drop during slow decay. FIGURE 15: SLOW DECAY LOW SIDE MOSFET CURRENT FLOW FIGURE 16: PWM1H1 PWM1L1 PWM1H2 PWM1L2 TABLE 5: SLOW DECAY LOW SIDE MOSFET PWM TIMING DIAGRAM SLOW DECAY LOW SIDE MOSFET DRIVE SIGNALS Mosfet Driving Signal Value PWM1H1 PWM PWM1L1 PWM PWM1H2 1 PWM1L2 0 Depending on which MOSFET remains ON during decay, there are several slow decay modes that can be selected in the software. The recommended slow decay mode when using a bootstrap is the Low Side MOSFET Recirculation mode. Using this mode helps the bootstrap capacitors used to drive the upper MOSFETs to fully recharge. If the bootstrap capacitors discharge, the upper MOSFETs cannot be turned ON. Appendix B lists all slow decay modes including the current flow path, timing diagrams and drive signals. Table 6 summarizes all slow decay modes. TABLE 6: SLOW DECAY MODES Variable Name Initialization Value Active Components During base D_SLOW_L_DIODE Low Side Diode + Opposite Low Side MOSFET alternate D_SLOW_H_DIODE High Side MOSFET + Opposite High Side Diode D_SLOW_L_MOSFET Low Side MOSFET + Opposite Low Side MOSFET D_SLOW_H_MOSFET High Side MOSFET + Opposite High Side MOSFET 2009 Microchip Technology Inc. DS01307A-page 9
10 Current measurement is not possible in slow decay modes with the shunt resistor circuit used for current sensing. This is because in slow decay modes, current is not flowing through the shunt resistor since it recirculates through the motor and MOSFETs or diodes. Figure 17 shows how the current measurement signal changes when the decay mode changes from slow (low MOSFET recirculation) to fast. This transition from slow to fast happens during the high level of the upper signal. The peaks of the bottom signal represent the shunt resistor current and the peaks match with the ON time of the PWM. The shunt resistor current is positive when the winding is driven, which is during the ON phase of the PWM ( and switches are ON) and negative in Fast mode. The signal in the middle of the plot represents the actual motor current using a current probe. It can be observed that during slow decay (when the top signal is low) the current is zero when the winding is not driven. FIGURE 17: CURRENT SIGNALS FOR FAST AND SLOW DECAY MODES DS01307A-page Microchip Technology Inc.
11 COMBINING DECAY MODES In this application note, there are two ways that the decay modes can be used. The first one is Fixed mode, where the user selects a decay mode (fast, slow, etc.) and that same decay mode will be used all of the time. The second option is alternate decay, where two decay modes are combined while driving the stepper motor. Table 7 shows which flag and which values should be used for any of the two decay operation modes. Fixed As mentioned earlier, in Fixed mode there is only one decay mode used during motor operation. The recommended decay mode is slow decay in the low MOSFET recirculation configuration. Alternate With all of the available decay modes, the question arises of which one to use and when. Slow mode provides quieter motor operation and is good at relative low speeds. As the motor speed increases and the desired current falls on a steep decline, the winding current can no longer follow this curve using Slow mode. Although operation in Fast mode is noisier, it allows greater control of the current descent rate. The two plots in Figure 18 show the difference between Fixed mode, using slow decay, and Alternate mode, using fast and slow decay. In Alternate mode (right plot), fast decay is only used when the current is decreasing and only for a limited time until the current reaches the desired level. The advantage of using the alternate decay mode can be seen at high speeds, where slow decay cannot provide a fast current drop rate as demanded by the switching pattern. Also, the BEMF of the motor prevents the current from decreasing fast enough. Fast decay can be used to bring the current down faster to the desired level. Where fast decay is too aggressive or needs to be used for a very short time, slow decay with diode recirculation can be used for a longer period as it forces the current to decay faster than in the MOSFET recirculation mode. For each step, a different current drop is required, so a smaller or larger ratio of fast to slow decay is needed based on the step amplitude change. If fast decay is not used long enough, the current decreases too slow and does not follow the desired shape. If it is used for too long, the current drops too much and will have to rise back up. This is why the number of fast decay (or alternate decay) periods must be proportional to the current amplitude drop. Since the motor back-emf induces current in the windings, it is recommended to keep the winding in fast decay whenever the desired current level is zero. This is an efficient and fast method of controlling the current to zero. TABLE 7: DECAY MODE COMBINATIONS Flag Value Description ugf.decaymode FIXED_DECAY Only one decay mode is used: base. ALTERNATE_DECAY Alternates between two decay modes: base and alternate. FIGURE 18: COMPARISON BETWEEN FIXED AND ALTERNATE DECAY 2009 Microchip Technology Inc. DS01307A-page 11
12 CURRENT MEASUREMENT Current measurement in the full-bridge configuration brings up some challenges. First of all, the measuring shunt resistor is located between the ground and the low side MOSFETs, which means that no current will be visible unless there is a path opened between and ground. The path can either be one high-side MOSFET plus the opposite low-side MOSFET, or the body diodes of the same MOSFETs when they are turned OFF. When the motor winding is energized, the shunt current will always be positive, regardless of the current direction in the motor winding. Whenever the winding is in fast decay, the shunt current will be negative. In all slow decay modes there is no current flowing through the shunt resistor. Figure 19 shows a typical shunt resistor waveform during motor operation in full step wave drive with fast and slow decay. For simplicity we will assume first that there is no PWM driving the motor and that only DC voltages are applied to the winding. The challenge is to reconstruct the real motor current based on the available measured data from the shunt resistor. As DC voltage is replaced by PWM, the step pattern shown in Figure 19 is reproduced on a much smaller scale, a number of times inside each of those steps, as shown in Figure 20. FIGURE 19: WINDING CURRENT VERSUS SHUNT CURRENT IN DC MODE Fast Fast Slow Slow Motor Current Shunt Resistor Current DS01307A-page Microchip Technology Inc.
13 In the Closed Loop Control mode, the PI controller switches from slow to fast decay often and at small time intervals, as shown in Figure 20 and Figure 21. In this scenario, PWM1H1 and PWM1H2 are driving the winding current in the positive direction. PWM1L1 and PWM1L2 are driving the winding current in the negative direction, but as long as the winding current is positive, this is identical to fast decay. The PWM1H1 and PWM1L2 signals are controlling the high MOSFETs of the H-bridge. Since the slow decay with low MOSFET recirculation mode is used, the PWM1L1 and PWM1H2 signals are complementary to PWM1H1 and PWM1L2, respectively. Whenever PWM1H1 is high, the entire supply DC voltage is applied to the winding and its current is increasing. The shunt resistor only sees this current when the PWM signal is high. When PWM1L2 is high, the same DC voltage is applied to the winding, but in reverse polarity. This puts the winding in Fast mode and forces the shunt resistor current to negative values, but equal in amplitude with the real winding current. When both of these PWMs are low, their complementary PWM pins driving the H bridge low MOSFETs are high; therefore, the winding is in the Slow MOSFET Recirculation mode and no current flows through the shunt resistor. FIGURE 20: SHUNT CURRENT IN CLOSED LOOP CURRENT CONTROL FIGURE 21: RECONSTRUCTION OF WINDING CURRENT FROM ADC READINGS 2009 Microchip Technology Inc. DS01307A-page 13
14 The ADC reads the shunt current twice every PWM cycle, once on the active pulse (PWMxHx is high) and once on the inactive pulse (PWMxLx is high). By properly connecting all of the high amplitude peaks, the real winding current is reconstructed in software. By monitoring in which direction the winding is driven, the reconstructed current variable is only updated at the right time. The current value is updated on the active pulse if the driving direction is positive, and on the inactive pulse when the driving direction is negative. The flag, setdir1hw, holds the driving direction for winding 1. At small duty cycles, the winding current does not have enough time to energize the shunt resistor, filter capacitors and amplification circuits, and therefore, it is not read properly by the ADC. The minimum PWM pulse width that still allows reliable ADC readings is approximately 1.75 µs. At 40 khz PWM frequency, this results in a duty cycle of 7%. All duty cycles below this value are set to 7%. Current levels that normally require lower duty cycles in open loop are still achieved by the PI controller by properly controlling the decay mode. CLOSED LOOP PI CURRENT CONTROL Two Proportional Integral (PI) controllers are used to control the current, one for each of the two motor windings. For the best possible results, a theoretical approach is used that allows easy tuning for any motor configuration. As long as the motor parameters are known, such as resistance, inductance and rated current, setting up the system to run with different motors poses no real challenge in terms of tuning. PI controller Stepper motors have two windings, so two PI controllers are needed, one for each winding. EQUATION 1: MOTOR WINDING EQUATION V u R i di L dt L = Motor resistance R = Motor inductance V = DC voltage i = Instantaneous motor current u = PWM duty cycle percentage EQUATION 3: CONTINUOUS PI CONTROLLER In order to compensate the motor transfer function pole and achieve a zero steady state error, a classic PI controller is chosen. By applying Tustin discretization to Equation 3, the formula shown in Equation 4 is obtained: EQUATION 4: DISCRETE PI CONTROLLER The closed loop transfer function of the entire system is shown in Equation 5. The step response rise time of this system, being a first order system, is approximately three times the time constant. By choosing the desired response time, the value for the continuous controller gain can be calculated. Following Equation 6, the value for the discrete controller gain is found. For the discrete gain, a multiplication factor of 4 is used in order to get more resolution from fixed point calculations by avoiding underflows. EQUATION 5: H PI s L/R s + 1 = K s s = Laplace variable K = Continuous controller gain uz z H z G p 1 z p 2 = = PI z 1 p 1 = L + R T/2 p 2 = L R T/2 T = 25 µs G = K/R = Current error u = Voltage output z = z-transform variable p 1, p 2 = Discrete controller parameters T = Controller sample time G = Controller discrete gain CLOSED LOOP TRANSFER FUNCTION EQUATION 2: i( s) H u( s) M MOTOR TRANSFER FUNCTION V ( s) L s R V R L R s 1 DS01307A-page Microchip Technology Inc.
15 EQUATION 6: DISCRETE GAIN USED IN THE FIXED POINT IMPLEMENTATION R 3 70 s K V G 0 4 K R G 0 = Scaled discrete gain FIGURE 22: CLOSED LOOP CONTROLLER BLOCK DIAGRAM i ref u i H PI H M + In this application, a value of 70 µs was chosen as the desired rise time. The step response of the closed loop system is shown in Figure 23. Since the gain has a high value, the controller is very aggressive. The maximum voltage is limited to the available DC voltage of 24V. We can only measure the correct rise time as set by the PI parameters during the last pulse, where the voltage output is not limited. We can count 6 periods, which at 12.5 µs for one period equals 75 µs, which is very close to the desired time. In all other cases, when the output is limited, the rise time will be longer because higher voltages than would be needed to achieve the set rise time. FIGURE 23: CLOSED LOOP PI CURRENT CONTROL 2009 Microchip Technology Inc. DS01307A-page 15
16 Anti-Windup Limiting the controller output leads to a problem called accumulator wind-up. The output is saturated but the PI integrator accumulator keeps counting and grows until it eventually saturates. When the error is returning from the saturation area, the accumulator value is much higher than normal for that specific error value and, as a result, the system response slows. To prevent this effect, the accumulator also has to be compensated. To do this, another gain is added in Equation 8, which is called the anti-windup gain. The difference between the actual (saturated) output and the accumulator is multiplied with this gain and then subtracted in the next accumulator calculation cycle. EQUATION 7: DISCRETE PI CONTROLLER IMPLEMENTATION acc k + 1 = G 0 p 1 k + 1 G 0 p 2 k + acc k u k + 1 = 24V acc k V acc = Integral accumulator u = Output voltage = Current error p 1, p 2 = Discrete controller parameters acc k, k = Values from previous cycle acc k +1, k + 1 = Values from present cycle EQUATION 8: ANTI-WINDUP PI CONTROLLER acc k + 1 = G 0 P 1 k + 1 G 0 P 2 k + acc k G w acc k u k G w = Anti-windup gain Phase Advance By changing the value of the anti-windup gain, different controller behaviors are achieved. For low speeds, it is good to have a small gain so that the current tracks the reference as precise as possible. At higher speeds, when the voltage is not strong enough to bring the current to the reference value and the fast decay rate is not sufficient to bring the current down in the allocated time frame for one step, the anti-windup gain helps to change the phase of the current, thereby allowing transition to higher speeds, which otherwise could not be reached. Keeping the anti-windup gain low will result in the motor eventually stalling as the speed increases. Figure 24 and Figure 25 are taken with one-fourth microstep resolution at a motor speed of 840 RPM. With a low anti-windup gain, Figure 24 shows that the output voltage and the desired current are in phase. However, because of the high speed at which the motor is running, the winding current is not able to follow the reference. At some point, the current will be rising too late and brake the rotor instead of accelerating it, since the stator poles will be energized too late, after the rotor has passed them. FIGURE 24: 1/4 STEP AT 840 RPM WITH A LOW ANTI-WINDUP GAIN DS01307A-page Microchip Technology Inc.
17 FIGURE 25: 1/4 STEP AT 840 RPM WITH A HIGH ANTI-WINDUP GAIN In Figure 25, The high anti-windup gain forces the controller output voltage to exit saturation sooner and therefore changes the phase of the winding current relative to the desired current. With this phase advance, the current has enough time to rise into the winding before the rotor pole reaches the energized stator pole. Further increasing the speed, the current amplitude keeps dropping until it eventually changes phase forced by the back-emf. At this point, the current amplitude will begin to rise again and the phase advance and motor back-emf work together to keep the motor running, as shown in Figure 26. The motor torque at 2400 RPM is strong enough to operate the motor under a light load. As a comparison, the maximum speed achieved in the open loop control modes with the same motor is around 200 RPM. The current waveform reference plays an important role here. If it is closer to a sine wave, the current will follow it better and the motor will have better torque. At high speeds, it is best to use the smallest possible microsteps, in order to obtain the best motor torque. However, at high speeds, the microstep changing rate becomes faster than the output frequency of 40 khz. The dspic DSC device might also run out of time to execute all of the step changes if they are very fast. For these reasons, a value of approximately 20 µs for one microstep is implemented as the lower limit for one microstep time, regardless of the microstepping resolution used. This means the top speed is higher for low resolution modes, such as full, half or quarter step, and lower for high resolution microstepping. FIGURE 26: 1/4 STEP WITH PHASE ADVANCE 2009 Microchip Technology Inc. DS01307A-page 17
18 POSITION CONTROL Open loop position control is the main reason why stepper motors are used. In combination with the closed loop current control, open loop position control is more accurate and reliable up to considerable speeds. To reach high speeds though, the motor has to be accelerated gradually to prevent the rotor from stalling. Stopping the motor must be done in the same way, so maximum acceleration and deceleration rates for the motor speed are used. A classic Proportional (P) position controller with a variable gain and a maximum speed limit is implemented based on Equation 9. The fixed gain is chosen in such a way that the deceleration rate is slightly smaller that the maximum allowed value. When the desired position is reached, the motor should stop immediately to avoid position oscillations. Since a fixed deceleration rate is imposed to the motor, the position controller must take it into account and begin the deceleration at the right time, before it is too late. A variable gain is used to ensure that the motor starts deceleration at the right point and a fast stop is obtained. Compared with a fixed gain solution, this controller output exits saturation later. CONCLUSION This application note presented three methods to control a stepper motor: Fixed Voltage mode, Fixed Current mode and PI Closed Loop Control mode. A method of generating up to 1024 points per cycle was also implemented in this application note using microstepping. Different decay methods were also presented allowing the controller to operate the stepper in a variety of ways depending on system s requirements. For software implementation, code is available for download from the Microchip website, which is posted on the same web page as this application note. To learn more details about the hardware tool used, refer to the dspicdem MCSM Development Board User s Guide (DS70610). FIGURE 27: POSITION CONTROL WITH VARIABLE GAIN EIGHT MOTOR ROTATIONS ARE PERFORMED AT QUARTER STEP RESOLUTION EQUATION 9: PROPORTIONAL (P) POSITION CONTROLLER WITH VARIABLE GAIN AND MAXIMUM SPEED LIMIT speed Ref = pos Fixed_gain decelerationrate pos Gain pos Err = pos speedout Err speed Ref speed Max DS01307A-page Microchip Technology Inc.
19 APPENDIX A: SOFTWARE FLOW CHARTS FIGURE A-1: MAIN STATE MACHINE Start Peripherals Initialization State = RUN YES Button released NO Process DMCI Commands Timer1 Overflow NO YES YES Cycle through step sizes Call Speed and Position Controllers NO 1/64 step YES State = OFF State = OFF YES Button released NO Process DMCI Commands YES NO State = RUN State = INIT YES Initialize Control Algorithm State = OFF 2009 Microchip Technology Inc. DS01307A-page 19
20 FIGURE A-2: ADC INTERRUPT ADC interrupt NO State = RUN YES PWM counting up NO YES Read Currents Read POT Read Currents Read POT Calculate max current amplitude YES CurrentControl Loop == OFF CurrentControl Loop == OFF YES Process alternate decay for both windings NO NO Set PWM duty cycles Winding1 PI Loop Update decay mode Winding2 PI Loop Update decay mode Set PWM duty cycles Set ADC trigger to PWM counting down Set ADC trigger to PWM counting up Exit DS01307A-page Microchip Technology Inc.
21 FIGURE A-3: TIMER INTERRUPTS Timer2/3 Interrupt Timer1 Interrupt Update Timer Period Set overflow indicator Increment MicroStep Counter Clear IRQ flag SineWave Period Complete YES Reset MicroStep Counter Exit Process Fixed Current Mode NO Calculate Next Step Amplitude Reference Calculate Position Clear IRQ flag Exit 2009 Microchip Technology Inc. DS01307A-page 21
22 APPENDIX B: DECAY MODES FIGURE B-1: FAST DECAY PWM1H1 PWM1L1 PWM1H2 PWM1L2 Mosfet Driving Signal Value PWM1H1 PWM PWM1L1 0 PWM1H2 PWM PWM1L2 0 FIGURE B-2: SLOW DECAY LOW DIODE RECIRCULATION PWM1H1 PWM1L1 PWM1H2 PWM1L2 Mosfet Driving Signal Value PWM1H1 PWM PWM1L1 0 PWM1H2 1 PWM1L2 0 DS01307A-page Microchip Technology Inc.
23 FIGURE B-3: SLOW DECAY HIGH DIODE RECIRCULATION PWM1H1 PWM1L1 PWM1H2 PWM1L2 Mosfet Driving Signal Value PWM1H1 1 PWM1L1 0 PWM1H2 PWM PWM1L2 0 FIGURE B-4: SLOW DECAY LOW MOSFET RECIRCULATION PWM1H1 PWM1L1 PWM1H2 PWM1L2 Mosfet Driving Signal Value PWM1H1 PWM PWM1L1 PWM PWM1H2 1 PWM1L Microchip Technology Inc. DS01307A-page 23
24 FIGURE B-5: SLOW DECAY HIGH MOSFET RECIRCULATION PWM1H1 PWM1L1 PWM1H2 PWM1L2 Mosfet Driving Signal Value PWM1H1 1 PWM1L1 0 PWM1H2 PWM PWM1L2 PWM FIGURE B-6: REVERSE DECAY PWM1H1 PWM1L1 PWM1H2 PWM1L2 Mosfet Driving Signal Value PWM1H1 PWM PWM1L1 PWM PWM1H2 PWM PWM1L2 PWM DS01307A-page Microchip Technology Inc.
25 Note the following details of the code protection feature on Microchip devices: Microchip products meet the specification contained in their particular Microchip Data Sheet. Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the intended manner and under normal conditions. There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip s Data Sheets. Most likely, the person doing so is engaged in theft of intellectual property. Microchip is willing to work with the customer who is concerned about the integrity of their code. Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not mean that we are guaranteeing the product as unbreakable. Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our products. Attempts to break Microchip s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act. Information contained in this publication regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer s risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights. Trademarks The Microchip name and logo, the Microchip logo, dspic, KEELOQ, KEELOQ logo, MPLAB, PIC, PICmicro, PICSTART, rfpic and UNI/O are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. FilterLab, Hampshire, HI-TECH C, Linear Active Thermistor, MXDEV, MXLAB, SEEVAL and The Embedded Control Solutions Company are registered trademarks of Microchip Technology Incorporated in the U.S.A. Analog-for-the-Digital Age, Application Maestro, CodeGuard, dspicdem, dspicdem.net, dspicworks, dsspeak, ECAN, ECONOMONITOR, FanSense, HI-TIDE, In-Circuit Serial Programming, ICSP, Mindi, MiWi, MPASM, MPLAB Certified logo, MPLIB, MPLINK, mtouch, Octopus, Omniscient Code Generation, PICC, PICC-18, PICDEM, PICDEM.net, PICkit, PICtail, PIC 32 logo, REAL ICE, rflab, Select Mode, Total Endurance, TSHARC, UniWinr, WiperLock and ZENA are trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. SQTP is a service mark of Microchip Technology Incorporated in the U.S.A. All other trademarks mentioned herein are property of their respective companies. 2009, Microchip Technology Incorporated, Printed in the U.S.A., All Rights Reserved. Printed on recycled paper. Microchip received ISO/TS-16949:2002 certification for its worldwide headquarters, design and wafer fabrication facilities in Chandler and Tempe, Arizona; Gresham, Oregon and design centers in California and India. The Company s quality system processes and procedures are for its PIC MCUs and dspic DSCs, KEELOQ code hopping devices, Serial EEPROMs, microperipherals, nonvolatile memory and analog products. In addition, Microchip s quality system for the design and manufacture of development systems is ISO 9001:2000 certified Microchip Technology Inc. DS01307A-page 25
26 Worldwide Sales and Service AMERICAS Corporate Office 2355 West Chandler Blvd. Chandler, AZ Tel: Fax: Technical Support: Web Address: Atlanta Duluth, GA Tel: Fax: Boston Westborough, MA Tel: Fax: Chicago Itasca, IL Tel: Fax: Cleveland Independence, OH Tel: Fax: Dallas Addison, TX Tel: Fax: Detroit Farmington Hills, MI Tel: Fax: Kokomo Kokomo, IN Tel: Fax: Los Angeles Mission Viejo, CA Tel: Fax: Santa Clara Santa Clara, CA Tel: Fax: Toronto Mississauga, Ontario, Canada Tel: Fax: ASIA/PACIFIC Asia Pacific Office Suites , 37th Floor Tower 6, The Gateway Harbour City, Kowloon Hong Kong Tel: Fax: Australia - Sydney Tel: Fax: China - Beijing Tel: Fax: China - Chengdu Tel: Fax: China - Hong Kong SAR Tel: Fax: China - Nanjing Tel: Fax: China - Qingdao Tel: Fax: China - Shanghai Tel: Fax: China - Shenyang Tel: Fax: China - Shenzhen Tel: Fax: China - Wuhan Tel: Fax: China - Xiamen Tel: Fax: China - Xian Tel: Fax: China - Zhuhai Tel: Fax: ASIA/PACIFIC India - Bangalore Tel: Fax: India - New Delhi Tel: Fax: India - Pune Tel: Fax: Japan - Yokohama Tel: Fax: Korea - Daegu Tel: Fax: Korea - Seoul Tel: Fax: or Malaysia - Kuala Lumpur Tel: Fax: Malaysia - Penang Tel: Fax: Philippines - Manila Tel: Fax: Singapore Tel: Fax: Taiwan - Hsin Chu Tel: Fax: Taiwan - Kaohsiung Tel: Fax: Taiwan - Taipei Tel: Fax: Thailand - Bangkok Tel: Fax: EUROPE Austria - Wels Tel: Fax: Denmark - Copenhagen Tel: Fax: France - Paris Tel: Fax: Germany - Munich Tel: Fax: Italy - Milan Tel: Fax: Netherlands - Drunen Tel: Fax: Spain - Madrid Tel: Fax: UK - Wokingham Tel: Fax: /26/09 DS01307A-page Microchip Technology Inc.
TB3016. Using the PIC MCU CTMU for Temperature Measurement IMPLEMENTATION BASIC PRINCIPLE MEASUREMENT CIRCUIT
Using the PIC MCU CTMU for Temperature Measurement Author: Padmaraja Yedamale Microchip Technology Inc. The Charge Time Measurement Unit (CTMU), introduced on the latest generation of PIC24F and PIC18F
AN1286. Water-Resistant Capacitive Sensing INTRODUCTION THEORY OF OPERATION. Sensing Steps. Sensing Steps Description DESIGN
Water-Resistant Capacitive Sensing AN1286 Author: INTRODUCTION Thomas Perme Steven Lin Microchip Technology Inc. This application note describes a new hardware sensing method which is resilient to water
AN1303. Software Real-Time Clock and Calendar Using PIC16F1827 DATA INTERFACE INTRODUCTION IMPLEMENTATION INTERNAL REGISTER MAP
Software Real-Time Clock and Calendar Using PIC16F1827 Author: INTRODUCTION Cristian Toma Microchip Technology Inc. This application note describes the implementation of software Real-Time Clock and Calendar
AN1325. mtouch Metal Over Cap Technology THEORY OF OPERATION INTRODUCTION CROSS SECTION OF METAL OVER CAPACITIVE (UNPRESSED)
mtouch Metal Over Cap Technology AN1325 Authors: INTRODUCTION Keith Curtis Dieter Peter Microchip Technology Inc. As a user interface, capacitive touch has several advantages: it is low power, low cost,
Recommended Usage of Microchip 23X256/23X640 SPI Serial SRAM Devices RECOMMENDED CONNECTIONS FOR 23X256,23X640 SERIES DEVICES VCC 23X256/ HOLD.
Recommended Usage of Microchip 23X256/23X640 SPI Serial SRAM Devices Author: INTRODUCTION Martin Bowman Microchip Technology Inc. This document details recommended usage of the Microchip 23X256 and 23X640
Installing and Licensing MPLAB XC C Compilers
Installing and Licensing MPLAB XC C Compilers DS50002059G Note the following details of the code protection feature on Microchip devices: Microchip products meet the specification contained in their particular
AN687. Precision Temperature-Sensing With RTD Circuits RTD OVERVIEW INTRODUCTION EQUATION 1:
Precision Temperature-Sensing With RTD Circuits Author: INTRODUCTION Bonnie C. Baker Microchip Technology Inc. The most widely measured phenomena in the process control environment is temperature. Common
AN1142. USB Mass Storage Class on an Embedded Host INTRODUCTION. USB Mass Storage Class. Overview
USB Mass Storage Class on an Embedded Host Author: INTRODUCTION With the introduction of Microchip's microcontrollers with the USB OTG peripheral, microcontroller applications can easily support USB Embedded
Universal Programming Module 2
Universal Programming Module OVERVIEW The Universal Programming Module (UPM) is a handy, low-cost board that supports the programming of Microchip devices using MPLAB in-circuit emulators and debuggers.
AN1199. 1-Wire Communication with PIC Microcontroller INTRODUCTION. OVERVIEW OF THE 1-Wire BUS. 1-Wire Protocol. Prerequisites
1-Wire Communication with PIC Microcontroller Author: INTRODUCTION This application note introduces the user to the 1-Wire communication protocol and describes how a 1-Wire device can be interfaced to
Features, Value and Benefits of Digital Control for Power Supplies
Author: INTRODUCTION Sagar Khare Microchip Technology Inc. Control of Switch Mode Power Supplies (SMPSs) has traditionally been a purely analog domain. The advent of low-cost, high-performance Digital
AN905. Brushed DC Motor Fundamentals INTRODUCTION PRINCIPLES OF OPERATION. Stator. Rotor SIMPLE TWO-POLE BRUSHED DC MOTOR. Microchip Technology Inc.
Brushed DC Motor Fundamentals AN905 Author: Reston Condit Microchip Technology Inc. INTRODUCTION Brushed DC motors are widely used in applications ranging from toys to push-button adjustable car seats.
AN1470. Manchester Decoder Using the CLC and NCO ABSTRACT INTRODUCTION MANCHESTER ENCODED DATA (AS PER G.E. THOMAS)
Manchester Decoder Using the CLC and NCO Authors: ABSTRACT A Manchester decoder can be built using Microchip s award winning CLC (Configurable Logic Cell) blocks and NCO (Numerically Controlled Oscillator)
AN1156. Battery Fuel Measurement Using Delta-Sigma ADC Devices INTRODUCTION REVIEW OF BATTERY CHARGING AND DISCHARGING CHARACTERISTICS
Battery Fuel Measurement Using Delta-Sigma ADC Devices Author: INTRODUCTION Youbok Lee, Ph.D. Microchip Technology Inc. The battery fuel status indicator is a common feature of the battery-supported handheld
AN1332. Current Sensing Circuit Concepts and Fundamentals CURRENT SENSING RESISTOR INTRODUCTION. Description. Microchip Technology Inc.
Current Sensing Circuit Concepts and Fundamentals Author: INTRODUCTION Yang Zhen Microchip Technology Inc. Current sensing is a fundamental requirement in a wide range of electronic applications. Typical
Uninstalling Incorrect USB Device Drivers
DEVELOPMENT SYSTEMS Uninstalling Incorrect USB Device Drivers RECOMMENDED UNINSTALL METHODS When using the Microchip development tools listed below, trouble may be experienced as a result of incorrect
TC1047/TC1047A. Precision Temperature-to-Voltage Converter. General Description. Applications. Block Diagram. Features.
Precision Temperature-to-Voltage Converter Features Supply Voltage Range: - TC147: 2.7V to 4.4V - TC147A: 2.V to.v Wide Temperature Measurement Range: - -4 o C to +12 o C High Temperature Converter Accuracy:
AN1275. KEELOQ with Advanced Encryption Standard (AES) Receiver/Decoder KEY FEATURES OVERVIEW. Microchip Technology Inc.
KEELOQ with Advanced Encryption Standard (AES) Receiver/Decoder Author: OVERVIEW Enrique Aleman Microchip Technology Inc. This application note describes a KEELOQ with AES code hopping decoder implemented
AN1353. Op Amp Rectifiers, Peak Detectors and Clamps INTRODUCTION BASIC RECTIFIERS. Choosing the Components. Positive Half-Wave Rectifier.
Op Amp Rectifiers, Peak Detectors and Clamps Author: Dragos Ducu, Microchip Technology Inc. INTRODUCTION This application note covers a wide range of applications, such as halfwave rectifiers, fullwave
AN1857. RGBW Color Mixing DALI Control Gear. COLOR MIXING USING RED, GREEN, BLUE AND WHITE LEDs INTRODUCTION HARDWARE
RGBW Color Mixing DALI Control Gear AN1857 Author: INTRODUCTION Mihai Cuciuc Microchip Technology Inc. This application note provides an example of obtaining custom colors by combining the spectra of the
TC7660. Charge Pump DC-to-DC Voltage Converter. Package Types. Features. General Description. Applications. Functional Block Diagram TC7660
Charge Pump DC-to-DC Voltage Converter Features Wide Input Voltage Range:.V to V Efficient Voltage Conversion (99.9%, typ) Excellent Power Efficiency (9%, typ) Low Power Consumption: µa (typ) @ V IN =
AN1492. Microchip Capacitive Proximity Design Guide INTRODUCTION CAPACITIVE SENSING BASICS SENSING
Microchip Capacitive Proximity Design Guide Author: INTRODUCTION Xiang Gao Microchip Technology Inc. Proximity detection provides a new way for users to interact with electronic devices without having
MCP73X23 Lithium Iron Phosphate (LiFePO 4 ) Battery Charger Evaluation Board User s Guide
MCP73X23 Lithium Iron Phosphate (LiFePO 4 ) Battery Charger Evaluation Board User s Guide 2009 Microchip Technology Inc. DS51850A Note the following details of the code protection feature on Microchip
Timers: Timer0 Tutorial (Part 1)
Timers: Timer0 Tutorial (Part 1) 2007 Microchip Technology Inc. DS51682A Note the following details of the code protection feature on Microchip devices: Microchip products meet the specification contained
Designing A Li-Ion Battery Charger and Load Sharing System With Microchip s Stand-Alone Li-Ion Battery Charge Management Controller
Designing A Li-Ion Battery Charger and Load Sharing System With Microchip s Stand-Alone Li-Ion Battery Charge Management Controller Author: INTRODUCTION Brian Chu Microchip Technology Inc. Batteries often
Touch Through Metal. mtouch Metal Over Capacitive Technology Part 1
Touch Through Metal mtouch Metal Over Capacitive Technology Part 1 2010 Microchip Technology Incorporated. All Rights Reserved. Touch Through Metal Slide 1 Hello and welcome to Microchip s Touch Through
Section 15. Input Capture
Section 15. Input Capture HIGHLIGHTS This section of the manual contains the following topics: 15.1 Introduction...15-2 15.2 Input Capture Registers...15-4 15.3 Timer Selection...15-8 15.4 Input Capture
AN1543. Using MRF24W with PIC32 Internal Program Flash Memory For EZ_CONFIG_STORE ALTERNATIVE LOW-COST SOLUTIONS OVERVIEW SCOPE
Using MRF24W with PIC32 Internal Program Flash Memory For EZ_CONFIG_STORE Author: OVERVIEW This application note describes the EZ_CONFIG_STORE feature used in the Wi-Fi G Demo Board and TCPIP-WiFi EZConfig
PIC32 Microcontroller Families
32-bit Microcontrollers Winter 2009 PIC32 Microcontroller Families With USB, CAN and Ethernet www.microchip.com/pic32 Building on the heritage of Microchip Technology s world-leading 8- and 16-bit PIC
AN1265. KEELOQ with AES Microcontroller-Based Code Hopping Encoder INTRODUCTION DUAL ENCODER OPERATION BACKGROUND FUNCTIONAL INPUTS AND
KEELOQ with AES Microcontroller-Based Code Hopping Encoder Authors: INTRODUCTION This application note describes the design of a microcontroller-based KEELOQ Hopping Encoder using the AES encryption algorithm.
AN235 Application note
Application note Stepper motor driving By Thomas Hopkins Introduction Dedicated integrated circuits have dramatically simplified stepper motor driving. To apply these ICs, designers need little specific
AN1066. Microchip MiWi Wireless Networking Protocol Stack INTRODUCTION CONSIDERATIONS TERMINOLOGY FEATURES
Microchip MiWi Wireless Networking Protocol Stack Author: INTRODUCTION Implementing applications with wireless networking is now common. From consumer devices to industrial applications, there is a growing
MCP2200 USB to RS-232 Demo Board User s Guide
MCP2200 USB to RS-232 Demo Board User s Guide DS51901A Note the following details of the code protection feature on Microchip devices: Microchip products meet the specification contained in their particular
WORKSHOP-IN-A-BOX 2: LOW POWER SOLUTIONS DEMONSTRATION BOARD
WORKSHOP-IN-A-BOX 2: LOW POWER SOLUTIONS DEMONSTRATION BOARD 2004 Microchip Technology Inc. DS51512A Note the following details of the code protection feature on Microchip devices: Microchip products meet
Drive circuit basics + V. τ e. Industrial Circuits Application Note. Winding resistance and inductance
ndustrial Circuits Application Note Drive circuit basics For a given size of a stepper motor, a limited space is available for the windings. n the process of optimizing a stepper motor drive system, an
Integrated Development Environment
Development Tools Integrated Development Environment Transforming Ideas Into Realities The typical product development life cycle is comprised of smaller cycles each representing an iterative process toward
AC/DC Power Supply Reference Design. Advanced SMPS Applications using the dspic DSC SMPS Family
AC/DC Power Supply Reference Design Advanced SMPS Applications using the dspic DSC SMPS Family dspic30f SMPS Family Excellent for Digital Power Conversion Internal hi-res PWM Internal high speed ADC Internal
Switch Mode Power Supply Topologies
Switch Mode Power Supply Topologies The Buck Converter 2008 Microchip Technology Incorporated. All Rights Reserved. WebSeminar Title Slide 1 Welcome to this Web seminar on Switch Mode Power Supply Topologies.
AN1212. Using USB Keyboard with an Embedded Host INTRODUCTION. USB Keyboard Overview. USB Keyboard with an Embedded Host USB KEYBOARD OUTPUT REPORT
Using USB Keyboard with an Embedded Host Author: INTRODUCTION Amardeep Gupta Microchip Technology Inc. Microcontroller applications can easily support USB embedded host functionality with the introduction
AN1256. Microchip s Power MOSFET Driver Simulation Models INTRODUCTION MODEL DESCRIPTION. Using The Power MOSFET Simulation Models
Microchip s Power MOSFET Driver Simulation Models Author: INTRODUCTION Cliff Ellison (Microchip Technology Inc.) Ron Wunderlich (Innovative Ideas and Design) The simulation models for Microchip s power
Resistive Temperature Detector (RTD) Reference Design
Resistive Temperature Detector (RTD) Reference Design DS51891A Note the following details of the code protection feature on Microchip devices: Microchip products meet the specification contained in their
AN1160. Sensorless BLDC Control with Back-EMF Filtering Using a Majority Function SENSORED CONTROL VERSUS SENSORLESS CONTROL INTRODUCTION
Sensorless BLDC Control with Back-EMF Filtering Using a Majority Function Author: INTRODUCTION Adrian Lita and Mihai Cheles Microchip Technology Inc. This application note describes a sensorless Brushless
AN1305. Sensorless 3-Phase Brushless Motor Control with the PIC16FXXX TYPICAL MOTOR CONNECTION OVERVIEW DRIVE AND CONTROL CIRCUITRY
Sensorless 3-Phase Brushless Motor Control with the PIC16FXXX Author: OVERVIEW Ward Brown Microchip Technology Inc. In 2002, I wrote my first application note on brushless motor control, AN857, which described
Analog-to-Digital Converters
Analog-to-Digital Converters In this presentation we will look at the Analog-to-Digital Converter Peripherals with Microchip s midrange PICmicro Microcontrollers series. 1 Analog-to-Digital Converters
Integrated Development Environment
Development Tools Integrated Development Environment Transforming Ideas Into Realities The typical product development life cycle is comprised of smaller cycles each representing an iterative process toward
MPLAB XC8 GETTING STARTED GUIDE. MPLAB XC8 Getting Started Guide
MPLAB XC8 GETTING STARTED GUIDE MPLAB XC8 Getting Started Guide This document provides a starting point for programmers who are just starting out with the MPLAB XC8 C Compiler, particularly those who are
Peripheral Brief: Programmable Switch Mode Controller (PSMC) 1, 2, 4, 8 PSMCXTMR CLR PSMCXPR = Period. Event PSMCXPRS. Rising.
Peripheral Brief: Programmable Switch Mode Controller (PSMC) Author: INTRODUCTION John Mouton Microchip Technology Inc. This peripheral brief reviews the basic functionality of the Programmable Switch
APPLICATION NOTE. Atmel AVR443: Sensor-based Control of Three Phase Brushless DC Motor. Atmel AVR 8-bit Microcontrollers. Features.
APPLICATION NOTE Features Atmel AVR443: Sensor-based Control of Three Phase Brushless DC Motor Less than 5µs response time on Hall sensor output change Theoretical maximum of 1600k RPM Over-current sensing
AN1465. Digitally Addressable Lighting Interface (DALI) Communication TERMINOLOGY PHYSICAL LAYER DALI FREE-FORM LAYOUT. Topology FIGURE 1:
Digitally Addressable Lighting Interface (DALI) Communication Author: Shaima Husain Microchip Technology Inc. The Digitally Addressable Lighting Interface (DALI) has emerged as a standard in Europe to
AN3327 Application note
AN3327 Application note L9942 back EMF stall detection algorithm Introduction The L9942 is an integrated stepper motor driver for bipolar stepper motors used primarily in automotive head lamp leveling.
Introduction to SMPS Control Techniques
Introduction to SMPS Control Techniques 2006 Microchip Technology Incorporated. All Rights Reserved. Introduction to SMPS Control Techniques Slide 1 Welcome to the Introduction to SMPS Control Techniques
AN2680 Application note
Application note Fan speed controller based on STDS75 or STLM75 digital temperature sensor and ST72651AR6 MCU Introduction This application note describes the method of defining the system for regulating
AN2389 Application note
Application note An MCU-based low cost non-inverting buck-boost converter for battery chargers Introduction As the demand for rechargeable batteries increases, so does the demand for battery chargers.
Flexible Active Shutter Control Interface using the MC1323x
Freescale Semiconductor Document Number: AN4353 Application Note Rev. 0, 9/2011 Flexible Active Shutter Control Interface using the MC1323x by: Dennis Lui Freescale Hong Kong 1 Introduction This application
3-Phase BLDC Motor Control with Hall Sensors Using 56800/E Digital Signal Controllers
Freescale Semiconductor Application Note AN1916 Rev. 2.0, 11/2005 3-Phase BLDC Motor Control with Hall Sensors Using 56800/E Digital Signal Controllers Leonard N. Elevich Contents 1. Application Benefits...1
PIC18F26K20/46K20 Rev. B2/B3/B5/B6 Silicon Errata and Data Sheet Clarification
PIC18F26K20/46K20 Rev. B2/B3/B5/B6 Silicon Errata and Data Sheet Clarification The PIC18F26K20/46K20 family devices that you have received conform functionally to the current Device Data Sheet (DS41303G),
Micro-Step Driving for Stepper Motors: A Case Study
Micro-Step Driving for Stepper Motors: A Case Study N. Sedaghati-Mokhtari Graduate Student, School of ECE, University of Tehran, Tehran, Iran n.sedaghati @ece.ut.ac.ir Abstract: In this paper, a case study
TABLE 1: BUCK REGULATOR
A Digital Constant Current Power LED Driver Author: INTRODUCTION Stephen Bowling Microchip Technology Inc. This document describes a power LED driver solution using the PIC12HV615 microcontroller (MCU).
Section 5. Flash Programming
Section 5. Flash Programming HIGHLIGHTS This section of the manual contains the following topics: 5.1 Introduction...5-2 5.2 Control Registers... 5-3 5.3 Run-Time Self-Programming (RTSP) Operation... 5-10
MCP1701A. 2 µa Low-Dropout Positive Voltage Regulator. Features. General Description. Applications. Package Types
2 µa Low-Dropout Positive Voltage Regulator Features 2.0 µa Typical Quiescent Current Input Operating Voltage Range up to 10.0V Low-Dropout Voltage (LDO): - 120 mv (typical) @ 100 ma - 380 mv (typical)
L297 STEPPER MOTOR CONTROLLERS
L297 STEPPER MOTOR CONTROLLERS NORMAL/WAVE DRIVE HALF/FULL STEP MODES CLOCKWISE/ANTICLOCKWISE DIRECTION SWITCHMODE LOAD CURRENT REGULA- TION PROGRAMMABLE LOAD CURRENT FEW EXTERNAL COMPONENTS RESET INPUT
dspic30f3012/3013 dspic30f3012/3013 Rev. B0 Silicon Errata dspic30f3012/3013 (Rev. B0) Silicon Errata Silicon Errata Summary
dspic30f3012/3013 Rev. B0 Silicon Errata dspic30f3012/3013 (Rev. B0) Silicon Errata The dspic30f3012/3013 (Rev. B0) samples you have received were found to conform to the specifications and functionality
28-PIN DEMO BOARD USER S GUIDE
28-PIN DEMO BOARD USER S GUIDE 2006-2015 Microchip Technology Inc. DS40001301B Note the following details of the code protection feature on Microchip devices: Microchip products meet the specification
MPLAB Code Configurator User s Guide
MPLAB Code Configurator User s Guide 2013-2014 Microchip Technology Inc. DS40001725B MPLAB CODE CONFIGURATOR USER S GUIDE Note the following details of the code protection feature on Microchip devices:
MCP2515 CAN Bus Monitor Demo Board User s Guide
MCP2515 CAN Bus Monitor Demo Board User s Guide 2008 Microchip Technology Inc. DS51757A Note the following details of the code protection feature on Microchip devices: Microchip products meet the specification
How To Control A Motor Control On An Hvac Platform
Freescale Semiconductor Document Number:AN4616 Application Note Rev. 0, 10/2012 Flap Motor Control Based On HVAC Platform by: Shawn Shi, Albert Chen, Alex Liu 1 Introduction According to the world market
Current Loop Tuning Procedure. Servo Drive Current Loop Tuning Procedure (intended for Analog input PWM output servo drives) General Procedure AN-015
Servo Drive Current Loop Tuning Procedure (intended for Analog input PWM output servo drives) The standard tuning values used in ADVANCED Motion Controls drives are conservative and work well in over 90%
Serial EEPROM Powered for Automotive
Automotive Memory Products Serial EEPROM Powered for Automotive www.microchip.com/memory Microchip Serial Memory Products Microchip Technology has developed industry-leading processes for each step in
AN1106. Power Factor Correction in Power Conversion Applications Using the dspic DSC INTRODUCTION
Power Factor Correction in Power Conversion Applications Using the dspic DSC Author: INTRODUCTION Vinaya Skanda Microchip Technology Inc. Most of the power conversion applications consist of an AC-to-DC
LAB 7 MOSFET CHARACTERISTICS AND APPLICATIONS
LAB 7 MOSFET CHARACTERISTICS AND APPLICATIONS Objective In this experiment you will study the i-v characteristics of an MOS transistor. You will use the MOSFET as a variable resistor and as a switch. BACKGROUND
FREQUENCY CONTROLLED AC MOTOR DRIVE
FREQUENCY CONTROLLED AC MOTOR DRIVE 1.0 Features of Standard AC Motors The squirrel cage induction motor is the electrical motor motor type most widely used in industry. This leading position results mainly
AND8008/D. Solid State Control Solutions for Three Phase 1 HP Motor APPLICATION NOTE
Solid State Control Solutions for Three Phase 1 HP Motor APPLICATION NOTE INTRODUCTION In all kinds of manufacturing, it is very common to have equipment that has three phase motors for doing different
AMZ-FX Guitar effects. (2007) Mosfet Body Diodes. http://www.muzique.com/news/mosfet-body-diodes/. Accessed 22/12/09.
Pulse width modulation Pulse width modulation is a pulsed DC square wave, commonly used to control the on-off switching of a silicon controlled rectifier via the gate. There are many types of SCR s, most
TDA4605 CONTROL CIRCUIT FOR SWITCH MODE POWER SUPPLIES USING MOS TRANSISTORS
CONTROL CIRCUIT FOR SWITCH MODE POWER SUPPLIES USING MOS TRANSISTORS Fold-Back Characteristic provides Overload Protection for External Diodes Burst Operation under Short-Circuit and no Load Conditions
AN645. PIC16C57 Based Code Hopping Security System PINOUT OVERVIEW FEATURES BLOCK DIAGRAM RECOMMENDED READING
PI657 Based ode Hopping Security System Author: OVERVIEW This document describes a PI657 based code hopping automotive security system. The security system implements all the basic features found on security
Tamura Closed Loop Hall Effect Current Sensors
Tamura Closed Loop Hall Effect Current Sensors AC, DC, & Complex Currents Galvanic Isolation Fast Response Wide Frequency Bandwidth Quality & Reliability RoHs Compliance Closed Loop Hall Effect Sensors
AN1861. Bluetooth Smart Communication Using Microchip RN4020 Module and 16-bit PIC Microcontroller BLUETOOTH SMART COMMUNICATION INTRODUCTION
Bluetooth Smart Communication Using Microchip RN4020 Module and 16-bit PIC Microcontroller Author: Venkatesh Bengeri and Pradeep Shamanna INTRODUCTION Most of the embedded applications require real-time
Microcontroller for Variable Speed BLDC Fan Control System. T.C. Lun System Engineer, Freescale Semiconductor, Inc.
Microcontroller for Variable Speed BLDC Fan Control System T.C. Lun System Engineer, Freescale Semiconductor, Inc. 1 Introduction Portable, feature rich, high-performance and compact in size are typical
PICmicro DC Motor Control Tips n Tricks
PICmicro DC Motor Control Tips n Tricks M Table of Contents Tips n Tricks Tips N Tricks Introduction TIP #1: Brushed DC Motor Drive Circuits...2 TIP #2: Brushless DC Motor Drive Circuits...5 TIP #3: Stepper
DC Motor control Reversing
January 2013 DC Motor control Reversing and a "Rotor" which is the rotating part. Basically there are three types of DC Motor available: - Brushed Motor - Brushless Motor - Stepper Motor DC motors Electrical
MCP73811/2. Simple, Miniature Single-Cell, Fully Integrated Li-Ion / Li-Polymer Charge Management Controllers. Description. Features.
Simple, Miniature Single-Cell, Fully Integrated Li-Ion / Li-Polymer Charge Management Controllers Features Complete Linear Charge Management Controller - Integrated Pass Transistor - Integrated Current
AN956. Migrating Applications to USB from RS-232 UART with Minimal Impact on PC Software OVERVIEW INTRODUCTION. Microchip Technology Inc.
Migrating Applications to USB from RS-232 UART with Minimal Impact on PC Software Author: INTRODUCTION Rawin Rojvanit Microchip Technology Inc. The RS-232 serial interface is no longer a common port found
How To Use A Watt Saver On A Microcontroller (Watt Saver) On A Cell Phone Or Mp3 Player
Watt Saver for a Cell Phone AC Adapter Reference Design Document Number: DRM130 Rev 1, 10/2013 2 Freescale Semiconductor, Inc. Contents Section number Title Page Chapter 1 Introduction 1.1 Overview...5
.OPERATING SUPPLY VOLTAGE UP TO 46 V
L298 DUAL FULL-BRIDGE DRIVER.OPERATING SUPPLY VOLTAGE UP TO 46 V TOTAL DC CURRENT UP TO 4 A. LOW SATURATION VOLTAGE OVERTEMPERATURE PROTECTION LOGICAL "0" INPUT VOLTAGE UP TO 1.5 V (HIGH NOISE IMMUNITY)
AN1426. Design Tips for the MCP3911 INTRODUCTION. Addressable Devices on Single SPI Bus. Addressable SPI for Poly-phase Meter Designs.
Design Tips for the MCP3911 AN1426 Author: Craig King Microchip Technology Inc. Here, pushing the limits of the analog-to-digital conversion will be the focus, showing the true performance limits of the
MPLAB ICD 3 In-Circuit Debugger User s Guide For MPLAB X IDE
MPLAB ICD 3 In-Circuit Debugger User s Guide For MPLAB X IDE DS52081A Note the following details of the code protection feature on Microchip devices: Microchip products meet the specification contained
AN232. Low-Frequency Magnetic Transmitter Design ABOUT THIS APPLICATION NOTE INTRODUCTION LFMC LINK COMPONENTS
Low-Frequency Magnetic Transmitter Design AN232 Author: INTRODUCTION Ruan Lourens Microchip Technology Inc. Low-frequency magnetic communications (LFMC) is a viable wireless communications alternative
AN1521. Practical Guide to Implementing Solar Panel MPPT Algorithms SOLAR PANEL MPPT INTRODUCTION
AN5 Practical Guide to Implementing Solar Panel MPPT Algorithms Authors: INTRODUCTION Mihnea Rosu-Hamzescu Sergiu Oprea Microchip Technology Inc. Using a solar panel or an array of panels without a controller
AN990. Analog Sensor Conditioning Circuits An Overview INTRODUCTION SENSOR APPLICATIONS. Target Audience. Goals. Description.
Analog Conditioning Circuits An Overview Author: INTRODUCTION Target Audience This application note is intended for hardware design engineers that need to condition the output of common analog sensors.
How to Turn an AC Induction Motor Into a DC Motor (A Matter of Perspective) Steve Bowling Application Segments Engineer Microchip Technology, Inc.
1 How to Turn an AC Induction Motor Into a DC Motor (A Matter of Perspective) Steve Bowling Application Segments Engineer Microchip Technology, Inc. The territory of high-performance motor control has
TCP/IP Networking: Web-Based Status Monitoring
TCP/IP Networking: Web-Based Status Monitoring Microchip TCP/IP Stack HTTP2 Module 2007 Microchip Technology Incorporated. All Rights Reserved. Web-Based Status Monitoring Slide 1 Welcome to the first
Introduction to Power Supplies
Introduction to Power Supplies INTRODUCTION Virtually every piece of electronic equipment e g computers and their peripherals calculators TV and hi-fi equipment and instruments is powered from a DC power
Application Note AN-1187
Application Note AN-1187 IR3230 Sensorless BLDC Motor Drive By Alex Lollio Table of Contents Application Note AN-1234... 1 Introduction... 2 Basic Working Principle... 3 Motor Control... 4 Motor Control
Inrush Current. Although the concepts stated are universal, this application note was written specifically for Interpoint products.
INTERPOINT Although the concepts stated are universal, this application note was written specifically for Interpoint products. In today s applications, high surge currents coming from the dc bus are a
TCM809/TCM810. 3-Pin Microcontroller Reset Monitors. General Description. Features. Applications. Pin Configurations. Typical Application Circuit
3-Pin Microcontroller Reset Monitors Features Precision Monitor for 2.5V, 3.V, 3.3V, 5.V Nominal System Voltage Supplies 14 msec Minimum RESET Time-Out Period RESET Output to = 1.V (TCM89) Low Supply Current,
AVR127: Understanding ADC Parameters. Introduction. Features. Atmel 8-bit and 32-bit Microcontrollers APPLICATION NOTE
Atmel 8-bit and 32-bit Microcontrollers AVR127: Understanding ADC Parameters APPLICATION NOTE Introduction This application note explains the basic concepts of analog-to-digital converter (ADC) and the
Sensorless Field Oriented Control (FOC) for a Permanent Magnet Synchronous Motor (PMSM) Using a PLL Estimator and Field Weakening (FW)
Sensorless Field Oriented Control (FOC) for a Permanent Magnet Synchronous Motor (PMSM) Using a PLL Estimator and Field Weakening (FW) Author: INTRODUCTION Mihai Cheles Microchip Technology Inc. Current
EET272 Worksheet Week 9
EET272 Worksheet Week 9 answer questions 1-5 in preparation for discussion for the quiz on Monday. Finish the rest of the questions for discussion in class on Wednesday. Question 1 Questions AC s are becoming
AN2604 Application note
AN2604 Application note STM32F101xx and STM32F103xx RTC calibration Introduction The real-time clock (RTC) precision is a requirement in most embedded applications, but due to external environment temperature
AN ISOLATED GATE DRIVE FOR POWER MOSFETs AND IGBTs
APPLICATION NOTE AN ISOLATED GATE DRIVE FOR POWER MOSFETs AND IGBTs by J.M. Bourgeois ABSTRACT Power MOSFET and IGBT gate drives often face isolation and high voltage constraints. The gate drive described
