I want to put together a fairly high torque motor servo for steering a riding mower. I have some suitable gear motors and with arduino PID code or similar and a motor driver it should be possible to construct something like a common RC servo but more torque (and it can be slower). I realize gearing and such is available for servos but wanting to learn this and do it on a low budget. Most google hits are controlling a standard RC servo with an arduino. Haven't found anything with code but before I started my own I wanted to see if there was already some code available. I have done some arduino coding but not super experienced. I do know power electronics and about PID control in general.
You might search on youtube for "wiper motor servo" and see some examples of "giant servos".
What's your plan for position feedback?
Feedback will be a pot (potentiometer). I need 1.5 - 2 turns on the output shaft so will have to use a multiturn pot. 10 turn are pretty common. May try to find a multiturn that is fewer turns. But my main question is the control. I can handle the power stage. Will write the software if I need to but was hoping to find something close.
"Will write the software if I need to but was hoping to find something close."
How do you plan to electrically control the motor? That would probably provide for the type of code needed.
if you've read about servos, you know that a typical RC srevo is controlled with a pulse that ranges from 1 to 2 msec.
if you've read about the electronics of an RC servo, you know that receiving a pulse triggers the internal generation of a pulse based on the resistance of the position pot which is compared to the incoming pulse. The position pot is used to generate a sawtooth that is timed to generate a pulse.
The pulse widths are compared. if the incoming pulse is longer, the motor is powered in one direction for the period that is longer, changing it's position. If the internal pulse is longer, the motor is powered in the opposite direction.
are you planning on using pulses to control the position of your servo or some other mechanism?
This is a servomotor, not a hobby servo, RC PWM schemes are not appropriate when you are implementing the PID and driving the motor directly, you just provide a function to set the set-point
I'd split the implementation into subtasks.
-
A function to control the motor drive level, which takes a signed input value, and handles setting direction and drive level from this. This involves selecting an appropriate motor driver for your motor.
-
A function to map potentiometer analog input into a position value in whatever units you want to use (which might just trivially be ADC units)
-
The PID to tie this together, probably using one of the PID libraries available.
-
Tuning the PID.
I will be using a RC servo command signal. I don't see how PID is not appropriate. The pulse position simply sets the desired position. The PID control is how the motor gets to that position. May not need to be that complex for a slow system but should work fine if implemented properly.
If the Arduino is driving a servo loop it won't be able to use pulseIn() to measure input servo pulses, that would need to be done using interrupts.
An alternative to building a steering servo might be to use an linear actuator with an internal pot for position feedback to push/pull the steering linkage.