Basic PWM question

So I've never done motor control before, and I am using an output port of a microprocessor to generate a PWM signal for a vibrator that requires a constant 3 V to operate.

My understanding of PWM is that I should generate a cycle of high and low (in my case, high needs to be 3V), where the percentage of high time will control how fast the motor spins (how intense the vibration is).

But I was told that I am wrong, and that because I have a CONSTANT 3 V motor, my duty cycle must be 60%, because I need 3 V for the motor and the output of the port is 5 V, and 3/5 = .6. As a result, there is no way to vary the speed (eg, the intensity) of the motor.

So naturally I'm confused as to who's right. Any guidance? Thanks,

-Zac Bond

Reply to
Zac Bond
Loading thread data ...

Well, if the motor really requires a constant 3 volts to operate (and this isn't just a lower limit), you would basically be out of luck, since it won't be getting a constant 3 volts. But have you actually verified that the motor REALLY requires a constant 3v to run -- i.e., does it not run at 2 volts, or 1.5? If it runs at lower voltages, you should be fine.

What's the application (or should I be afraid to ask)?

Cheers -- tAfkaks

Reply to
the Artist Formerly Known as K

I think my description was inaccurate. The motor specs are:

Rated RPM: 4500 or more @ 3VDC Direction of rotation: dual Operating voltage: 3VDC @ 45mA Operating voltage range: 2.5VDC - 3.8VDC (max.)

So I guess I don't understand why I would be out of luck at 3 V but not out of luck at 1.5, since both are lower than the 5V output of the port.

I also don't know which of the two concepts I listed was correct with regards to PWM. :-/

We have a belt that generates signals indicating nearby objects and people; we are making a vibrating device to inform the user when something or someone comes close. I know my microprocessors, but I'm not really an electronics guy so the motor control is confusing me.

-Zac

Reply to
Zac Bond

You wouldn't be out of luck at 1.5 if the motor will run at 1.5 volts.

Based on your description, however, it won't run below 2.5 and shouldn't get more than 3.8. Think of PWM as varying the effective voltage that gets to the motor. Thus a 50% duty cycle (assuming a 5-volt signal) effectively delivers 2.5 volts to the motor coils. Do the math to determine the max duty cycle to get an effective 3.8 volts.

Basically, you will just be varying the effective voltage at the motor by changing the duty cycle of the applied power. It looks like your voltage range runs between 2.5v (minimum drive) and 3.8 (maximum). Thus you could vary the duty cycle of drive signal accordingly.

It should be noted, however, that you really can't drive a motor directly with a microprocessor signal (at least the models I'm familiar with). To begin with, 45ma is probably more than an micro output pin can source or sink. Also, motors (even small ones) tend to play havoc with the power supply, causing sags on startup and nasty fly back voltage spikes -- consider using a driver circuit of some sort, and have the micro interface to the driver circuit, rather than the motor. You could also have the driver circuit regulate the power to the motor such that the circuit provides a maximum of 3.8 volts to the motor -- this keeps you from accidentally frying the motor.

If you don't want to design the circuit yourself, there are a number of motor driver ICs on the market -- look around for devices that operate at lower voltages (don't know of any off the top of by head, but I'm sure they exist).

Hope that helps -- m

Reply to
the Artist Formerly Known as K

Okay, Zack. First, your motor is rated for 3 volts. It will indeed run at a higher voltage, but with a greatly shortened lifespan due to overheating. Whatever you do, you will get the best torque and performance if you operate the motor at 3VDC. Operating it at a lower voltage means getting considerably less power because the power equation has a square term in it. If you cut the voltage in half, for instance, the motor's resistance will ensure that the current decreases in proportion. Since power can be expressed as I^2 R, then this means that at half voltage, you have half current, and half squared is one fourth. This dictates that at 1.5 volts, you can expect only one fourth of the power output from this motor. In a nutshell, try to stay close to 3 volts. Now for the CPU output issues. I hope you are not trying to directly drive a motor from a processor output terminal. Of course not, you surely know better than that. Motors have many things going against them when you try to control them electronically. One of the biggest issue is that motors are inductive devices and they generate huge spikes of noise when they run. A small 6 volt DC motor in a toy car can generate 200 volt spikes when running. Placing a small ceramic capacitor right at the motor terminals can get rid of a great deal of this, and adding an MOV can snub anything that leaks through. Then you want a ferrite bead on the motor lines to prevent spikes from getting back to the drivers or power system. The output of your CPU will likely only be able to source or sink about a milliamp or so current-wise. You will want to use a driver such as a power MOSFET or H-bridge to turn the logical output into a beefier, low-impedance motor driving signal. The processor output will provide the control only and not directly drive the motor at all. Assuming that you have properly interfaced the motor to the CPU pin in question, and that you have your motor properly isolated so its electrical hash will not reset or destroy your processor, then you must provide a 3 volt supply to the driver. This means that your processor will create the logic levels, the signals from the CPU output pin will drive only the H-bridge or driver circuit, and the motor gets its power from there. Now for that 60% duty cycle thing. NO. That's it in brief. Don't do it. You see, you are still driving the motor at 5 volts, not 3 volts, when power is there. What you really, truly want to do is have a 3 volt supply for your motor and to use the H-bridge or driver to supply that 3 volts to your motor. Now you can use the full range of duty cycles from zero to 100% without problems. The whole idea behind PWM is that you apply the full rated working voltage to the motor at all times that it is running, so that full torque is available to the load that your motor is driving. By varying the duty cycle, you are allowing the motor to apply that torque at all times it is operational, but you are getting different run speeds because the motor is only on for a fraction of the total time. So what you truly want is an independent 3 volt supply (which could be derived from your existing power supply), a driver circuit that accepts logic from your CPU, and the proper noise isolation to make the motor play nicely with your digital electronics. I hope this is helpful.

