Velocity of MPG dial movement

More
28 Nov 2016 22:06 #83405 by an92626
I would like to determine the speed at which I am rotating the dial on my MPG. If my MPG was connected through one of the standard encoder inputs on my 7i77, then there is a velocity pin for each encoder from which I might be able to read the velocity of the MPG directly. Instead of hooking the MPG to one of the standard encoder inputs, I read that I should set the mode to 3 on the 7i77 and that would provide two 1x encoder inputs for a MPG and that is where I have hooked my MPG up, but these 1x encoder inputs do not have a velocity pin to read.

The MPG does work at this time and it will move the table, but I would like to know the velocity at which I am rotating the MPG. Units are not important as long as I can determine relative velocity from slow to fast. I tried sending the MPG count to the hal component ddt to compute velocity, but that did not work.

I could write my own hal function by saving the last count and the last time that I entered the hal function, and then when I re-enter the hal function compute the difference in counts over the difference in time to give velocity, but I do not understand how to get a time value within in the hal function.

Anyone have a suggestion of how I could do this?

Please Log in or Create an account to join the conversation.

More
28 Nov 2016 22:34 #83406 by an92626
I have another thought. Can I jumper the A, A/, B, B/, wires from my MPG to a extra encoder on the 7i77 in addition to having these wires connected to the 1x encoder inputs. Could I then use the velocity pin on the extra encoder for the data I want and still use the 1x encoder for handling my MPG operations? Would this cross connecting the A and B wires to two encoder inputs cause a problem?

Please Log in or Create an account to join the conversation.

More
28 Nov 2016 23:10 - 28 Nov 2016 23:15 #83407 by PCW
Replied by PCW on topic Velocity of MPG dial movement
The DDT component will work but will have a fairly "crunchy" output,
This is because the sample time would be the thread time (probably 1 ms for the servo thread)
so the count differences per sample on a 100 count MPG would be like
0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1 etc if turned at 1 RPS.

Depending on how fast you need a velocity signal to track he MPG,
you could run the DDT component on a slower thread (say 20 Hz)
or pass its output to a low pass filter comp.

Another possibility is to use the software encoder component which does have a
velocity pin (though it would limit the max MPG speed to about 2 turns per second at
a 1 KHz servo thread)
Last edit: 28 Nov 2016 23:15 by PCW.

Please Log in or Create an account to join the conversation.

Moderators: PCWjmelson
Time to create page: 0.070 seconds
Powered by Kunena Forum