# Basic PWM question

• posted

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

• posted

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

• posted

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

• posted

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

• posted

Cheers!

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

321-206-1840
• posted

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

• posted

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

• posted

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

• posted

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.

• posted

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

• posted

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

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.