Quote:
Originally Posted by theprgramerdude
Do you know why your first derivative potentiometer readings may be unstable? I'd recommend trying to instead take the average derivative over a period instead, so either integrate a few derivative values and divide with respect to time, or just take the readings from the potentiometer at a much slower rate (I'd recommend the first one if your ADC+Pot combo is possibly the issue and you have the compute power, it essentially equates to crude oversampling).
|
The HiTechnic prototype board has 10bits of ADC resolution.
Quote:
|
Originally Posted by Hitechnic.com;
The prototyping board update rate may be controlled within a range of 4-100 milliseconds per sample.
|
So, it can do 10 - 250 samples per second.
The code that I tested was sampling every 10 ms, or 100 times a second.
The mechanism is using a 270 degree linear 10k Ohm potentiometer, and uses almost all of that range ( > 230 degrees)
through gearing, and actual movement range.
with that, there are about 3.79259 ticks per degree on the pot.
While running, the velocity would be about 3 ticks per cycle.
The problem arises when it is not moving, as there are a few readings that have near the same values as when it is not moving.
I will try it with a longer sampling time, in an attempt to get more ticks per cycle, which should allow a better distinction between moving and not moving.
The question then becomes: how do I use the velocity readings to change the setpoint of the PID controller?
I would imagine that a timer would be needed, as I don't want it to think that it was stalled right when it started moving and thus immediately change the setpoint and not move.