Laser Control using PWM

More
26 Jul 2019 14:32 #140656 by Sockheaven
I finally got around to purchasing a 15Watt laser to play around with and wanted to use the PWM abilities of LinuxCNC to control the intensity.

I have very little experience with LinuxCNC so I've been having a hard time trying to figure out the correct configuration in the INI and HAL files. I found another poster doing something very similar:
forum.linuxcnc.org/10-advanced-configura...pwm-output-for-laser
But in this post and others I've found, the jargon and references are going over my head so I was hoping to get some assistance.

A few questions/comments so far:
1. When I scope the spindle pwm signal the signal goes high before the cutting path starts (presumably to get the spindle up to speed) - but in the case of a laser, i don't want the laser pre-firing as it will etch outside of the desired path. What is the appropriate configuration so that this PWM only starts while the cutting path is active?

2. When I scope the spindle pwm signal, it appears on or off - not actually modulating. While looking at the configuration i realized I have no idea what is defining the spindle speed, I see where to define the path motion when generating the gcode from dxf, but i don't see anything for the spindle - where is this normally defined?

Attached are my current INI/HAL files, any assistance or direction would be awesome.

File Attachment:

File Name: my-mill_20...7-26.hal
File Size:4 KB

File Attachment:

File Name: my-mill_20...7-26.ini
File Size:2 KB


Thanks!
Paul
Attachments:

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

More
26 Jul 2019 14:56 #140659 by tommylight

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

More
28 Jul 2019 21:11 #140839 by andypugh
Replied by andypugh on topic Laser Control using PWM

1. When I scope the spindle pwm signal the signal goes high before the cutting path starts (presumably to get the spindle up to speed) - but in the case of a laser, i don't want the laser pre-firing as it will etch outside of the desired path. What is the appropriate configuration so that this PWM only starts while the cutting path is active?


Rather than use spindle (M3 / M5) use the G-code analogue outputs (M67):
linuxcnc.org/docs/2.7/html/gcode/m-code.html#mcode:m67

M67 takes effect the instant that the next move command starts.

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

More
29 Jul 2019 18:09 #140904 by Sockheaven
Replied by Sockheaven on topic Laser Control using PWM
I've seen M67 referenced in a few other threads when I was searching about this topic but I couldn't figure out how to configure that.

Is this something I manually edit in the GCODE file? or is is a configuration in DXF2GCODE? or something within the INI/HAL configuration in LinuxCNC?

I haven't strayed too far off the guided path so far, so I'm finding I don't know quite a bit :-)

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

More
29 Jul 2019 20:29 #140918 by andypugh
Replied by andypugh on topic Laser Control using PWM

Is this something I manually edit in the GCODE file? or is is a configuration in DXF2GCODE? or something within the INI/HAL configuration in LinuxCNC


Does DXF2GCode output spindle speed and on/off?

If it does, and if it can't be changed then you have a choice of

There are probably other ways I have not thought of, too.

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

More
29 Jul 2019 21:16 #140919 by tommylight
Replied by tommylight on topic Laser Control using PWM
In the link i posted above there is dmap2gcode that will output M67 wherever Z values were.
That is very good for raster laser engraving. I also have somewhere the gcodetools modified to output that, but it is a bit of work to search through all my SSD's.
Let me know if you need it.

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

More
02 Aug 2019 13:50 #141185 by Sockheaven
Replied by Sockheaven on topic Laser Control using PWM
Thanks for all the suggestions. After reading through more documentation I think I'm missing a level of experience to make this work.

Has anyone considered making a GUI setup tool for the HAL configuration?

If I skip the PWM for now, and simply want to gate the spindle signal(or any signal for that matter) with when the "cut" happens, can someone help with the HAL configuration?

I've seen the single line examples in the documentation mixed and some full HAL files in other posts and I'm seemingly unable to fill in the gaps :-/

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

More
02 Aug 2019 14:11 #141187 by Sockheaven
Replied by Sockheaven on topic Laser Control using PWM
Further simplifying - to help understand the HAL configuration better - can I get an example of creating a digital output on one of the PARAPORT pins based on when the "cut" is occurring?

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

More
02 Aug 2019 18:48 #141219 by Sockheaven
Replied by Sockheaven on topic Laser Control using PWM
Ok I feel dumb, I see now that by modifying the GCode I can just turn the spindle on/off between each move command.

Ok, I suspect the duration the laser spends at the start/end is longer due to this primitive method, but its far better than it used to be.

So, stating the obvious, i guess I need to create an additiona pwmgen, attach it to a pin, then the M67 command in a GCODE file will magically turn it on?

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

More
06 Aug 2019 21:21 #141548 by andypugh
Replied by andypugh on topic Laser Control using PWM

So, stating the obvious, i guess I need to create an additiona pwmgen, attach it to a pin, then the M67 command in a GCODE file will magically turn it on?


Pretty much.

You could use spindle on/off to enable and disable the pwmgen (there is an enable HAL pin for the pwmgen, but be aware that unless there is a non-zero spindle speed the spindle-on pin does not change state) and then use the M67 output to set the PWM duty cycle. You probably want a fixed PWM frequency.
net laser-enable motion.spindle-on => pwmgen.0.enable
net laser-power motion.analog-out-00 => pwmgen.0.value
setp pwmgen.0.pwm-freq 1000
net pwm-pulse pwmgen.0.pwm => parport.0.pin-00-out

linuxcnc.org/docs/2.7/html/man/man9/pwmgen.9.html

You might prefer a pwmgen frequency of 0, which enables PDM mode. In fact a very low frequency PDM might give a rather interesting effect with a laser. (As might low-frequency PWM)

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

Time to create page: 0.080 seconds
Powered by Kunena Forum