# DC PID motor controller

I started working on a POV clock project but instead of using a Hard disk driver, I'm trying to use a CD drive motor. This means that I need to use my own motor speed controlling mechanisms. I've just read about PID and this seems to be the way to go.

My CD drive RPM is sensed by a beam break sensor. The time taken for a given number of revs is counted and the RPM is calculated. Would this calculated RPM value be a suitable input to the PID algorithm?

You'll do better I think just measuring the speed once steady-state has been achieved
and hoping it stays basically constant round a revolution.

One pulse per revolution is going to mean having a very slow responding loop, which
would take a while to settle down.

I tried that approach but the hands on the clock flicker a bit.. I'm assuming that that's because of variations in the RPM.

MarkT:
One pulse per revolution is going to mean having a very slow responding loop, which
would take a while to settle down.

The disk is spinning at about 3000 RPM.. would that be too slow? (I'm not entirely sure what you mean by that part of your reply)

At 3000 rpm the speed will be constant enough to work as I describe - each rotation
you measure the speed and adjust your pixel clock to match (assuming you can control
that). The speed isn't going to fluctuate much from cycle to cycle due to inertia, but
will vary on longer timescales.

If you do a PID loop you need a low-noise source of information about speed, since
a PID loop amplifies sensor noise quite markedly - however at that speed a single
cycle is only 20ms which isn't a crazily low rate to run a control loop.

Perhaps use the error in rotation period as the input to the PID loop (simpler
than estimating speed). The inertia of the system will work to your advantage.

You were right about the RPM being relatively constant. I think the flicker I described was due to a problem in the Sketch I wrote.
However, I do plan to add a PID algorithm as some point.

What did you mean by "Error in rotation period" as opposed to "estimating speed" ? By speed, were you referring to linear speed of the edge of the disk?
According to my current plant, the input to the PID loop would be the RPM value of the spinning disc .. This is calculated by recording the time to complete a given number of revolutions. Would that work?

On the basis that you get one pulse per revolution (measured variable) and that you have a defined period per revolution (set-point) then you "simply" measure the difference (error - positive or negative) between the set-point and the measured variable and adjust the speed drive signal to eliminate the error.

The PID algorithm contains 3 elements P (proportional), I (Integral) and D (Differential)

If you aren't too bothered about a small degree of fixed error then only the P element is essential. The controller produces a correction which is proportional to the error - but it never eliminates the error entirely

If you want to eliminate error then use both P and I where the I factor produces a corrective factor dependent upon how long the error exists

The D factor produces a corrective factor based upon the rate at which the measured variable is moving away from or towards the set-point. For low inertia systems it isn't required. A typical use would be where a heater is being used to heat up a large mass.