DC Motor Control with PID

gimmephone

Member
Join Date
Mar 2005
Location
Windsor, Ontario
Posts
34
Hi All,

As a project at University, I am trying to control the speed of a DC motor with PID control. I have worked a bit with PLCs and I own a Micrologix1100 so I thought that I can easily demonstrate a PID based control using the PLC in place of Op-amps, resistors and capacitors. Now I seem to be stuck as the system I plan to control would be a digital one for which I need PID control. So here goes:

I bought a 24V DC motor 0.1 Amps so that it could directly be driven by the PLC's 24V FET outputs. I have mounted an optical encoder to the shaft that gives me 500CPR (clocks per revolution). I tested the output of the optical encoder and it is a 1V sine wave type so I need a tranistor to bump these up to 24V to feed into the PLC's inputs.

I am going to attach a set of switches to 5 inputs which will act as a 5-bit binary speed input. Now is the problem part.....since I want to control the speed based on the users input using a PID loop, I plan to use a timer with resets say every 0.1 seconds....in the meantime, a counter increments each time a clock edge is produced by the optical encoder and this too resets with the timer. So, now I know how many turns occured in 0.1 seconds and the speed can be adjusted based on this setup.

My question: How can I use a PID loop with this setup specially the optical encoder....aslo, the output from the PLC to the DC motor should be a PWM signal that varies the speed of the DC motor.

Any suggestions would be more than welcome!

Thanks
 
You're trying to make an 1100 do the job of a microcontroller. I don't think you can have a PWM output. With a PLC, it's mostly analog in/out, or pulsed for SSR on a heater.
The Micrologix should have a PID function. Look it up for training and examples.
Use a comparator for your sine wave amplifier. That will square it up.
If you can't find a way to input the encoder signal into the PLC, then use a Frequency to Voltage IC after the comparator.

Not sure how to do your output.
 
gimmephone said:
I bought a 24V DC motor 0.1 Amps so that it could directly be driven by the PLC's 24V FET outputs. I have mounted an optical encoder to the shaft that gives me 500CPR (clocks per revolution). I tested the output of the optical encoder and it is a 1V sine wave type so I need a tranistor to bump these up to 24V to feed into the PLC's inputs.
I think your main problem will be counting the pulses from the encoder with a discrete input. Unless you plan on something less than 1 RPM, your pulses per second will be way more than the scan time of the PLC can handle. For every pulse you will need to see an "off to on" and "on to off" transition,thats two PLC scans. At 500 pulses per revolution of your encoder that would be 1000 transitions per revolution and your PLC would need a 1 ms or smaller scan time to measure 60 RPM accurately. Anything more than that and the PLC will miss pulses.

All that being said, I think you have one of two solutions.

1) Get a encoder with less pulses per revolution (actually a simple proximity switch off a target on the motor shaft would work resulting in 1 pulse per revolution).
2) Input your encoder into a frequency to analog converter and scale it so that 0-XXXX RPM is 4-20 ma.

I guess my other question would be: How do you plan to vary the load of the motor to demonstrate the function of the PID Loop?
 
Last edited:
I checked the specs of the Micrologix 1100 online....it has two high frequency inputs (20 Khz) which is more than enough with my encoder resolution....20Khz translates to 20,000 pulses per second which should be mroe than sufficient for my application.

I do not plan to vary the load on the motor....it is just a demonstration of speed control usind PID control with a constant load.

I guess I am stuck because I havent ever used PID loops with PLC's.....I would be grateful if you guys could just let me know a sample application and the associated code..I know the PID function is just a logic block where the 3 parameters can be varied.....I am not sure how I relate this to my output and input

thanks
 

Similar Topics

Hai friends I want to write a PLC program to control an wire extruder based on PID algorithm. I have a PLC with PID in it. I have configured the...
Replies
2
Views
7,067
Hi All Has anyone used the PID function for controlling an inverter controlled motor to give set lengths of travel through a gearbox drive i.e...
Replies
1
Views
2,080
I have a ML1100 PLC and a DC motor with a potentiometer mounted to its shaft. I want to demonstrate positional control using a PID loop(no load)...
Replies
3
Views
4,135
Kindly, has anyone tried to control Lenze servomotors with Siemens S120 drives ? Any special hints ? Have some concerns for the resolver and servo...
Replies
5
Views
231
Hey there, I just have a motor related question. I am using a 90V DC motor (https://www.motion.com/products/sku/03889770) and am controlling it...
Replies
1
Views
238
Back
Top Bottom