using PWM to generate voltage for a vibrating motor

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

using PWM to generate voltage for a vibrating motor

4,886 次查看
bespenschied
Contributor III
I have read a few articles on using a PWM to control a device's voltage but I am having a few difficulties implimenting it. I have a small vibrating motor I removed from a broke cell phone. They run on ~1.2v dc. My circuit (a MC68HC908KX8 MCU) runs on a 5V or 3V dc supply. I don't want the extra expense of a separate voltage regulator for the motor and the MCU. I experimented for a while with different PWM duty cycles and found one that actually worked for this motor. The articles I read mentioned a Low Pass Filter in line with the PWM but none of them explained how to determine the values for the R/C.  The only one I found had a 20 page article that I did not understand. I think the author actually proved the existance of aliens in this article. Although I know a lot about digital circuits I never took the opportunity to study low pass filters in depth.
 
The problem I have is that I know I have just guessed at the values for the PWM and the low Pass filter and I do not want to burn up the motor. I also have trouble now and then with my interrupt routines ONLY when the motor is running. I assume I have created some interference that needs to be corrected. I also have the motor connected directly to the PWM pin port and not thru an opto-isolator.
 
As always I do not mind research myself. If someone would even point me in the right direction. I am a quick study and very willing to learn.
Thanks!
 
标签 (1)
0 项奖励
回复
3 回复数

1,165 次查看
bigmac
Specialist III

Hello,

If your motor current is low enough to drive directly from the PWM pin, you will still require to "catch" both positive and negative transients generated by the motor inductance - as a minimum you would need a pair of Schottky diodes connected to the pin to prevent voltage transients above Vdd and below Vss.  They need to be Schottky type, with lower forward voltage, so they conduct prior to the intrinsic diodes within the MCU.

An alternative might be to use a suitable bipolar transistor or MOSFET device to buffer the motor, but you would still need the transient protection diodes at the motor connection.  I don't think opto-coupling will be necessary for such a small motor.

Regards,
Mac

 

0 项奖励
回复

1,165 次查看
peg
Senior Contributor IV

Hi,

If you research this too much you will probably start to believe it will never work or that aliens exist or both!

It will! Motors repond very well to running on PWM. Forget a filter. Just run it at 0 to 25% PWM at somewhere between 1 to 20 kHz.

I think the best thing would be to optocouple the PWM signal into your motor drive circuit. Also diode isolate the power supply to the motor section.

This should get you spinning (or vibrating)!

Regards Peg

 

0 项奖励
回复

1,165 次查看
rhinoceroshead
Contributor I
As for determining the PWM duty cycle, all you have to do is get the voltage you want (1.2 volts) and divide it by the number of volts you have (5 volts) and that will give you the PWM duty cycle that you need.  1.2/5 = .24 which you then have to scale to the proper 8 bit value - which means multiplying by 255.  So .24*255 = 61 (which is 3D in hex).  So write 0x3D into you duty register and tweak from there (assuming a 5 volt supply).
 
A single-pole, low-pass filter will pass frequencies lower than about 1/(2*PI*R*C).  But it's not quite that simple since the resistor you use for your low-pass filter will rob your motor of current that it needs to run - and if you lower the resistance in your filter so that it doesn't block current, then the resistor will start wasting power as heat.  Usually you would use an inductor instead of a resistor since it doesn't consume power - but conveniently, there is already an inductor in the motor since it uses a coil of wire to generate a magnetic field.  So the motor itself already acts as a low pass filter.  There exists a threshold in PWM frequency such that the inductance and ESR of the motor will do a nice job of smoothing out the pulses without a filter.  The more inductive the motor is, the lower the PWM frequency you can use.  But that inductance will also send out transient voltage spikes back to your motor driver - so you should use catch diodes or transient voltage suppressors if necessary.  But it sounds like in your case, you have a tiny motor and you probably don't need anything too crazy.  What I would do is connect the motor to a function generator and an oscilloscope and see what PWM frequency gives a smooth voltage, then measure how much current the motor wants to use.  Then you can select an appropriate motor driver if you haven't already.  I would be more concerned with burning the microcontroller's PWM port than I would be about burning out the motor.  But that depends on how much current the motor is asking for.  If it's well within the uC datasheet's specifications, then you are probably fine.  You maybe should still use a catch diode on the microcontroller port so the PWM pin doesn't try to go too far negative.  Again, an oscilloscope would help you determine whether or not you are being mean to your microcontroller.
 
If you're interested in efficient voltage conversion, try an Internet search for a "Buck Converter".  It's a very simple circuit, and there are lots of websites that explain it very well.

Message Edited by rhinoceroshead on 05-10-200604:46 PM

0 项奖励
回复