Using encoder to control motor position DCC1000_0

Supporting 2.7 and 3.2+
Post Reply
helly
Fresh meat
Posts: 1
Joined: Fri Sep 07, 2018 1:54 am
Contact:

Using encoder to control motor position DCC1000_0

Post by helly »

Hi.
I'm new to phidgets. I'm a programming noob too.

I've got a DC motor and the DCC1000_0 controller. The encoder is connected to the controller.

I've used the example code to create programs to view the position (from the encoder) and to move the motor.

But I want to the motor to spin xxtimes and then stop. And I want the encoder to read the rotations and stop the motor when it has reached a give number of rotations.

How? The encoder is not connected to the VINT hub, but to the controller it self.

PID would also be nice, but I want to start out slow..
User avatar
mparadis
Site Admin
Posts: 660
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

Re: Using encoder to control motor position DCC1000_0

Post by mparadis »

Are you asking how to open the DCC1000's encoder?

Since the encoder is part of the DCC1000, you will select channel parameters that point toward the DCC1000. (The serial number of the VINT Hub it's connected to, and the hub port that the DCC1000 is on) Your program already knows that it's looking for an encoder, since the handle you're trying to open is of type "Encoder". Since the DCC1000 has only one encoder, you don't have to specify channel (but if you do, you should specify "0").
jdecoux
Labview Developer
Posts: 180
Joined: Mon Nov 13, 2017 10:20 am
Contact:

Re: Using encoder to control motor position DCC1000_0

Post by jdecoux »

If you are trying to control the position of a DC motor, you may find our video on how to use the Motor Position Control feature of the DCC1000 helpful. To help understand how to convert encoder units to your own units, you may first want to watch our video on Rescale Factor, and how to use it.
zaneytop
Fresh meat
Posts: 4
Joined: Thu Mar 12, 2020 6:25 pm
Contact:

Re: Using encoder to control motor position DCC1000_0

Post by zaneytop »

I'm also new to using Phidgets.

I watched the rescale video however, I am using a DC motor with an encoder - not a stepper motor.

This is my hardware:
DC motor - https://www.phidgets.com/?tier=3&catid= ... prodid=281
Motor controller - https://www.phidgets.com/?tier=3&catid= ... rodid=1117


How do I find rescale factor without knowing a default step angle (like in the video)?


The closest thing I found to a "step angle" on the motor's data sheet is the "Backlash error" of 3 deg. I also know the gear ratio of 51:1 but I don't see how to translate this into a rescale factor.

Thank you for your help.
Last edited by zaneytop on Tue Apr 21, 2020 4:41 pm, edited 1 time in total.
User avatar
mparadis
Site Admin
Posts: 660
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

Re: Using encoder to control motor position DCC1000_0

Post by mparadis »

That video was doing the rescale factor calculation based on a stepper motor, but your motor is a DC motor which doesn't have a step angle.

In your case, the encoder on the motor you linked has 360 CPR (counts per revolution), which means 360 full quadrature cycles per rotation. Your encoder interface (The one on the DCC1002) has 4x resolution, which means it generates four pulses for each quadrature cycle. This means that each rotation of your motor will result in a position change of 1440 on your encoder. So if you change your rescale factor to 360/1440 (or 0.25), your position will be measured in degrees instead of encoder pulses.
zaneytop
Fresh meat
Posts: 4
Joined: Thu Mar 12, 2020 6:25 pm
Contact:

Re: Using encoder to control motor position DCC1000_0

Post by zaneytop »

Thank you mparadis for your reply.

Your math makes sense, however, when I set 0.25 as my rescale factor in the Position Controller GUI and type in 360 as my Target Position (previously set to 0), the motor moves maybe 10 deg - I was expecting a full 360 degree rotation.

I found a rescale factor of 0.005 combined with a Target Position of 360 (previously set to 0) gets me, what looks to be, a full rotation. If 0.005 is my rescale factor, that would mean 200x resolution - which seems ridiculous.

I took a look at the US Digital E4P datasheet and saw that there are different variations of this encoder so I will have to take your word for it that it is the 360 CPR at 4x resolution model. However, these numbers are not working for me.

Can you help me figure out the rescale factor to achieve (1) full rotation when I type in 360 as my Target Position?
User avatar
mparadis
Site Admin
Posts: 660
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

Re: Using encoder to control motor position DCC1000_0

Post by mparadis »

Oh right, I forgot the motor gearbox. The number I gave you is for the rotation and of the rear shaft. The drive shaft is geared down by a factor of 51, so if you divide 0.25 by 51 you should get the right answer. If you want to be even more precise, use the actual gear ratio ( 50 801⁄895 ) instead of the rounded value of 51.
zaneytop
Fresh meat
Posts: 4
Joined: Thu Mar 12, 2020 6:25 pm
Contact:

Re: Using encoder to control motor position DCC1000_0

Post by zaneytop »

Thank you again. I completely forgot about the gearbox too :oops:

FYI for anyone viewing this thread and using my exact hardware (see above), the correct rescale factor is 0.004912. This means when you set your Target Position as 360, the DC motor will turn 360 degrees, or one full rotation.

The math:
(1 output revolution/ [50+801/895] input revolutions) * (360 deg/rev) * (rev/ 1440 pulses)
= (0.004912 deg/pulse) output shaft
Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests