Thursday, March 1, 2012

Class B Push-Pull Amplifier Design for DC Motor Analog Drive

I am currently involved in a project that requires analog speed control of a DC motor. One very popular method to achieve control of DC motors requires the use of a PWM signal along with an Hbridge circuit. Modular circuit website  provides a great resource for the Hbridge circuit and explains thoroughly different PWM driving techniques like Sign-Magnitude and Lock Anti-Phase Drive methods. However, and after doing a basic online search, I barely found any good resources on analog DC motor drives. There are many reasons for this mainly because switching drive methods are generally much more efficient than their analog counterparts and PWM signals are easily generated using microcontrollers as compared to the use of DAC for analog control. This does not mean that analog drive is obsolete as it is still the preferred method in some applications such as motor frequency response, continuous time control, and applications that are sensitive to the electromagnetic interference (EMI) that can be generated by a PWM switching circuit.

A famous method for transforming an analog signal into switching PWM signal is done using a class-D amplifier (switching amplifier). However such an amplifier design is complicated and requires lots of components. On the other hand, there are some commercially available power amplifiers such as the LM675, L165. Such ICs are a bit expensive and not widely available for the hobbyist to use.
In this post I will be reviewing DIY analog circuit designs to drive DC motors using BJT power transistors. This requires good knowledge of BJT transistors. If the terms base, collector, emitter, npn, pnp, cut-off, active and saturation regions do not mean anything to you, then maybe you should consider doing a BJT transistor research before continuing to read here.

I will be using a TIP31 npn transistor which has the following characteristics:
- Current gain: hfe=β= 50
- Collector-Emitter saturation voltage : Vce(sat)=1.2V
- Cut-off voltage Vbe(on) = 1.8V [according to the context-this will be called Vbe from now on]
I will be using also TIP32 which is the complimentary pnp transistor of the TIP31.

Common Emitter Configuration 

