Advertisement

DC MOTOR INTERFACING AND PWM

, Posted by ADMIN at 1:40 AM

DC MOTOR INTERFACING AND PWM

This section begins with an overview of the basic operation of DC motors. Then we describe how to interface a DC motor to the 8051. Finally, we use Assembly and C language programs to demonstrate the concept of pulse width modulation (PWM) and show how to control the speed and direction of a DC motor.

DC motors

A direct current (DC) motor is another widely used device that translates electrical pulses into mechanical movement. In the DC motor we have only + and – leads. Connecting them to a DC voltage source moves the motor in one direction. By reversing the polarity, the DC motor will move in the opposite direction. One can easily experiment with the DC motor. For example, small fans used in many motherboards to cool the CPU are run by DC motors. By connecting their leads to the + and – voltage source, the DC motor moves. While a stepper motor moves in steps of 1 to 15 degrees, the DC motor moves continuously. In a stepper motor, if we know the starting position we can easily count the number of steps the motor has moved and calculate the final position of the motor. This is not possible in a DC motor. The maximum speed of a DC motor is indicated in rpm and is given in the data sheet. The DC motor has two rpms: no-load and loaded. The manufacturer's data sheet gives the no-load rpm. The no-load rpm can be from a few thousand to tens of thousands. The rpm is reduced when moving a load and it decreases as the load is increased. For example, a drill turning a screw has a much lower rpm speed than when it is in the no-load situation. DC motors also

have voltage and current ratings. The nominal voltage is the voltage for that motor under normal conditions, and can be from 1 to 150V, depending on the motor. As we increase the voltage, the rpm goes up. The current rating is the current consumption when the nominal voltage is applied with no load, and can be from 25mA to a few amps. As the load increases, the rpm is decreased, unless the current or voltage provided to the motor is increased, which in turn increases the torque. With a fixed voltage, as the load increases, the current (power) consumption of a DC motor is increased. If we overload the motor it will stall, and that can damage the motor due to the heat generated by high current consumption.

Table 17-9: Selected DC Motor Characteristics rvvww.Jameco.com)

Unidirection Control

Figure 17-13 shows the DC motor rotation for clockwise (CW) and counterclockwise (CCW) rotations. See Table 17-9 for selected DC motors.

Figure 17-13. DC Motor Rotation (Permanent Magnet Field)

Bidirectional control

With the help of relays or some specially designed chips we can change the direction of the DC motor rotation. Figures 17-14 through 17-17 show the basic concepts of H-Bridge control of DC motors.

Figure 17-14. H-Bridge Motor Configuration

Figure 17-14 shows the connection of an H-Bridge using simple switches. All the switches are open, which does not allow the motor to turn.

Figure 17-15. H-Bridge Motor Clockwise Configuration

Figure 17-15 shows the switch configuration for turning the motor in one direction. When switches 1 and 4 are closed, current is allowed to pass through the motor.

Figure 17-16. H-Bridge Motor Counterclockwise Configuration

Figure 17-16 shows the switch configuration for turning the motor in the opposite direction from the configuration of Figure 17-15. When switches 2 and 3 are closed, current is allowed to pass through the motor.

Figure 17-17. H-Bridge in an Invalid Configuration

Figure 17-17 shows an invalid configuration. Current flows directly to ground, creating a short circuit. The same effect occurs when switches 1 and 3 are closed or switches 2 and 4 are closed.

Table 17-10 shows some of the logic configurations for the H-Bridge design.

H-Bridge control can be created using relays, transistors, or a single 1C solution such as the L293. When using relays and transistors, you must ensure that invalid configurations do not occur.


Although we do not show the relay control of an H-Bridge, Example 17-5 shows a simple program to operate a basic H-Bridge.

Example 17-5

A switch is connected to pin P2.7. Using a simulator, write a program to monitor the status of SW and perform the following:


  1. If SW = 0, the DC motor moves clockwise.

  2. If SW = 1, the DC motor moves counterclockwise.


Figure 17-18. Bidirectional Motor Control Using an L293 Chip

Figure 17-18 shows the connection of the L293 to an 8051. Be aware that the L293 will generate heat during operation. For sustained operation of the motor, use a heat sink. Example 17-6 shows control of the L293.


Example 17-6


Figure 17-18 shows the connection of an L293. Add a switch to pin P2.7. Write a program to monitor the status of SW and perform the following:


  1. If SW = 0, the DC motor moves clockwise.

  2. If SW = 1, the DC motor moves counterclockwise.


Pulse width modulation (PWM)

