pulse feedback for pwm servo positioning
boone
Posts: 17
in BASIC Stamp
Hi everyone, I'm a experienced electronic tech making a driver for the parrallax standard servo but need to incorporate a pulse feedback to control
The servo position and increase stability. Anyone else experimenting in this type of feedback?
The servo position and increase stability. Anyone else experimenting in this type of feedback?
Comments
By doing this the rpm of the device is more accurate. The feedback must be inputed to the bs2 and made into a correction for the pwm drive out to the standard servo. I'm getting back into the program methods of microprocessors
but need more study to get the full extent of their flexibility of these processors. They really are neat. Boone
Sounds like you want some sort of P.I.D. loop.
https://en.wikipedia.org/wiki/PID_controller
Often proportional control is enough to get motors to behave nicely.
You'd want to adjust the servo proportional to the difference between your target speed and your currently measured speed.
Here's some pseudo code.
The loop should probably run at 50Hz since this is how often you need to pulse the servo.
The value of PROPORTIONAL_CONSTANT is determined experimentally. If the speed of the motor oscillates, then this constant is likely too large.
I don't program the BS2 enough to recall all the syntax for pulsing servos and pausing execution.
What's the lowest value you expect what's the highest value you expect?
Does the motor speed up when the servo is sent longer pulses? Or do the shorter pulse lengths cause the motor to speed up?
It would be good to know what servo pulses you expect to send (shortest pulse and longest pulse). It would be good to know what values you expect to read when measuring the tack pulses at these extremes.
Motor speed between 700 - 4000 rpm. The tach puts out 6 pulses per rev giving 4200 - 24000 rpm that's 70 - 400 Hz
Feedback Signals. So at a position duration of 700 feedback should be 70 Hz up to a duration of 1100 a feedback of 400 Hz should be no error signals. Let me know your thoughts on this. Thank you so much for you attention.
I think a program which reads the pulses and displays the speed would be a useful starting point.
I don't use Basic Stamps much but I think the PULSIN command may be what you want to use. I think there are several different ways PULSIN can be used so check the manual to see how it should be used in this case.
If you post the code you write using code tags it will be a lot easier for us to read.
Click on "Quote below this text to see how I entered the code tags.
I think some code to display the value of the pulse read from tachometer would be a good start. As I said, don't worry about converting the raw pulse value since you'll need to convert this to the appropriate servo pulse later and you might as well make the conversion in as few of steps as possible in order to minimize rounding errors.
Maybe someone following along will recommend some BS2 code for reading a tach? If no one has a better suggestion, I'd suggest starting with the PULSIN command.
Syntax manual and that has helped a lot, unfortunately my signal generator had some problems so I decided to move to this shifter program until I receive my replacement gen.
learn.parallax.com/pid-control
I bet there's lots of great info in it.
To add the ID this. Unfortunately my bs2 went down. Started acting funning thought it was a cable switched didn't help, switched batteries, still no good, even took my other computer and downloaded bs2 software but no good. I believe it's the USB input chip. We'll see how things go with Parallax. Boone