Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

cracked my head

Status
Not open for further replies.

dreamproject

New Member
Hi all,
Few queries on cracking (interpreting) a shaft encoders output

and other things .

The output from shaft encoders will be a train of pulses (pls. correct me if i'm wrong). If a motor running at about 3000 rpm gives 9000 pulses/sec . (assuming 180 pulses /rev) . -

1. what kind of harware reads these pulses. (adc's , pulse- counters) ?

2. Can this data be input to the PC via Parallel port and be counted by software (QBASIC) , Will the software be quick enough ?

3. How is braking implemented in DC motors for positioning - field reversal ????

4.Will a speeding DC motor shaft not overshoot its intended
position by the time encoder input is recieved and appropriate commands
given ?

5. Is PID implementation easy . I heard that designing PID's with op-amp's might result in "system instability" - quoting , I don't know what that means. :wink:

6. Any PID circuits on DC motor position control would be GREATLY APPRECIATED and so would any resources for encoder construction.

Thanks for your patience and time . And by the way guys , my

project is 25 % completed and that is dedicated entirely to you people

esp. Mr.Nigel .Without your support , I could not have got this far.

Thanks again.
 
dreamproject said:
Hi all,
Few queries on cracking (interpreting) a shaft encoders output

Use a multiturn pot on the steering wheel, you could then use the IC out of a standard small RC servo, with a bigger output stage.

You might like to look at **broken link removed** where they make a large servo using a car wiper motor!.
 
The standard method for optical encoders is called quadrature encoding. It 2 optointerupters and a disk with holes in it. The disk blocks and unblocks the interupters. The interupters are positioned to generate 2 square waves 90 degrees out of phase. This lets you detirmine the direction of roation in addition to speed.

There are a couple ways to read quadrature. Its a digital signal so you can use standard digital inputs. A microcontroller running a simple state machine is probably the easiest to put together. You could use a CPLD also. You could use the parallel prot but I wouldn't recommend it - windows might interrupt you program causing you to lose counts.

Braking is usualy done by connecting the dc motor's terminals together. Try it it will make your motor much harder to turn.

The encoder is fast enough that the delay is negligible. A good PID controller has the Derivative term tuned correctly to minimize overshoot. The derivative term works like a damper - like friction - to keep the motor from moving so quickly it overshoots. However Like friction if you make it too high your motor will move slowly.

PID implementation is fairly easy. Any PID controller can be unstable. That means that the motor will spin back and forth wildly. This happens when the Proportional term is too big. Higher P gives a faster more precice motor movement. Idealy an infinite P would give a perfect responce. In practice delays and the fact that its hard to find a motor with infinite torque mean that you can only have the gain so high before the system becomes unstable.

I would recommend using a microcontroller to implement your controller. The flexiblity of a microcontroller makes building a controller much easier. You can start with just a proportional controller and add I and D later.

A digital controller works something like this:

e is the error signal
e = (Position you want the motor to be in) - (current motor postion)

P, I, D are all constants that you detirmine through testing your system. P,I,D are all positive values.

You need to calculate the Derivative of your error signal and the integral of your error signal. The derivative can be aproximated by subtracting the last e from your current e. The integral is just all the e signals added together.

So to get your output you just do

output = P*e - D* (derivative(e)) + I*(Integral(e))

You want to use a timer or regular interrupt to change your output at a constant rate. A variable rate will make your controller unpredictable.

To tune your controller you set D and I to 0. You then increace P until the system becomes unstable drop back a little until its just barely stable. The motor will overshoot the setpoint a lot and oscillate a fair amount in this configuration. To reduce the oveshoot you increace D until the system is "critically damped". This means that the motor overshoots a little but doesn't oscillate at all. A criticaly damped system has the fastest responce with out oscillaing. You can then add a bit of I to reduce static offsets. This offset it a result of constant forces in your system, like gravity, wind resistance, and friction. With just proportional gain and derivative gain your motor will never reach the setpoint when a constant external force is applied. The Integral will gradualy build up to push against the constant force to reach the setpoint. You want to keep I relatively low because of something called integral windup. Integral windup causes extra overshoot.
 
1. quadrature encoders are normally connected to counters. circuit is very simple to build even without PLC or MCU by using just standard CMOS or TLL chips (pair of D flip-flops and up/dn coounter). This would allow LPT read it without concern on efficinecy/speed of your program. Using MCU makes sense because once you get the value you can do something with it without burden of PC (implement PI or PID etc.) Alternatively you can convert the
signal to analog (simulate potentiometar) and use it to drive the motor circuit logic directly.

2. yes but i'm not sure how good your QBasic skills are (my suck...)

3. When decelerating DC motors are genereting power so shorting DC motor
makes it act as a brake. This can be implemented in driving circuit (bridge)

4. theat's where closed loop control come in place (such as PI or PID).

5. yes (hardware) - but tuning it can be difficult and requires advanced knoweledge or software that will calculate it for you (or lots of luck). Not tuned system will not work at all, overshoot or even oscillate.
 
Thanks guys

Hi,

Thanks to everyone for their input . Any links on P,PI,PID control for DC motor positioning would be appreciated. Any tips on encoders , counter circuits ???

Thanks
 
most new designs rely on microcontroller but this is a way tp do it with discreete chips:
**broken link removed**
 
Dreamproject,
All you have to do is look up the data sheets (cannot remember if it was TI or NS) for a CNC motor controller. They already make a chip that does everything you are looking for. It interfaces with a PC serial bus, input a position and the chip calculates the acceleration/deceleration ramp using the quadrature encoder feedback to drive the motor through an H bridge to the position. The acceleration and maximum speed can be programmed.
In your case the H bridge might not handle the power but you can use it to drive an output stage.
You can also add current limiting. Their example shows how.
 
Status
Not open for further replies.

Latest threads

Back
Top