Closed loop speed controller
I need to control the speed of a 90 volt DC PM motor (1.3 Amp, 11:1 reduction, 173 RPM final), one direction rotation. I will be using a mosfet to drive it. I need to be able to vary the speed between dead stop ( or a slow crawl) and full speed (or close to it) and have closed loop control, i.e. as the motor meets varying loads, the PWM changes to keep the motor as close to the set speed as possible. I got the PWM thing down, in fact, I'll probably use DT's HPWM10 include for that part of it. I figure i'd use a hall effect sensor on the primary motor shaft so it'll be easier to read at lower RPM's. I'm guessing around 1900 RPM full speed? and using one magnet. I just don't know how to code it! i figured i'd use a 16F684 and Timer1 to get the speed into the PIC, and ADCIN to grab a 10 bit value from my speed control pot, but im lost as what to do from there.. i need some code example or thoughts on how to get the error between my ADCIN value and the motors speed and then how to adjust my PWM to keep it steady? i don't need to know how to "flash an LED" first, i use PIC's alot, i've just never tried any closed loop stuff before. Thanks in advance for any help!!