Maker Pro
Maker Pro

HELP : DC MOTOR CONTROL

J

jakob

Jan 1, 1970
0
Hello everybody

I have bought an actuator (LINAK PLC LA12)

Datasheet is here :

http://www.linak-us.com/pdf/english/la12_plc_eng.pdf

STRIPPED ACTUATOR:
I have removed the circuit that regulates the piston. All that is left
is the mechanical system between the permanent magnet DC-motor and the
piston.

MICROCONTROLLER (Keil MCB167-NET)
I have a microcontroller that is able to generate PWM-signals. The
microcontroller also has an A/D-port, which I will use to gain
feedback-information that is necessary to regulate the position of the
piston.

INTERFACE:
Between the stripped actuator and the microcontroller, there will be
an interface. This interface will consist of an amplifier and a
H-bridge. The H-bridge will control the spin-direction of the motor
based on a PWM-signal from the microcontroller. I have to build this
circuit.

SOFTWARE FOR MICROCONTROLLER:
I need to make a software algorithm that regulates the position of the
piston according to a desired, pre-defined position P. The software
sets up the right PWM-signal and sends it to the interface. The
software receives information about the state of the actuator and
corrects errors by adjusting the PWM-signal. The correction continues
until the desired position has been acquired.

How do I make the algorithm? And how do I make the interface?

Thanks,

Jakob
 
H

happyhobit

Jan 1, 1970
0
Hi Jakob,

The two things you need to know to plan a route, where you are going and
where you're at.

You have to know where the piston is and where you want it to go. The
difference is called 'Error'. The Error determines how fast and in which
direction the motor runs.

You then use a formula, a PID (Proportional Integral Differential) to move
to where you want it to be. PID is a control 'filter', which helps you get
to a goal setpoint as fast as possible without overshoot or oscillation.

Do you have any feedback from the Actuator to determine its position? The
potentiometer or Hall Sensor option.

Jay

P.S. An H-Bridge uses 2 inputs, direction and speed (PWM). Checkout the
TC4424 (3Amp @ 18 volt)
 
B

Bamse

Jan 1, 1970
0
Hello Jay,

Yes, I have a potentiometer feedback that gives a signal between 0 V (start)
and 10 V (end).

How do I derive the formulas for calculating which PWM-signal I should send
from the microcontroller?

Jakob
-------------
 
B

Big John

Jan 1, 1970
0
Hi Jakob,

This could be a fairly difficult project depending on the speed and
accuracy that you are looking for. But I have done work like this in the
past so perhaps I can help a bit.

1. Select some type of feedback device to provide shaft or piston position.

2. Do a Google search on "H bridges". There are a number of sites that
have designs for the control of robots. Some of these designs should fit
what you are looking to do.

3. Also search on "PID control". For your application PI control should be
enough, but understand that this is a very big subject.

4. Get an idea of some of the physical parameters of you system including
rotational inertia, damping, motor torque constant, and the load
characteristics for your application.

The PWM output from your microcontroller just controls the voltage that
powers the DC motor. H bridges work well with a PWM signal. One thing to
look up regarding H bridges is "dead band time". This is a short period of
time between PWM pulses when all of the switching devices in the H bridge
are turned off. This prevents current "shoot through" by making sure that
the two switching devices in each leg of the bridge can't be on at the same
time.

PID control is a major subject. The classical method for getting an
equation for your microcontroller is to write a differential equation for
the piston position in terms of motor torque, inertia, system damping
(friction), and load characteristics. S space is normally used for this.
Plots are made, gains are selected, an an equation for stable control is
found. Then the equation is transformed to z space (like s but used for
discrete or digital systems). I've done this a couple of times in years
past. I takes years of study to learn control theory - and I'm by no means
an expert. If your system needs to be very accurate, fast, and has a nasty
load then you have to do the math.

On the other hand, if you application is not that critical, your system
has a lot of damping, and you don't need great speed or accuracy there are a
few ways to "cheat". I've used the pseudo code below with some success on
non-critical simple systems. It's not hard to program, but it's only enough
for you to follow the concept. A lot more lines are needed for a working
system.

Pseudo Code
----------------------
ad(2)=ad(1)
ad(1)=ad(0)
ad(0)=ad_output
feedback_position=(ad(0)+ad(1)+ad(2))/3
error = commanded_position - feedback_position
If error is between -0.1 AND +0.1 then output=0 [error is within
tolerance]
If error is (between -1 AND -0.1) OR (between +0.1 AND +1) then output=1 *
error [moderate error push easy]
If error is (between -10 AND -1) OR (between +1 AND +10) then output=5 *
error [big error push hard]
Loop back_to_top
-------------------------------

The first lines of code do a running average on the feedback signal which
acts as an integrator or the "I" in PID control. I did an average of three
here, but averaging more readings can help in some systems.

The rest of the code adjusts the output based on the size of the error
signal. No output when in tolerance, a little output when you are close, a
lot of output when far away. This is equivalent to changing the system gain
based on the error. You might also want to limit the output when you get
big errors or shut down the system if the error is clearly too large to be
normal. More then two steps are also possible.

The actual multipliers and gain adjustments have to be found by trail and
error, but you can often avoid most of the math this way.

One more word of advise, the speed of your microcontroller makes a
difference. If your system is slow and only needs to be checked and updated
a few times a second most any microcontroller will do - even a BasicStamp.
But if you need speed the microcontroller makes all the difference.
Sometimes DSP's are used for fast applications.

Good Luck,
Big John



jakob wrote in message ...
 
H

happyhobit

Jan 1, 1970
0
Hi Jakob,

A simple, non PID solution, is as follows.

Your 'pre-defined position P' should be a value between 0 and 10. (0
equals Start and 10 equals End)
Your current position is a value between 0 and 10 (volts). (0 equals
Start and 10 equals End)
The error is the difference between the two.
A plus value is one direction a minus value the other.


Sort Of Pseudo Code

Compute Error
Main Loop
Run the motor in the correct direction at an appropriate speed.
; If the error value is high you can run
the motor fast
; as it gets close to zero slow it down.
Update Error
Loop until Error equals Zero
STOP.

If you move slow, and don't require great accuracy, this will work. If you
want to be fast and accurate then you'll have to read up on PID's. As 'Big
John' said, 'PID control is a major subject'

Jay
 
Top