### Author Topic: Arduino: DC Motor rotating shaft with 1deg resolution and 360deg rotation  (Read 521 times)

0 Members and 1 Guest are viewing this topic.

#### pratiken

• Contributor
• Posts: 29
• Country:
##### Arduino: DC Motor rotating shaft with 1deg resolution and 360deg rotation
« on: June 18, 2018, 09:56:41 pm »
Hi Everyone,

I need a little help figuring out how to approach this.

I have a Main Shaft that I need to rotate 360 degrees once at 1 RPM, then rotate back 360 degrees at 1 RPM. I also need 1 degree resolution accuracy so that I can have the Arduino rotate it Main Shaft in 1 degree increments. Basically, I want to be able to say "rotate 15 degrees CW." or "Rotate 3 degrees CW".

What do I need to attach to the main shaft to be able to read back 360 degree rotation at 1 degree increments? I don't believe Potentiometers have that kind of capability, but maybe I'm wrong. How would you do it?

#### Ian.M

• Super Contributor
• Posts: 8103
##### Re: Arduino: DC Motor rotating shaft with 1deg resolution and 360deg rotation
« Reply #1 on: June 18, 2018, 10:50:34 pm »
If you can move the shaft at startup to seek to the zero position, then a high resolution quadrature encoder with an index pulse output would be suitable.

#### DaJMasta

• Super Contributor
• Posts: 1681
• Country:
##### Re: Arduino: DC Motor rotating shaft with 1deg resolution and 360deg rotation
« Reply #2 on: June 18, 2018, 10:56:48 pm »
Yeah, i think your best bet for accuracy and repeatability is an encoder, not a potentiometer.  Get an encoder (optical or magnetic) and put it on the worm gear's shaft, then determine how many rotations of the worm gear give you a rotation of the main shaft.  The encoder on the worm gear shaft will probably only need a few pulses per rotation for you to get 1 degree of accuracy on your main shaft, and since you have a fixed number of pulses per rotation of your encoder and a fixed mechanical linkage, you get very little drift or accruing offset.

#### Ian.M

• Super Contributor
• Posts: 8103
##### Re: Arduino: DC Motor rotating shaft with 1deg resolution and 360deg rotation
« Reply #3 on: June 18, 2018, 11:01:08 pm »
That will only work well with an anti-backlash gear on the main shaft - or a brakeband for controllable friction + software to always approach the final position from the same direction.

#### pratiken

• Contributor
• Posts: 29
• Country:
##### Re: Arduino: DC Motor rotating shaft with 1deg resolution and 360deg rotation
« Reply #4 on: June 18, 2018, 11:39:33 pm »
This is really helpful, thank you!

Would an application like this be better suited for a servo than DC motor?

#### MasterT

• Frequent Contributor
• Posts: 368
• Country:
##### Re: Arduino: DC Motor rotating shaft with 1deg resolution and 360deg rotation
« Reply #5 on: June 19, 2018, 12:52:35 am »
Perhaps, stepper motor?

#### Ian.M

• Super Contributor
• Posts: 8103
##### Re: Arduino: DC Motor rotating shaft with 1deg resolution and 360deg rotation
« Reply #6 on: June 19, 2018, 01:12:57 am »
Steppers are great if you don't need rapid acceleration and can over-size them enough that the load on them is only a small fraction of their torque at the desired speed.  However they are 'open loop' so if anything impedes their motion, they will loose steps and the mechanical position will no longer match that commanded by the software.

A real servomotor with a rear mounted encoder disk would work nicely, though you'd need an additional index sensor on the main shaft to detect the zero position.   RC servos are less suitable - if modded for continuous rotation, you typically loose the servo feedback, so you'd need an external encoder to close the loop

Smf