Cheers!

Sir Charles W. Shults III, K. B. B. Xenotech Research

321-206-1840
Reply to
Sir Charles W. Shults III

Motor specs are nearly always generated for the original customer of the motor, or if the motor is general purpose, for typical applications that the motor manufacturer wants to target. "Operating voltage" may or may not be true extremes; 3.8v may be the maximum spec'ed for a given application, not for the motor. Remember that for consumer product applications many components are de-rated for a safety factor.

Let's assume the motor is replaceable, and you can experiment. You can determine if the motor will operate down to 1.5 volts with a flashflight battery. You can test upper range by using multiple cells, or a variable power supply. You know the voltage is too much if the motor gets hot.

There are very few H-bridges or motor drivers for 3V motor supplies. More typical are 4.5 volts, and above, though keep in mind that if the motor controller is bipolar, there is a certain voltage drop through the bridge anyway. As I recall, you get about 3 volts to the motor from a

4.8 volt battery pack, when using an L293D style motor bridge.

If this motor will be turning in one direction only, you can make a drive yourself with a small transistor. The voltage drop through the typical transistor is about 0.7 volts. It doesn't look like this motor draws much current, so the transistor doesn't need to be a honker.

Consider a 555 timer for your PWM. There are schematics that show how to drive a small motor (one direction) using PWM and a 555 timer, including the drive transistor.

-- Gordon

Reply to
Gordon McComb

This makes much more sense. The argument I was given was that the .6 duty cycle would make the 5 V "average out" to 3 V, which didn't seem to make good sense.

FWIW, most of our group are software people with only vague background in electronics from years ago (the meat of the project is based on a program written in Matlab). Our lone electronics guy is in charge of the driver circuitry, so I'll pass your comments on to him.

Thanks for the clear explanations!

-Zac

Reply to
Zac Bond

Hi Zac

I am a newbie as well, and am interested in basic PWM to drive two small DC motors ( 3 - 12 V ) for my first robot project. I am learning to use use a motor driver chip ( Texas Instruments L293DNE ) with a microcontroller. The chip takes an input voltage from the microcontroller from 4.5 to 7V, and to supply the motors, the driver takes up to 36V.

What this means is that you have two voltages going into the motor driver - one to power the driver, and another to power your motors - so you are not limited by the 5V output of your microcontroller.

Texas Instruments gives these chips away as free samples ( they are very cheap to buy also )! You can download the data sheet from their web site.

I have managed to supply my motor ( not under full load ) from 1.5V up. When powering your motors through the driver, take into account that about 2V will be dropped across the chip, so you need to factor this in.

Cheers

Dale

Reply to
DS

I think what they mean is that the motor voltage is effectively at whatever equivalent voltage is being supplied by the PWM signal, although in reality the motor coils are seeing brief pulses at 5 volts. Note that this may or may not be a problem for a motor rated at 3.8v max

-- in my experience you can usually get away with this, but if you decide to drive the motor at 5 volts with a reduced duty-cycle signal, you can check for motor heating.

Of course, I'd still advise keeping the maximum voltage down to the rated max, since were you to accidentally drive the motor with a PWM signal at 100% duty cycle (full 5 volts) the odds of damaging the motor would rise considerably.

Reply to
the Artist Formerly Known as K

From this description, is the motor a pager buzzer motor with a weight attached to the shaft? if it is then you're overcomplicating things. Just build a transistor or MOSFET switch to run the motor from a signal line from the MCU. Hold the MCU pin at one logic level to run and the other to stop the motor running.

If you want to avoid PWM all together then use a transistor switch and three

1N4001 diodes in the motor power path to drop the voltage (about 0.7v drop across each diode) this will supply approx 2.9v to the motor from a 5v supply line. You will also need one more diode connected across the motor terminals to protect the switch from back EMF as well (silver band to postive, I can never remember wether the anode or cathode on a diode is that end on the diode case).

Chris

Reply to
Chris Dugan

Doh! I was assuming he was trying to actually vary the amount of vibration delivered, not simply regulate the voltage to the motor.

Reply to
the Artist Formerly Known as K

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.