How to connect laser fire pin of K40 CO2 laser to Duet board.
-
Hi,
I have recently started modification of a Chinese K40 CO2 laser engraver/cutter. The stock board is very limited regarding software compatibility and I would like to replace it. (This is a hobby project.)
The go to board by default is a Cohesion3D board, but currently it is not available in Europe and shipping and import duties make the board quite expensive. This board is a drop in replacement for the stock board.
I would like to investigate if it is possible to replace the board by a Duet board. I have been working with the boards for about a month and I really like them. And I have access to both the version 2 and 3 boards for testing. (But the Duet 2 is preferred due to the price.) After that I will look into compatibility with Lightburn and Laserweb software as these are the 2 preferred software choices.
Connecting the stepper motors and sensors is something that I have done before, so I don't think there will be any problem there. But I am having some questions about how to connect the laser power supply.
I have attached a picture of the power supply that is being used in most of these lasers. From this power supply only the 4 most right connections are connected to the stock board. 2 of these connections supply power to the board (24v and 5v), we wont be needing them since I will be using a proper Meanwell power supply for the Duet. The 2 lines that are left are L, (this is the laser fire) and ground.
The cohesion3d board seems to work by manually configuring the max power via a potentiometer connected to the Laser PWM (IN) 'this is not a real PWM' but just voltage control. And the board is controlling the intensity of the laser by user PWM on the laser fire line. (L)
The laser is triggered when it goes to 0v. Am I correct to assume that I can connect the E0- pin from E0 heater, set it to negated in software and use that to control the laser. And do I need to connect the ground from the laser power supply to the board? Since I will be using different power supplies for laser and board. (They wil both be grounded to the same 230v.)
I am a programmer by nature, so my electrical knowledge is basic. I would very much appreciate some advise on this. If I made any errors in my assumptions above feel free to correct me.
Attached a photo of the power supply, Thanks!
-
I have done something similar with my laser, although I have not yet converted it to a duet. Currently it is running an MKS Sbase.
The laser fire goes to the negative side of a heater connection. Pretty much all setups I've seen retain the potentiometer (I've upgraded mine to a more accurate one) to set the maximum voltage and then use PWM to control the actual laser intensity. Not sure you could move away from that or even whether you'd get any added benefit from it. I've set mine once and have never adjusted it.
You probably would need to tie the grounds together. I currently run the Sbase off the laser power supply and have not had any issue with skipping steps etc. I would suggest doing the same until you're sure you need the extra PSU.
Lightburn should be compatible in GRBL or smoothie mode. -
Thanks for the reply.
I think there is no added benefit to remove the potentiometer, I do have ordered a precision one, since the current one doesn't give me accurate adjustments.
The reason for the added power supply is that the 24v on the default power supply seems to be of a low quality and not designed to run stepper drivers. A least that is what a lot of resources tell me. The Cohesion3D board is even supplied with it's own power supply for this reason.
I think for the Cohesion3D they also connect the grounds. But I don't know if they isolated this on their board.
-
I have installed a Duet Ethernet board and just had my first successful burn.
Connected the heater ground pin to the laser fire pin. And connected the ground of the laser power supply to a ground pin of the Duet.
PWM control seems to work (getting different colors of burn), but I have to figure out the correct frequency.
The smoothieboards use pwm per period in microseconds. And not sure if this is the same as Hz. -
Some more updates on this project.
Tested lightburn software it does detect the duet board as a GRBL board (connected on USB), and some control options work. Homing for example does not work since a $H is sent. Was not getting great results, the cuts were off. And there is not a lot of configuration options, just select a profile and see if it works.
Got some engravings but some were off center. I will have to test more, with different kind of profiles.
After that I tested laserweb software, the software itself is a bit slower, and sometimes crashes. But it has a lot of configuration options, and the Duet is recognized and works.
The gcode generated from laserweb works great, and I am getting good results. But running the gcode via USB was not that stable.
I think I prefer running the job from the Duet interface, the board itself should complete the job. This is the same way as my 3d printers work. However none of the laser software seems to be build for this.
I will do some more testing by uploading to the duet.
The main problem is that when creating the gcode, you don't know the position of the piece of wood. But I think I could make a workable solution by positioning the laser at the correct position from duet web interface. And when starting the job, I can use that position as origin by using gcodes. But I will have to test that.
In laserweb there are a lot op options to insert custom gcode, so customization is great. If it would have a button to upload the job to the duet and start the job, then that would be perfect.
-
any chance you could post your config?
-
@jay_s_uk Sorry for the late reply, my notifications were turned off.
I will try to post the config tonight.
Some update on the project, I now have added an controllable Air assist using a Relay. That is controlled via gcode commands. And I have added a motorized Z-table.
Both were easy to configure in the Duet, and work great.
I do have a fully working k40 now, with the option to control the laser intensity from software. Gcode generated from LaserWeb is working perfect. I then upload these to the Duet, and that seems the way to go.
I haven't had any luck on getting the gcode from the Lightburn software to work to an acceptable level. The generated gcode does work, but whenever I use a fill, the results are bad. Jagged edges and wobbly lines.
I will need to find some time, to post some example pictures and the used gcode. Since I haven't found out what exactly is going wrong with the gcode from LightBurn.
-
I have added my config file: (Comments may be a mess....)
; General preferences G90 ; send absolute coordinates… M83 ; …but relative extruder moves M550 P"MPCNC" ; Machine name and Netbios name (can be anything you like) G21 ; Work in millimetres M555 P2 ; Set output to look like Marlin ; Communication and general M111 S0 ; Debug off M551 Preprap ; Machine password (used for FTP) ;*** Networking M540 P0xBE:0xEF:0xDE:0xAD:0xFE:0xED ; MAC Address M552 P192.168.0.50 ; IP address M554 P192.168.0.255 ; Gateway M553 P255.255.255.0 ; Netmask M552 S1 ; Turn network on ; Pin for air assist via relay M950 P0 C"fan0" ; Drives M569 P0 S0 ; Drive 0 goes backwards M569 P1 S1 ; Drive 1 goes forwards M569 P2 S1 ; Drive 2 goes forwards M569 P3 S1 ; Drive 3 goes forwards M569 P4 S1 ; Drive 4 goes backwards ; Drive mapping M584 X0 Y1 Z2 E P3 ; Drive mapping ; Drive settings M350 X16 Y16 Z16 E16 I1 ; Configure microstepping with interpolation M92 X157.575 Y157.575 Z3232.57 ; Set steps per mm ;M350 X32 Y502 E128 I1 ; Set steps per mm for the extruder to x128 (776 steps per mm) and X and Y to x32 (160 steps per mm) M566 X800 Y800 Z60 E3000 P1 ; Set maximum instantaneous speed changes (mm/min) M203 X16000 Y16000 Z40 ; Set maximum speeds (mm/min) M201 X2500 Y2500 Z80 ; Set accelerations (mm/s^2) M204 P600 T2000 ; Set accelerations (mm/s^2) for print and travel moves M906 X400 Y600 Z600 I30 ; Set motor currents (mA) and motor idle factor in per cent M84 S0 ; Set idle timeout ; Axis Limits M208 X0 Y-30 Z-13.6 U0 V0 S1 ; Set axis minima M208 X300 Y200 Z70 S0 ; Set axis maxima ; Endstops M574 X1 S1 P"xstop" ; X min active high endstop switch M574 Y2 S1 P"ystop" ; Y max active high endstop switch M574 Z1 S1 P"!zstop" ; Z min active high endstop switch ; Allow movement before homing ;M564 S0 H0 ; Laser Mode M452 C"e0heat" R1.0 S1 Q200 ; laser uses !e0heat pin, PWM frequency 100Hz
-
thanks @j-dewit
I ran my K40 with a duet for about 2 hours and gave up as I couldn't get any good engraving out of it.
The firing of the laser didn't want to keep up with the movement of the machine so just looked awful.
I might revisit it at some point, but getting even something remotely useful out of lightburn was difficult -
@jay_s_uk Seem to be having the same results here, but the gcode from laserweb is working absolutely perfect.
I have done some g-code comparisation:
LaserWeb:
; Pass 0 Path 1 G0 X40.18 Y4.49 G1 X39.07 Y4.49 S0.40 F10000 ; Pass 0 Path 2 G0 X39.07 Y4.59 G1 X40.18 Y4.59 S0.40 F10000
LightBurn:
G1X13.92F10000S0.4 G1Y0.1S0 G1X-13.92S0.4 G1Y0.1S0
So far the only difference I see is the G0 moves in laserweb, when the laser is off by default. And in lightburn it is using a G1 with laser power to 0.
And the difference in absolute and relative movements. But why the duet is having problems with the lightburn gcode is a mystery to me. -
I'll look at using laserweb as an option then.
I used to use it before I got lightburn and changed as I just never got on with it.
I'll add this bad on my jobs list to look at.is the engraving working well using laserweb then?
-
@jay_s_uk I have not tried images etc.
But filling vectors works well.
LaserWeb is a good piece of software, but it being totally free. It just can't be compared to lightburn as this is a far superior piece of software.
-
ok, thanks.
Its more vector engraving I do so I'll look into it. -
@jay_s_uk And I am planning to spend some more time testing why the g-code from Lightburn is a mess, I have ordered a cheap MKS S-base board since it should be compatible with lightburn, but I would rather keep using the Duet, since everything on the s-base is a big downgrade compared to the duet.
-
I currently run mine with the SBase (running grbl-lpc https://github.com/cprezzi/grbl-LPC) and the performance is spot on.
It may be down to grbl having next to no features compared to RRF.
I'd just prefer to have wireless support so I can run my machine without being tethered to USB. And I'm a fan of the duet ecosystem.The lightburn gcode could also do with way better structure. I think the outputted file is quite messy