LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

calculating rpm - dc motor with encoder

Solved!
Go to solution

Hey,

 

I am currently working (but I think this is an overstatement as I am facing a big problem at the very beginning) with calculating RPM for a project with DC motor - this is an example from the NI website - Motor Adapter for NI myRIO demo. The DC motor has encoder built-in.

senek323_0-1640202367322.png

senek323_1-1640202389283.png

I am using The Motor Adapter for NI myRIO, DC Motor/Gearbox (1:19 Gear Ratio), and of course myRIO.

 

I am trying to determine the rotational speed of the DC motor - in order to do this I am trying to go with steps:

1)Determine the number of shaft encoder counts for one revolution of the gearbox shaft output

2)Determine the gearbox output shaft angle in degrees.

3)Determine the RPM/RPS of the gearbox output shaft.

 

And I think I am a bit stuck - I found the gearbox ratio - 1:19 according to digilent website.

 

Then measuring "by hand" I found the number of encoder counts for one revolution of the sensor magnet - 12. 

 

Then I am completely stuck. I do not know how to translate these numbers into the rest. Can anyone help me? 

0 Kudos
Message 1 of 3
(2,632 Views)

Hi senek,

 


@senek323 wrote:

Then I am completely stuck. I do not know how to translate these numbers into the rest. Can anyone help me? 


You already know the encoder count. And you know the time your loop needs to iterate.

And you can easily determine the difference of the current encoder count to the count of one (or multiple) iteration(s) before by using a shift register.

 

The difference of those encoder counts divided by the time between them is your speed value: delta(count)/delta(time).

The other factors (12, 19) are just trivial math afterwards (aka scaling)…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 3
(2,602 Views)
Solution
Accepted by topic author senek323

I do not have a myRIO so I do not have any of the hardware specific drivers.  That being said, from what I can see inside there is a loop with a simple timer.  This isn't the greatest method but velocity =dX/dT.  so (change in counts)/(Change in time) divide that by 12 to get revolutions per second.  If the timer you use is a millisecond timer you will need to convert to seconds (or minutes).  Divide by another 19 to get the output velocity of the shaft coming from the gearbox. note there are missing and greyed out vis.

Dpete_0-1640210057911.png

Changing the mS timer to a metronome may be an improvement and note that your first cycle and any time you reset the counter will deliver a wrong RPS reading for that loop iteration.

I should have cleaned up the wiring more, but it is a quick example.

Message 3 of 3
(2,596 Views)