Motor primer and the l293d quad half-h driver – codeproject

There are many ways to drive small current motors, those requiring 500mA or less but the L293H Quadruple Half-H driver is a versatile chip that was designed for use with motors, can very easily be controlled with a micro-controller and can be purchased [here]. Pulse width modulation lab experiment Using this chip, we can drive either 2 DC motors or one Stepper motor and we will learn how to do both in this tutorial. Pulse width modulation raspberry pi The components needed to complete this exercise are an ATMega328p Micro-controller to interface with and control the L293D device but any controller may be used, the L293D component and one dc motor. Led pulse width modulation DC Motors

This is not an article on motor theory, there are plenty of tutorials available [1], but a fundamental understanding of how they work is going to be helpful later when we start programming the software to control them. Advantages and disadvantages of pulse width modulation Most small dc motors that are used by hobbyists are of the brushless type and are comprised of two basic parts – the rotor, the moving part and the stator, the stationary part and generally have 3 poles as shown in the animation to the right.


Pulse width modulation amplifier Stationary polarized permanent magnets are placed at opposing sides and the rotor interacts with the magnets by applying current to the windings of the poles in the manner shown in the animation thus driving the motor. Pulse width modulation for power electronic converters The direction of the motor is determined by the polarity of the input voltage and the direction associated with a rotation as defined by the Right-hand rule. Pulse width modulation formula [2] When working with DC motors, there are two current ratings that you must pay attention to. Pulse width modulation advantages and disadvantages The first is the operating current, this is the average amount of current that the motor will consume while running under normal conditions. Unipolar pulse width modulation The next is the stall current that can be best demonstrated if you hold the shaft of the motor with your fingers so that it cannot turn and apply power. Pulse width modulation adalah The L293 can handle a continuous peak output current of 650mA so whatever motor you decide on should not draw more than this value under the most severe conditions.

For this exercise, I salvaged a small motor out of an old CD drive and was surprised to find any kind of data on this motor as the drive it came out of was very old. Define pulse width modulation Listed below is the motor specifications that were found for this motor and as you will notice, the stall current for this motor is well under the current limit for the L293D we are well within the operating range.

Another factor to be aware of is that because of inductance and momentum when reversing the direction of the motor while it is running will cause a brief voltage spike effectively doubling the operating voltage and cause the current to rise to just below the stall current.

Once the motor is running, it generates a voltage similar to moving a wire through a magnetic field to produce whats called back EMF. Pulse width modulation thermostat The way to counteract this is to place a general purpose diode across the leads of the motor allowing current to flow in only one direction thus counteracting the back Electro Motive Force. Pulse width modulation and demodulation experiment But one of the things that makes the L293D chip unique is that it has these diodes that are built into the chip leaving us with one less thing to worry about.

So enough theory. Wiki pulse width modulation Let’s get to wiring it up and watching it go. Pulse width modulation diagram The schematic below shows how to wire the different components together and as can be seen, it is a very simple process involving only the controller, the driver chip and a motor of your choice. Operation of pulse width modulation The chip takes two supply voltages; one is the standard 5V supply to drive the chip logic and the other, the motor supply voltage can vary from 4.5V to 36V depending on the specifications of your motor. Multiple pulse width modulation In the schematic, there is only one motor shown but another may be wired in a similar fashion using the 2 nd set of inputs, enable and outputs.

From the schematic above, we see that the ports used to drive the motor are PC0-PC2 where PC0 and PC1 are the input control pins and P2 is the enable pin. Pulse width modulation for power converters pdf Therefore to drive the motor, we need to refer to the following table that describes the various combination’s possible. Pulse width modulation definition Enable

In addition to controlling the direction of the motor, the speed may also be controlled using the ATMega328p timer and the Pulse Width Modulation (PWM) feature, but that is beyond the scope of this article. Pulse width modulation circuit for hho Of note when using PWM to drive the motors wire the enable pin to VCC1 through a 10K pull-up resistor as it is slower than the input pins.

Concluding our discussion of DC motors and putting to use what we’ve learned, the listing that follows demonstrates how to program a DC motor. Pulse width modulation inverter pdf void DCMotor_cmd(DC_MOTOR_CMDS cmd)

“In Theory, a Stepper motor is a marvel in simplicity. Pwm pulse width modulation definition It has no brushes, or contacts. Sinusoidal pulse width modulation pdf Basically it’s a synchronous motor with the magnetic field electronically switched to rotate the armature magnet around.” [3]

