router spindle PWM control (open loop)

More
23 Feb 2023 22:40 #265166 by PaulQUE
Hi!

I am in the process of converting an industrial pick and place machine into a CNC router, I've sorted out the motion system but I am struggling with the spindle setup. I looked at the other threads and attempted the solutions proposed but I was unsucessful. I had this spindle and vfd mounted on another machine running grbl so the electronics are sorted. I am using a Mesa 7i96, with the correct firmware flashed, the vfd accepts 0-10v, and I have a 5V PWM to 0-10V converter connecting the mesa card to the vfd. I do not need nor have spindle position feedback, or spindle reverse.
All I'd like is a spindle ON signal and a pwm output scaled from 6000rpm to 18000 rpm to connect to the vfd.

What's a way to achieve that? thank you very much for your help

 

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

More
23 Feb 2023 23:44 #265171 by PCW
What duty cycle do you want at 6000 RPM?
(33.33% or 0%)
The following user(s) said Thank You: PaulQUE

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

More
23 Feb 2023 23:46 #265172 by PaulQUE
I think I need 0% at 6000 rpm, the vfd is setup for 0V = 6000rpm 10V = 18000rpm, or at least that's how I had it setup with grbl

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

More
24 Feb 2023 00:48 - 24 Feb 2023 00:50 #265181 by PCW
If you need to have that offset, it may be easiest to use the lincurve
component. You could also use the scale or offset component do the offset
but that would result in negative PWM values if spindle speeds less than 6000
RPM were selected. The output of lincurve could be set so commanded speeds of
6000 RPM or less results in a 0 output and commanded speeds of 6000 to 18000 RPM
result in an output of say 0 to 12000.

(and then set the PWM scale to 12000)

man lincurve
Last edit: 24 Feb 2023 00:50 by PCW.

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

More
24 Feb 2023 01:08 #265185 by PaulQUE
Thanks, I'll try that to take care of the offset. But I'm must admit I'm lost for even the most basic setup of the spindle, I've seen it done a few ways.
I'm running version 2.8, with mesa 7i96 internal and 7i96d selected, pnconf does not let me add a PWM gen to my config, or configure the pinout.
How can I add it manually in my Hal file and link it to the spindle control?

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

More
24 Feb 2023 01:56 #265192 by PCW
Basically you need to set the PWM parameters and net the PWM pins to the proper LinuxCNC signals


If I load the 7i96d_1pww.bit firmware you have 1 pwmgen on the STEP4 output
(and PWM direction on the DIR4 output)
There's no issue of pinout, as its determined by the firmware

If I look at the available pins

halcmd show pin | grep pwm

I get

36 bit IN FALSE hm2_7i96.0.pwmgen.00.enable
36 float IN 0 hm2_7i96.0.pwmgen.00.value

Note that there are only 2 pins that can be connected to LinucCNC signals
Typically the enable would be connected to LinuxCNCs spindle on pin
and in your case, the value pin would connect to the output of the
lincurve component.

The rest of PWM setup is in setting the operational parameters

halcmd show param | grep pwm

36 bit RW FALSE hm2_7i96.0.pwmgen.00.offset-mode
36 bit RW FALSE hm2_7i96.0.pwmgen.00.out0.invert_output
36 bit RW FALSE hm2_7i96.0.pwmgen.00.out0.is_opendrain
36 bit RW FALSE hm2_7i96.0.pwmgen.00.out1.invert_output
36 bit RW FALSE hm2_7i96.0.pwmgen.00.out1.is_opendrain
36 s32 RW 1 hm2_7i96.0.pwmgen.00.output-type
36 float RW 1 hm2_7i96.0.pwmgen.00.scale
36 u32 RW 0x00004E20 hm2_7i96.0.pwmgen.pdm_frequency
36 u32 RW 0x00004E20 hm2_7i96.0.pwmgen.pwm_frequency
The following user(s) said Thank You: PaulQUE

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

More
24 Feb 2023 13:40 #265236 by PaulQUE
thanks for the help, I manage to get the spindle to turn on and off via the ssr, and to link the speed command to the pmwgen value. when I call for M3 S18000, hm2_7i96.0.pwmgen.00.value is set to 18000, is that normal? what's the unit for hm2_7i96.0.pwmgen.00.value? I have no output on the board, I have found that the PWM- should be connected to TB2-2 and PWM+ TB2-3; but the output is always 5V everywhere on the step4 connector, (0% duty cycle should at least be 0v regardless of the meter's sampling rate? ) I have also tried checking the signal between TB2-1 (GND) and TB2-3 (PWM+) I've included my Hal and Ini, thank you verry much for the help
Attachments:

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

More
24 Feb 2023 16:02 #265243 by PCW
The PWM scale parameter sets the full scale PWM value

(so if PWM scale is set to 18000 a PWM value of 18000 will result in 100% duty cycle)

I would not expect any PWM output as all the net commands that would enable
the PWM gen(or set a reasonable scale value) are commented out in the hal file

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

More
24 Feb 2023 16:11 #265245 by PaulQUE
which one are you referring to? I have the net scale and output type commented in the spindle section but they are present at the beginning of my hal file

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

More
24 Feb 2023 16:18 #265247 by PCW
OK

The PWM gen enable still seems to be unconnected

Note that you will probably want to use
the STEP- output and invert the PWM output
so that the initial PWM state is at 0V

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

Time to create page: 0.121 seconds
Powered by Kunena Forum