2020-10-23 04:38 AM
I want to control servo movement with potentiometer. I'm using ADC and getting the pot value. But i don't know how to control the pwm with this value. What should i use?
Thanks in advance.
Solved! Go to Solution.
2020-10-23 06:19 AM
I don't know, I haven't seen your code. Check the pulse width signal with a scope.
Scaled properly, doing the math in the right order there is no reason one shouldn't be able to have linear motion over the whole range of the servo.
Figure out where the exact physical limits of the servo are with respect to the pulse width (1-2ms) with 1.5ms dead center is a notional range for them, but it might be tighter.
Either look at the technical documentation for the specific servo, or use the scope to determine the upper/lower bounds of motion, and then figure that into your scaling equation so the full scale on the pot relates to fully physical range of the servo.
2020-10-23 05:11 AM
Set up a TIM in PWM mode, period of 20ms, and have the ADC value translate to a 1 to 2 ms pulse length
2020-10-23 06:11 AM
I did the servo movement but there is just 1 issue left. When i start to rotate the pot between 0-1009 value, at 0-150 and 850-1009 ; the servo is not moving. Is it because of the potentiometer or any issue in my codes?
2020-10-23 06:19 AM
I don't know, I haven't seen your code. Check the pulse width signal with a scope.
Scaled properly, doing the math in the right order there is no reason one shouldn't be able to have linear motion over the whole range of the servo.
Figure out where the exact physical limits of the servo are with respect to the pulse width (1-2ms) with 1.5ms dead center is a notional range for them, but it might be tighter.
Either look at the technical documentation for the specific servo, or use the scope to determine the upper/lower bounds of motion, and then figure that into your scaling equation so the full scale on the pot relates to fully physical range of the servo.