Program a DC motor for constsnt speed after load applied?
Program a DC motor for constsnt speed after load applied?
(OP)
Trying to develop a program that can keep a dc motor at a constant speed after applying three random weighing loads, and also have a kill switch for a load that is entirely to heavy for the motor. Using a basic stamp 2 and trying to program using PBasic. I am new to this and can use help in any means. Thank you.





RE: Program a DC motor for constsnt speed after load applied?
If I remember correctly, the Basic Stamp has a PWM output that can chop a supply fast enough to make a DC motor run okay at a programmed fraction of its maximum speed. The actual speed developed would still depend on the load. No way is a Basic Stamp fast enough to close the loop and provide constant speed regardless of load, even if you had a way to measure applied load or actual speed.
Mike Halloran
Pembroke Pines, FL, USA
RE: Program a DC motor for constsnt speed after load applied?
RE: Program a DC motor for constsnt speed after load applied?
1. Get H-bridge e.g. 4 MOSFETS,
vcc
|----------|
q1 q3
|---motor--|
q2 q4
|----------|
gnd
2. Connect the output of stamp pwm to the gates of q1 & q4,if you chop these but keep q3 & q2 off, the motor will spin one way, if chop [pwm] q3 & q2 but keep q1&q4 off you
reverse. The pwm width will control the speed. I neglected to mention that the top FETs gates need their own floating supplies or charge pump or booststrap to work.
3. To get constant speed, you'll need to incorporate a
controller like a PI or PID, or just a compensator might work for simple stuff. TO control speed you need to measure the speed and compare it to a command [this is command minus actual] then feed this into the pi controller. There is a difference equation for discrete controller. To control the motor, it's best to have a current inner loop w/ another faster pi. Measure the current thru return and compare against the pi generated signal from your speed command. The results is sent to the motor controller.
4. One can write a whole book on the subject--you can short cut this by getting motor driver ICs or buying a drive as was suggested. That way you can focus on the speed controller.
RE: Program a DC motor for constsnt speed after load applied?
One way to regulate the speed of a DC motor without speed feedback is to use IR compensation. Measure the current drawn by the motor, multiply by a factor and use the result to increase the output voltage slightly. This type of speed regulation will usually result in a load regulation of 2%.
The reason this works is that the armature circuit of a DC motor very closely approximates a voltage generator in series with a resistor. The voltage generator output is determined by the armature speed. What you are compensating for is the equivelant series resistance of the armature, thus the name IR compensation.