Mesa 7i96 to spindle FWD/REV control

More
19 May 2021 13:05 #209502 by PCW
Set the PWM scale to 3125

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

More
19 May 2021 14:55 #209516 by mhd325ic
It works to match the high end rpm. One step closer.

Can we add offset as well? When I add the following line in hal file, it complains about unknown parameter of offset.

setp hm2_[HOSTMOT2](BOARD).0.pwmgen.00.offset 0.027

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

More
19 May 2021 15:09 - 19 May 2021 15:10 #209517 by PCW
There is no offset parameter for the PWM gen
but you can do it by adding a scale component
or if you want to get really fancy, curve-fit
by using the lincurve component, but note
that actual spindle speed matching is rarely
important if its with 20% or so
Last edit: 19 May 2021 15:10 by PCW.

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

More
19 May 2021 18:22 #209533 by mhd325ic
I setup a lincurve as lookup table from 0-2000 and replaced the net line in the hal file
net spindle-speed spindle.0.speed-out => hm2_[HOSTMOT2](BOARD).0.pwmgen.00.value

with the following two lines
net spindle-raw spindle.0.speed-out => lincurve.0.in
net spindle-corrected lincurve.0.out => hm2_[HOSTMOT2](BOARD).0.pwmgen.00.value


Now, only the spindle can only excute CW rotation and no CCW rotation. Is it because of the negative sign in spindle.0.speed-out?

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

More
19 May 2021 18:40 #209535 by PCW
Does your lincurve data include negative values?

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

More
19 May 2021 20:05 - 19 May 2021 20:31 #209543 by mhd325ic
no, it is only in the rang of 0 to 2500. Can we setup in the way so that only the the absolute value go through the lincurve lookup table?
Last edit: 19 May 2021 20:31 by mhd325ic.

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

More
19 May 2021 22:33 #209561 by andypugh

no, it is only in the rang of 0 to 2500. Can we setup in the way so that only the the absolute value go through the lincurve lookup table?


It would be simpler to extend the lincurve into the negative directions. And are you sure that the curve is the same shape in reverse?

Another option might be to close the loop, and use PID.

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

More
20 May 2021 00:53 #209590 by mhd325ic
I used 12 points in the lincurve for the positive part. I guess that I need to squeeze it into 8 points in order to mirror to the negative side under the constraint of 16 points in lincurve. I will give it a try tomorrow.

Close the loop is an ultimate solution for sure. I will live with lincurve for a while until I figure out how to fit an encoder to my spindle

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

More
20 May 2021 16:29 #209663 by mhd325ic
Hi Andy,

I did mirror the lincurve into the negative direction. Now everything works like charm. Thanks for the helps from everybody!

BTW, what is the multi-element desgined for in lincurve? I got confused because lincurve is a 1D mapping function, say X->Y. How could you extend it into multidimensional linear interpolation.

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

More
21 May 2021 18:27 #209773 by andypugh

BTW, what is the multi-element desgined for in lincurve?


Like all the other HAL components, if you want more than one, you load them all at the same time. But they are independent instances.


How could you extend it into multidimensional linear interpolation.

That would be a new component. Entirely do-able but pretty painful to put the numbers in to in HAL.

I have VBA code that does it in Excel. Let me go to the other computer...

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

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