In this configuration we can achieve current control for the motor. Since for a DC motor the torque is proportional to current (T=K*ic where K is a constant that depends on the motor's winding configuration), torque control can be achieve using this circuit. While in active mode, the equation relating ic to Vin can be found (note Vbe = Vbe(on))


Let us understand this model intuitively:
  • For Vin<Vbe  transistor is in cut-off region and motor is off.
  • For Vin>Vbe and Vce>Vce(sat) transistor is in active region, motor torque T is proportional to Vin.
  • As we increase Vin, ib increases which means ic increases and Vce decreases. 
  • For Vin>>Vbe and Vce=Vce(sat):saturation region, motor reaches its maximum torque/speed capacity.
If we follow the DC motor's mechanical model developed in the following Carnegie Melon tutorial and assuming the only torque applied on the motor shaft is that of shaft inertia (Jm) and damping (B) we can compute the transfer function of the speed (w) versus ΔV=Vin-Vbe

According to the transfer function the steady state relationship between speed and voltage in the case of no load condition is
According to this result, decreasing Rb would cause the speed to go higher. Of course this method has its pros and cons:
  • pro: Assuming β is constant we can achieve linear current (torque) control of DC motor
  • con: The model is highly dependent on the current gain β (hfe) which varies alot specially for high power BJT (in the case of TIP31 it varies between 10 and 100). Hence the model is non linear!
Common Collector Configuration (also called Emitter-Follower)

In order to cancel the effect of β on the system we connect the motor in a common collector configuration. In this configuration, the motor is connected to the emitter of the BJT as shown in the following figure. This configuration is called emitter follower because the voltage on the emitter will always be following that of the input with a voltage drop of Vbe. So the gain of this configuration is a bit less than 1.


Again, and to evaluate the circuit, we need to find the transfer function ω/ΔV where ΔV=Vin-Vbe.
In this configuration when the transistor is turned on, Ve=Vb-Vbe. Knowing that ΔV=Vin-Vbe, the relation between the motor current, motor voltage and Vin can be found:

According to the mechanical model of the motor we know that the motor torque is equal to


Since T=K*ie and performing the Laplace transform we obtain


Equating the two equations we get the following relation:


The electrical model of the motor gives

Where R and L are the internal resistance and inductance of the motor coils. We are assuming in here that the motor is ideal and the generated EMF constant (K) is equal to that of the torque/current proportionality constant. Combining the electrical model with the previous equations of Ve and ie we obtain the following transfer function

From this transfer function we notice that if we choose Rb = 0 the effect of β on the motor is canceled. The transfer function then becomes


This is exactly the transfer function of a DC motor. However we haven't considered yet the rotation of the motor in both directions (Clockwise CW and counterclockwise CCW)

Class B Push-Pull Amplifier
In order to be able to rotate the motor in both clockwise and counterclockwise directions we should be capable of providing a negative current to the motor. This can be achieved using a push-pull amplifier. A push pull amplifier is a Class B type of amplifier that either drives a positive or a negative current into a load. It consist of a pair of complimentary transistors, in our case NPN and PNP BJT transistors, connected in common collector configuration.


When +Vcc>Vin>Vbe the upper transistor (NPN) is in active region and the lower transistor (PNP) would be in cutoff region. When -Vcc<Vin<-Vbe the lower transisor (PNP) will be in active region and the upper one will be in cutoff. The same theory developed in the previous section can be applied in here.
In order to be able to drive the transistors from a high output impedance source (potentiometer - DAC etc.) we need an impedance matching device. This can be achieved using a UA741 op-amp. The feedback for the op-amp needs to be implemented depending on the gain needed. In our case unity gain is required.

In order to test the class B push-pull amplifier I devised a setup consisting of a DC motor of maximum speed 30RPM connected to a quadrature encoder to measure speed. The data acquisition is accomplished using a dspic30F4012 microcontroller. Running at 120Mhz and 30MIPS this dspic computes the instantaneous velocity and communicates serially with a Matlab code in order to display in real time this velocity. I connected a potentiometer to the input of the amplifier. I would set the pot at a certain voltage and then wait for steady state condition to measure the velocity of the motor.

The amplifier/DC motor/encoder/acquisition setup used for the experimentation
The following plot shows the RPM vs voltage (Vin) curve for the Class B push pull amplifier design shown above.



We notice from this plot that there is a dead zone around 0V. This dead zone is called "crossover distortion" in the literature. This is obviously due to base-emitter voltage necessary for the NPN transistor to be in the active region (in the case of positive Vin) and for the PNP transistor to be in the active region (in the case of negative Vin). In the case of TIP31 and TIP32 this crossover distortion is of about 2Vbe=2*1.8=3.6volts. This  is not desirable at all since it provides non-linearity that will cause the frequency response analysis or the closed loop control to fail.

In the following allaboutcircuits.com article a solution for this crossover distortion was suggested which consists of connecting the op-amp with the negative feedback in the following manner


Without any loss of generality and in order to understand better this circuit we are going to analyze the NPN half of it. A is the gain of the amplifier.

Assuming Vin=ε is the voltage  responsible for switching the transistor from the cut-off region to the active region. Considering the case when the transistor is about to switch to the active region, then Vbe=1.8V while Ve is still 0V, hence according to the previous formula

Since the opamp has a very large gain A (about 200000 for ua741), this shows that ε is infinitesimal and very close to zero.
The following plot shows the RPM vs voltage (Vin) curve for the improved Class B push pull amplifier design with opamp feedback as compared to  the previous case


We notice from the plot that the crossover distortion has been reduced from a value of 3.6 volts to a value of 0.5v with the improved feedback design. We know from the theory that the new crossover distortion is supposed to be infinitesimally small, however in practice, this turned out not to be true. The reason for this is unknown to me but most probably it has to do with the imperfections in the opamp. If you have an idea about the reason please don't hesitate to comment.

I do realize that this design might need improvements and maybe the implementation of a class AB amplifier would have provide a better response, however for my current analog control of a DC motor application the Class B push-pull amplifier turned out to be very useful as it provided an almost linear relation between RPM and voltage. If you have any suggestions or improvements please comment on this post.

References and suggested readings:

6 comments:

  1. Excellent post. I want to thank you for this informative read. Keep up your great work.

    ReplyDelete
  2. Good explanations !

    I suspect the still noticeable cross-over distortion is due to the motor. At very low voltages the motor can't be expected to rotate with a linearly proportional speed. It would "stick" until nudged out of that inertia. You can verify this by looking at the output *voltage* which I guess would be quite linear with very little crossover distortion.

    Btw, in the last figure the blue line is labelled "No feedback", what you mean to say is "No overall feedback". There is unity feedback (-1) in the first stage and none in the final stage, that is about all. "No feedback" would mean running the whole thing in open loop, the transistors would be turning on and off wildly at random then, nobody would want that!

    ReplyDelete
    Replies
    1. Thank you for the insight. You are right regarding "No feedback", what I really meant is no overall feedback as in the previous case we had unity feedback on the opamp.

      Delete
  3. It wouldn't be better to use a couple of diode to eliminate the crossover distortion?

    ReplyDelete
  4. Excellent Post! I have a question, i want to control a dc motor with the push pull driver you described. My motor max current is 0.5 A @ 6V... What considerationes y must have in the design of the driver? Can I use TIP31-32? Should I use a buffer amplifier?

    ReplyDelete
    Replies
    1. Yes I believe TIP31-32 would do the job well! As mentioned in the post, the only reason for the buffer amplifier is to provide enough current to drive the TIPs. If you are driving the system from a POT then its necessary to have the amplifier, if not and you are driving them from a microcontroller or DAC then it's only preferable.

      Delete