Stepper motors are used where more precision is needed than can be achieved using the DC motor discussed in the previous section. Pulse width modulation servo Some of the advantages of using a stepper motor as opposed to a DC motor are:

• Relative positioning is very precise: For a single step, you know exactly how much the shaft will turn for each step. Pwm pulse width modulation If you purchase the motor, one of the specifications is the number of steps/rotation and if you salvaged it, it’s easy enough to determine.

For this exercise, I’ll be using a unipolar stepper motor I purchased from [here]. Pulse width modulation led dimmer A portion of the specifications for this stepper is listed in the table that follows and is typical of the information for stepper motors, and if data is available for your device it should look similar.

Even though there is information about the device I am using in this tutorial, a lot of times the device that you are using will have been salvaged out of an old printer, scanner or some other device and there likely as not won’t be any information available. Pulse width modulation inverter design This isn’t a problem and we’ll go through the identification process now. Pulse width modulation frequency There are two types of stepper motors available, the unipolar and the bipolar types. Pulse width modulation pwm Unipolar motors have 5 or 6 wires whereas the bipolar motor will have either 4, 6 or 8 leads. What is pulse width modulation pdf For further information on identifying the different types of stepper motors, an excellent reference can be found on wimb.net. Pulse width modulation principle [4]

Now we need to determine what wires do what and for that we need a multimeter to measure the resistance across the coils. Pulse width modulation of z source inverters Start by drawing a table like the one below. Pulse width modulation using microcontroller Now using the multimeter, measure across each pair of wires noting the results as you progress. Pulse width modulation circuit using op amp When you are done, you should end up with something similar to that shown in the table below:

If we cross reference the information we gathered with what we know about unipolar motors, we can see that the red and green wires are the common center taps and the other leads connect to the coils terminal points. Pulse width modulation dc motor control circuit Because this motor has separate center taps for each winding, we can wire it either as a unipolar or bipolar device and that being the case we will wire it as bipolar [5] [6] so we don’t have to use another power supply. Modified sinusoidal pulse width modulation To do this we just use the Orange, Yellow, Black and Brown wires and leave the Red and Green wires floating. Pulse width modulation graph The code to control the motor is the same whether we are wired as unipolar or bipolar so that won’t be an issue.

One other problem we have to overcome is finding the proper wiring order. Practical applications of pulse width modulation To do this, we need to get the components wired up and the software working. Single pulse width modulation This is not real difficult. Pulse width modulation arduino code We just hook up the wires initially in an arbitrary order and switch first the end pairs then the middle pairs until the motor is running smoothly.

The Stepper motor is wired similar to the DC motor except we will now be using both channels as opposed to just a single as can be seen in the schematic that follows. Pulse width modulation output For this exercise, I used two 10K pullup resistors for the enable lines because one I’m lazy and two there’s really no need for them in this instance. Pulse width modulation techniques ppt Stepper Motor Modes of Operation

When programming the stepper motor, there are several options that we can use depending on our needs. Pulse width modulation pdf The following section is divided into three sections each with a logic table that shows the order that the coils are to be activated and an animation displaying a representation of what is happening inside the motor. Pulse width modulation ppt There is a fourth mode of operation referred to as Microstepping [7] that requires the driver to control the magnitude of the current in each winding but is beyond the scope of this tutorial. Pulse width modulation lab manual Wave Drive Mode

The Wave drive mode is a single phase mode of operation and provides a Low-Torque. What is pulse width modulation This means that only one coil at a time is energized therefore it is not the optimal mode since it only takes advantage of 25% of the total motor winding at any given time. How does pulse width modulation work In1

In the Full Step Mode, two coils are being energized at any given time thus producing a higher torque and takes better advantage of the available winding. Pulse width modulation circuit using 555 timer For unipolar motors, this mode utilizes 50% of available winding while bipolar is 100% efficient. Pulse width modulation using 555 timer ic The other difference is that each step will be offset by one-half of a full step as opposed to the Wave mode. Pulse width modulation 555 In1

When I started doing the research for this article, I thought I knew quite a bit about motors and how to drive them using the L293D chip but it turns out that the research unveiled a lot of information that I hadn’t known so this turned out to be a learning experience for me too. Sine triangle pulse width modulation References

Leave a Reply

Your email address will not be published. Required fields are marked *