Hello to everyone, I have a little doubt, I have one dc motor connected to one shaft and one pot connected to it too, its like a servo, but it isn't a servo, so doesn't have the control electronics, so could someone help me in how I would control it so it as good precision, it as a 7,5KOhm pot, so it would be great to have a 2-3 adc bits precision, but how?
This is a pseudo-code of what I have tinkered
While(1){
read pot using analog in
send signal via pwm to move the motor
if(pot reading=end_position){
break}
}
It will be mounted in a ratter shaky environment , its for a motorcycle, so I don't know if i could have a good precision.
Any thoughts?
You would need to make a setup similar to a servo. Read the voltage from the pot and see if it is higher or lower than what is measured when it is in the desired position. Depending on the results, move the motor (using appropriate electrical hardware) in the desired direction until the pot voltage is as desired, then stop moving the motor.
Keep in mind that drone's modified servo is still very highly geared down: it's not possible to get that kind of control out of a "naked" DC motor.
If all you need is 2-3 bits of precision on your position control, you might do better to use a stepper. Possibly with a shaft encoder instead of a pot.
Let me try to explain a little better, the motor and the pot are part of the motorbike already, and it as already an controller, but I want to have full control over that system, it is geared to, and only moves about 20-30 degrees but the motor makes a lot of full rotation, so I think it as a very big transmission ratio, thanks again for the help
What I wanted to say about 2-3 bits was that due to the shaky environment of the bike the pot will move a bit I think, so if the adc read's 200 or 202 it doesn't matter, but lets see what code can I roll.