The speed of the motor depends on three factors: (a) load, (b) voltage, and (c) current. For a given fixed load we can maintain a steady speed by using a method called pulse width modulation (PWM). By changing (modulating) the width of the pulse applied to the DC motor we can increase or decrease the amount of power provided to the motor, thereby increasing or decreasing the motor speed. Notice that, although the voltage has a fixed amplitude, it has a variable duty cycle. That means the wider the pulse, the higher the speed. PWM is so widely used in DC motor control that some microcontrollers come with the PWM circuitry embedded in the chip. In such microcontrollers all we have to do is load the proper registerswith the values of the high and low portions of the desired pulse, and the rest is taken care by the microcontroller. This allows the microcontroller to do other things. For microcontrollers without PWM circuitry, we must create the various duty cycle pulses using software, which prevents the microcontroller from doing other things. The ability to control the speed of the DC motor using PWM is one reason that DC motors are preferable over AC motors. AC motor speed is dictated by the AC frequency of the voltage applied to the motor and the frequency is generally fixed. As a result, we cannot control the speed of the AC motor when the load is increased. As was shown earlier, \\e can also change the DC motor's direction and torque. See Figure 17-19 for PWM comparisons.


Figure 17-19. Pulse Width Modulation Comparison

DC motor control with optoisolator

As we discussed in the first section of this chapter, the optoisolator is indispensable in many motor control applications. Figures 17-20 and 17-21 show the connections to a simple DC motor using a bipolar and a MOSFET transistor. Notice that the 8051 is protected from EMI created by motor brushes by using an optoisolator and a separate power supply.


Figures 17-20 and 17-21 show optoisolators for control of single directional motor control, and the same principle should be used for most motor applications. Separating the power supplies of the motor and logic will reduce the posi-bility of damage to the control circuity.

Figure 17-20. DC Motor Connection using a Darlington Transistor

Figure 17-20 shows the connection of a bipolar transistor to a motor. Protection of the control circuit is provided by the optoisolator. The motor and 8051 use separate power supplies. The separation of power supplies also allows the use of high-voltage motors. Notice that we use a decoupling capacitor across the motor; this helps reduce the EMI created by the motor. The motor is switched on by clearing bit Pl.O.

Figure 17-21. DC Motor Connection using a MOSFET Transistor

Figure 17-21 shows the connection of a MOSFET transistor. The optoisolator protects the 8051 from EMI. The zener diode is required for the transistor to reduce gate voltage below the rated maximum value.


Example 17-7


Refer to the figure in this example. Write a program to monitor the status of the switch and perform the following:


  1. If P2.7 = 1, the DC motor moves with 25% duty cycle pulse.

  2. If P2.7 = 0, the DC motor moves with 50% duty cycle pulse.


DC motor control and PWM using C

Examples 17-8 through 17-10 show the 8051 C version of the earlier programs controlling the DC motor.


Example 17-8


Refer to Figure 17-18 for connection of the motor. A switch is connected to pin P2.7. Write a C program to monitor the status of SW and perform the following:


  1. If SW = 0, the DC motor moves clockwise.

  2. If SW = 1, the DC motor moves counterclockwise.


    Solution:





Example 17-9


Refer to the figure in this example. Write a C program to monitor the status of SW and perform the following:


  1. If SW = 0, the DC motor moves with 50% duty cycle pulse.

  2. If SW = 1, the DC motor moves with 25% duty cycle pulse.


Example 17-10


Refer to Figure 17-20 for connection to the motor. Two switches are connected to pins P2.0 and P2.1. Write a C program to monitor the status of both switches and perform the following: SW2(P2.7) SW1(P2.6)


0 0 DC motor moves slowly (25% duty cycle).


  1. 1 DC motor moves moderately (50% duty cycle).

  2. 0 DC motor moves fast (75% duty cycle).


    1 1 DC motor moves very fast (100% duty cycle).



Solution:

SUMMARY

This chapter continued showing how to interface the 8051 with real-world devices. Devices covered in this chapter were the relay, optoisolator, stepper motor, and DC motor.


First, the basic operation of relays and optoisolators was defined, along with key terms used in describing and controlling their operations. Then the8051 was interfaced with a stepper motor. The stepper motor was then controlled via an optoisolator using 8051 Assembly and C programming languages.


Finally, the 8051 was interfaced with DC motors. A typical DC motor will take electronic pulses and convert them to mechanical motion. This chapter showed how to interface the 8051 with a DC motor. Then, simple Assembly and C programs were written to show the concept of PWM.


Control systems that require motors must be evaluated for the type of motor needed. For example, you would not want to use a stepper in a high-velocity application nor a DC motor for a low-speed, high-torque situation. The stepper motor is ideal in an open-loop positional system and a DC motor is better for a high-speed conveyer belt application. DC motors can be modified to operate in a closed-loop system by adding a shaft encoder, then using a microcontroller to monitor the exact position and velocity of the motor.
--
With Regards,

s.m.sethupathy,
sms communication,
      Bangalore.


mobile  :  8892462501, 09944 186 173           
      www.questionpaperlink.co.cc
      www.sethu-panguvarthagam.blogspot.com