DC motor angle detection

Thread Starter

moomo

Joined Jul 14, 2017
41
I would like to determine and control the angular displacement of a small 3-6 V dc motor for use in a robot arm project. I have read that an encoder can be used. I have seen that you can get the mouse scroll wheel encoders on eBay for really cheap, any ideas how many degrees accuracy this would give? Does anyone know of something that would be more suitable?
 

cmartinez

Joined Jan 17, 2007
8,761
I would like to determine and control the angular displacement of a small 3-6 V dc motor for use in a robot arm project. I have read that an encoder can be used. I have seen that you can get the mouse scroll wheel encoders on eBay for really cheap, any ideas how many degrees accuracy this would give? Does anyone know of something that would be more suitable?
Far more suitable would be using a rotary type in-a-chip magnetic encoder, such as the AS5045. How experienced are you in MCU programming?
 

MaxHeadRoom

Joined Jul 18, 2013
30,659
For closed loop positioning control of a DC motor you would need a PID loop system.
The resolution/rev of a slotted/window A/B quadrature encoder is dependant on the number of slots, this can be magnified X4 by counting each edge of the slots.
Max.
 

LesJones

Joined Jan 8, 2017
4,511
If the total angle of rotation was less then about 250 degrees you could use a potentiometer. If it was more than this but less than 10 revolutions (3600 degrees) you could use a 10 turn potentiometer.

Les.
 

Thread Starter

moomo

Joined Jul 14, 2017
41
Would that allow for quite precise and repeatable measurements? Could one of those little trimpots be used or would a different type be needed? I have a laser cutter and I am wondering if it would be possible to cut out an encoder pattern directly on a toothed gear wheel, anyone done that before?
 

LesJones

Joined Jan 8, 2017
4,511
The accuracy depends on the quality of the pot. This is the method is used for model servos. I have never used a laser cutter so I don't know how good an encoder you could make . There are many optical encoders sold on Ebay. You can also find them in printers. One thing you have to consider about a normal quadrature encoder is that they do not give an absolute position. When first powered on the have to be moved to a reference position which may be a third sensor on a track that gives one pulse per revolution or a mechanical stop. There are absolute encoders such a grey scale uncoders but these are more expensive. Many yeas ago I made one with 8 tracks which gave 256 positions.

Les.
 

RichardO

Joined May 4, 2013
2,270
Could one of those little trimpots be used or would a different type be needed? I have a laser cutter and I am wondering if it would be possible to cut out an encoder pattern directly on a toothed gear wheel, anyone done that before?
The problem with trimpots is that they may not be designed for a long life -- that is they have a fairly low limit to the number of rotations they can withstand before failing.

I would think the Laser cutter would work if the encoder disc is large enough. Don't expect to do details less than a few tens of mils (1000ths of inches). This may not be a problem since you will be likely be using through-hole IR emitters and detectors.

Keep in mind that encoders only do relative position. Without detecting a home position you do not know the absolute position.
 

Thread Starter

moomo

Joined Jul 14, 2017
41
I went and ordered a few potentiometers, encoder and the mouse wheel encoder. Hopefully I can get something working that has enough accuracy and repeatability.
 

MrChips

Joined Oct 2, 2009
34,810
What is your total angle of rotation?
For 180° absolute encoding and fine resolution you can build the equivalent of two parallel plate capacitors similar to RF tuning capacitors. For continuous, relative motion, you can make the capacitor plates like encoder disks. This has been used in front panel dial controls.
 

cmartinez

Joined Jan 17, 2007
8,761
I have a laser cutter and I am wondering if it would be possible to cut out an encoder pattern directly on a toothed gear wheel, anyone done that before?
Yes, I've built encoders by cutting their slotted wheels using a cnc router, for instance. But you haven't told us your precision requirements yet.
 

Thread Starter

moomo

Joined Jul 14, 2017
41
ah thanks, ill look into that. Im not sure what the angles will be yet but probably 270 degrees maximum. On youtube I have seen small 'CNC' machines that use servos but the results are quite choppy. I am looking to get a smoother result like you would get by using steppers. I have bought some tiny steppers to try but Im not sure if they will have enough torque.
 

MaxHeadRoom

Joined Jul 18, 2013
30,659
ah thanks, ill look into tha On youtube I have seen small 'CNC' machines that use servos but the results are quite choppy. I am looking to get a smoother result like you would get by using steppers.
Don't know what Utube sites you visited, but there is no comparison between between steppers and servo's in a CNC environment, any sign of 'Choppy' would be totally unacceptable.
Max.
 

Thread Starter

moomo

Joined Jul 14, 2017
41
I am trying out the idea of connecting a 10K potentiometer to the shaft of a dc motor. When I connect the potentiometer to the Arduino the output value on the serial monitor is from 0 - 1023. The potentiometer only rotates 270 degrees. Am I correct in thinking that this would give me a resolution of 270/1023 = c. 0.26 degrees / change in analogue input value. From what I understand a stepper motor with a step angle of 1.8 degrees using 1/16 micro stepping would give c 0.11 degrees/microstep. Those values don't seem too far away from each other.

The idea of attaching the potentiometer to the motor shaft if basically a servo (minus the gearing - should that not increase the resolution?). Why is it that hobby servos used in pen plotter projects etc seem to have poor resolution compared to those that used stepper motors? Are the ranges of the potentiometers used in servos more limited? Can the resolution of a hobby servo be improved?

Many thanks for your help. Much appreciated.
 

cmartinez

Joined Jan 17, 2007
8,761
From what I understand a stepper motor with a step angle of 1.8 degrees using 1/16 micro stepping would give c 0.11 degrees/microstep. Those values don't
I'm not sure you'll be able to obtain such fine resolution out of a pot. Pots are normally not very accurate devices (linearly speaking) and their wipers tend to skip and rattle a bit while they're in motion, which would make for a noisy output (that perhaps you could filter a bit)

I guess you'd have to set it up, try and see if it works for you.
 

Thread Starter

moomo

Joined Jul 14, 2017
41
Sorry, yes I am just talking about the cheap servos. Ok, ill report back with the results good or bad.
 
Top