Laser Control by Spindle PWM

More
02 Feb 2016 00:07 #69403 by wl888
Hi All
Aim: To set the laser power at a fixed value via PWM signal from LPT pin based on Spindle speed value in Gcode.
As Spindle speed changes so PWM changes so Laser output changes.

Setup: I have a 3w blue laser diode system with control board that will take PWM/Analog signals, 0-5vdc.
I have it running in basic on/off mode, but now require the ability to automatically vary the output on the run.
I am only looking at vector not raster.

Programming: I have attached a copy of my files, these have been developed in simulation mode and will run as is.
I am using a Max S.... of 10000 so that i can run the included sample programs in linuxcnc, this will be altered to 100 to work as a % of available power later.
I believe i have all the required values and connections but am unsure as to how the PWM signal is delivered from the LPT pin to the laser control board.

It may be that I have already done all that is required and i just need to connect it up, but before i go live could someone with more experience please have a look over my work.

Thanks :)
Doug
Attachments:

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

More
02 Feb 2016 09:31 #69425 by cncbasher
the pwm signal from the parallel port , is compatable with most of the pwm laser driver boards , it's usual to use pin 1
due to parallel port io requirements
fast switching of the laser for raster lithopane work , needs a little more work ,
see the Wiki for ideas

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

More
03 Feb 2016 06:44 #69490 by wl888
Replied by wl888 on topic Laser Control by Spindle PWM
Thanks for the reply Cncbasher.
did you have a chance to run the program and if so have i got it right???

Also would an LED connected to the port be a suitable physical test for this??
Thanks Doug :)

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

More
03 Feb 2016 14:12 #69512 by andypugh
Yes, an LED should vary visibly in brightness.

You might prefer _not_ to use spindle speed. Motion is not guaranteed smooth through spindle-speed changes.
M67 is probably what you want, really.
linuxcnc.org/docs/2.7/html/gcode/m-code.html#mcode:m67

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

More
03 Feb 2016 21:29 #69528 by wl888
Replied by wl888 on topic Laser Control by Spindle PWM
Thanks Andy
I'll revisit M67 and set an LED for testing.
Thanks Doug :)

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

More
07 Feb 2016 04:31 - 07 Feb 2016 08:04 #69730 by wl888
Replied by wl888 on topic Laser Control by Spindle PWM
ok...revisited the M67 command, it will do the output value change but it appears that it is a manual input into the hal file each time a change is required.
What I am after is an automatic value change that can be controlled from the gcode itself, that's why i was looking at the S.... command as a source of control.
I have actually got the laser to vary the intensity using this method but but have been unable to have this and have the laser turn off and on with M65 p0/M62 P0 within the Gcode. I think I have to net the dout command with LPT pin 16 (PWM out for laser) Have tried many ways but no luck. :(

Could You or anyone interested, please have a look and see if there is a way to link these.
Below is an extract of the hal file, also full files attached
thanks :)
Doug

addf parport.0.read base-thread
addf stepgen.make-pulses base-thread
addf pwmgen.make-pulses base-thread
addf parport.0.write base-thread
#addf parport.0.reset base-thread #this line added

addf stepgen.capture-position servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf stepgen.update-freq servo-thread
addf classicladder.0.refresh servo-thread
addf lut5.0 servo-thread
addf pwmgen.update servo-thread

loadrt scale count=1
addf scale.0 servo-thread
setp scale.0.gain 0.05 #max volts / max spindle speed 5/100
net spindle-speed-cmd motion.spindle-speed-out => pwmgen.0.value
net spindle-speed-cmd => scale.0.in
net spindle-on motion.spindle-on => pwmgen.0.enable
net spindle-pwm <= pwmgen.0.pwm
setp pwmgen.0.pwm-freq 100.0
setp pwmgen.0.scale 100 #100 is for 100% of power
setp pwmgen.0.offset 0.0
setp pwmgen.0.dither-pwm true
net scale-out <= scale.0.out

net probe-in => motion.probe-input
net dout-00 <= motion.digital-out-00
net dout-01 <= motion.digital-out-01

setp lut5.0.function 0x10000
net all-limit-home => lut5.0.in-4
net all-limit <= lut5.0.out
net homing-x <= axis.0.homing => lut5.0.in-0
net homing-y <= axis.1.homing => lut5.0.in-1
net homing-z <= axis.2.homing => lut5.0.in-2

net estop-out => parport.0.pin-01-out
net xdir => parport.0.pin-02-out
net xstep => parport.0.pin-03-out
setp parport.0.pin-03-out-reset 1
net ydir => parport.0.pin-04-out
net ystep => parport.0.pin-05-out
setp parport.0.pin-05-out-reset 1
net zdir => parport.0.pin-06-out
net zstep => parport.0.pin-07-out
setp parport.0.pin-07-out-reset 1
net probe-in <= parport.0.pin-10-in-not
net all-limit-home <= parport.0.pin-13-in
net coolant-flood <= iocontrol.0.coolant-flood => parport.0.pin-14-out
net spindle-pwm <= pwmgen.0.pwm => parport.0.pin-16-out
#net dout-00 => parport.0.pin-16-out
net dout-01 => parport.0.pin-17-out
Attachments:
Last edit: 07 Feb 2016 08:04 by wl888.

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

More
07 Feb 2016 22:16 #69752 by andypugh

ok...revisited the M67 command, it will do the output value change but it appears that it is a manual input into the hal file each time a change is required.


linuxcnc.org/docs/2.7/html/gcode/m-code.html#mcode:m67

I have no idea what you mean by "manual input into the HAL"

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

More
08 Feb 2016 07:29 #69763 by wl888
Replied by wl888 on topic Laser Control by Spindle PWM
Yep....neither do I , total brain snap....it's obviously a Gcode command....more sleep required...will look closer at M67 command and get back to you later... :blush:

Doug

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

More
08 Feb 2016 09:56 - 08 Feb 2016 09:59 #69765 by cncbasher
see the following links

forum.linuxcnc.org/forum/49-basic-config...ed-on-one-axis#57216
if your using a cam program , then you would need to edit your post processor to use m67 instead of spindle
Last edit: 08 Feb 2016 09:59 by cncbasher.

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

More
09 Feb 2016 02:13 #69811 by wl888
Replied by wl888 on topic Laser Control by Spindle PWM
Thanks Cncbasher
will follow up on this .
Doug

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

Time to create page: 0.083 seconds
Powered by Kunena Forum