Mesa 7i96 to spindle FWD/REV control

More
5 years 5 months ago #209502 by PCW
Set the PWM scale to 3125

Please Log in to join the conversation.

More
5 years 5 months ago #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 to join the conversation.

More
5 years 5 months ago #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

Please Log in to join the conversation.

More
5 years 5 months ago #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 to join the conversation.

More
5 years 5 months ago #209535 by PCW
Does your lincurve data include negative values?

Please Log in to join the conversation.

More
5 years 5 months ago #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?

Please Log in to join the conversation.

More
5 years 5 months ago #209561 by andypugh

mhd325ic wrote: 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 to join the conversation.

More
5 years 5 months ago #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 to join the conversation.

More
5 years 5 months ago #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 to join the conversation.

More
5 years 5 months ago #209773 by andypugh

mhd325ic wrote: 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 to join the conversation.

Time to create page: 0.056 seconds
Powered by Kunena Forum