Hand driven Rotary encoder turns motor fitted with encoder

I have be trying to solve this for 6 weeks and got nowhere. I am 77 years old
I have come to the conclusion writing code is beyond me. looking for some help.
Using a hand held rotary encoder to drive a motor with same model of encoder so typical master slave. using Mega board at the moment but happy to use another type if required. Maybe two boards.
Thank You

What kind of motor and encoders? What kind of motor driver?

Currently using typical small DC motor with encoder and using the the same type of motor but driven by hand
motor controller BST7960. But will be happy to change to any type.

You have elegantly described a SERVO MOTOR. But you are using a common DC motor. They are not the same and cannot work the same. Sorry.

So, you have 1 DC gearmotor and a separate encoder without the motor? Can you post a link to the encoder? Need to know the voltage, pulses per revolution and whether it's a magnetic (with Hall effect sensors) or optical type.

pulses per revolution 10. Gear ration 50 to 1
encoder VCC 5 volt
I believe its optical type
I will be removing the gearbox from the spare motor I have so the hand encoder will be the same spec as the driven motor ie 10 pulses per rotation

Sorry but I will have to leave for a few hours, I will check back if you still need help. Good luck.

thank you there's no hurry.
Paul

Yes I have two dc motors both fitted with encoders. If drive one by hand and read the encoder,use that encoder data to drive the second dc motor through Arduino.
So hand is master and the other motor is slave

may not be about coding but understanding the hardware

it would help to post the code your using

the motor you describe in post #3 is commonly used in robots. It's composed of a motor, gear-drive and encoder. The ones i've seen have magnetic encoders.

the encoders are used with a PID algorithm to either drive the motor at a specific speed or to a specific position.

when i've used other types of encoders designed to be turned by hand, i've found that i need to use an interrupt to detect all the transitions, otherwise it appears the motor is being moved back and forth.

i assume the same is true for the encoder attached to the motor, even though the wheel may be turning slowly, the motor is turning fast and the encoder needs to be monitored using an interrupt.

presumably you want the be able to turn the encoder by hand and see the wheel turn. but if the motor has a 50:1 gear drive, for each the motor encoder will need to register 50 tics for each manually turned encoder tic

presumably you want to apply power to the motor whenever the motor encoder tic count doesn't match the tic count from the manually turned encoder. but there's the possibility of overshooting and driving the motor back and forth

the PID algorithm is commonly used to avoid the overshooting by looking at the speed of the motor as it approaches the target position, reducing the voltage, even making it negative to slow the motor down so that it stops at the target position with minimal overshoot

the PID algorithm isn't that complicated, but determine the 3 parameters is not that simple

Thank you all for your response. I think I have found a solution. if it works I will post the code once i have done more testing.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.