Welcome! Log In Create A New Profile

Advanced

Duet as Laser Cutter Controller?

Posted by Radian 
Duet as Laser Cutter Controller?
June 01, 2015 06:39AM
OK, so I'm posting this topic in the Ormerod forums as this is where the greatest concentration of expertise in the Duet lives (as the suggested in the think3dprint3d.com blog) thumbs up.

I have here one of those cheapo Chinese 40Watt Laser Engravers that came with virtually unusable proprietary software/hardware combo.
I soon ditched all that for some Pololu stepper drivers wired-up via a DB25 to a PC running LinuxCNC and happily started cutting.
But a PC makes a clumsy big stepper driver when I consider what the Duet is doing for my Ormerod!

This got me thinking about what it would take to adapt the Duet firmware to the task: X,Y steppers + endstops (possibly Z for workpiece height although I have a fixed cutting bed at the moment) and Laser enable. The latter is always the misfit - with LinuxCNC it's a bit of a kludge that makes use of CNC tool height or spindle control. Unlike with 3D printing and CNC machine tooling nobody seems to provide comprehensive open source solutions to Laser cutting - which always struck me as odd given the usefulness of sheet cutting.

Currently I use OpenSCAD and Inkscape to create and process 2D designs into Gcodes. Inkscape outputs Gcode that simulates Z motion to fire the Laser e.g:
(Start cutting path id: path3457)
(Change tool to Default tool)

G00 Z5.000000
G00 X5.653829 Y4.380786

G01 Z-0.125000 F100.0(Penetrate)
G01 X5.629136 Y4.380786 Z-0.125000 F400.000000
G00 Z5.000000

(End cutting path id: path3457)

I can't find any way of altering the use of Z as the Laser (short of post-processing the Gcode file) so in it's simplest form, all it would seem to take is switching all Z commands to bit/bang a digital control line (e.g. aux. fan O/P) depending on Z +/-. Maybe somebody can think of another way to do this without tweaking the firmware? Not knowing where to start, I'm somewhat reluctant to dive into the Duet source myself.


RS Components Reprap Ormerod No. 481
Re: Duet as Laser Cutter Controller?
June 01, 2015 07:05AM
The Duet firmware already has an option to drive the cooling fan output whenever extrusion is taking place. So you could use the extrusion commands in the gcode to turn the cutter on/off. See [reprap.org].



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Duet as Laser Cutter Controller?
June 01, 2015 07:43AM
Quote
dc42
The Duet firmware already has an option to drive the cooling fan output whenever extrusion is taking place. So you could use the extrusion commands in the gcode to turn the cutter on/off. See [reprap.org].

Oh that's brilliant! - I had wondered about treating the extruder as the laser control when contemplating how slic3r might help generate the Gcodes: If I create a 2D design in OpenSCAD using circles and squares and extrude that by one layer height, slic3r can be set to one perimeter no infill etc. and render gcode that includes extruder moves mapping directly to outline cuts. This has the advantage of leaving Z for table height control - useful for partial cuts for folds made by de-focussing the beam at different heights.

Wow!


RS Components Reprap Ormerod No. 481
Re: Duet as Laser Cutter Controller?
June 01, 2015 08:49AM
I'd be interested in seeing your setup.

I do find the lack of open source laser stuff bizarre. For the most part laser cutters/engravers hardware is a 3D printer without the Z axis and extruder drive, and a laser in place of the nozzle.
Since the duet supports this I wonder how much work it would be to have a laser cutter head that could be swapped out for the hot end....
Re: Duet as Laser Cutter Controller?
June 01, 2015 06:16PM
I expected the "output" for M571 to be the Fan0 output but it's not switching...

Quote

M571 This turns an output on whenever extrusion is being done, and turns it off when the extrusion is finished. The output could control a fan or a stirrer or anything else that needs to work just when extrusion is happening. The S parameter sets the value of the PWM to the output. 0.0 is off; 1.0 is fully on.

Is there some other output it relates to?


RS Components Reprap Ormerod No. 481
Re: Duet as Laser Cutter Controller?
June 01, 2015 06:57PM
Quote
Radian
I expected the "output" for M571 to be the Fan0 output but it's not switching...

Quote

M571 This turns an output on whenever extrusion is being done, and turns it off when the extrusion is finished. The output could control a fan or a stirrer or anything else that needs to work just when extrusion is happening. The S parameter sets the value of the PWM to the output. 0.0 is off; 1.0 is fully on.

Is there some other output it relates to?

Yes it is the Fan0 output. I tested it in my fork three or four weeks ago after fixing a bug in that area, so I know it works. RepRapPro fixed the same bug in that area more recently, but I don't know whether they used the same fix, or whether there is something else you need to do to enable the function in their release.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Duet as Laser Cutter Controller?
June 02, 2015 06:12AM
OK, so I was using your previous firmware 1.04e but now I've loaded 1.09a and still can't get this to work as you described it...

Using Duet Web Control 1.06, the best way I can describe it is that the Fan0 drive "latches" at the highest setting given.

So, for instance:
  • if the Fan control slider is set to 100% Fan0 stays fully on. M571 S0 to S1 have no influence when the extruder is run.
  • if the Fan control slider is set to 0%, Fan0 does switch on with PWM amount X after sending M571 SX and extruding - but stays at X when the extrusion ends.
  • if X is below the Fan control slider or reduced by sending a lower value in M571 the PWM remains at the previous higher level.

I tried deselecting the fan control display in Duet Web Control but it made no difference. It just seems that the slider is the only way to bring down the Fan0 PWM drive level.
The slider does track the extruder PWM setting though; if I get it to go up using the extruder move it shows it going up but then stays there.
Maybe this is a issue with the Web Control app alone?


RS Components Reprap Ormerod No. 481
Re: Duet as Laser Cutter Controller?
June 02, 2015 06:25AM
My fork uses the same fix from dc42's fork, so I'd expect it to work just as well. The web interface usually doesn't interfere with M571 unless you enforce the current fan value, which is occasionally handy to override the generated M106 codes from a G-code file. So unless you've checked that option on the Print Status page, the web interface won't change the fan value automatically.
Re: Duet as Laser Cutter Controller?
June 02, 2015 06:57AM
Radian, have you tried disconnecting the web interface and using Pronterface instead to send the M571 commands, to see whether the issue lies in the firmware or the web interface?



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Duet as Laser Cutter Controller?
June 02, 2015 07:01AM
I just tried disconnecting from the Web Control and issued commands over USB command line. It still behaves the same.

Easily replicated, send... (heat first if plastic will be extruded of course)

M106 S0    ;fan off
M571 S1.0 ;fan 100% on extruder moves
G1 E5 F200 ;extrude

The Fan comes on with the extrusion move but then stays on for me.


RS Components Reprap Ormerod No. 481
Re: Duet as Laser Cutter Controller?
June 02, 2015 07:12AM
I've just looked at the code (of my fork) and it looks like the fan value is toggled only when a new move starts. This means you must either send a (valid) non-extrusion move or M107 to turn it off again.
Re: Duet as Laser Cutter Controller?
June 02, 2015 07:31AM
Quote
zombiepantslol
I've just looked at the code (of my fork) and it looks like the fan value is toggled only when a new move starts. This means you must either send a (valid) non-extrusion move or M107 to turn it off again.

So it does! I've got to think about how that affects things - I can't see a print (cut) move stopping at the end and just sitting there so I guess it will be OK. There's always a bit of paranoia involve with laser cutting though.


RS Components Reprap Ormerod No. 481
Re: Duet as Laser Cutter Controller?
June 02, 2015 07:34AM
Quote
Radian
Quote
zombiepantslol
I've just looked at the code (of my fork) and it looks like the fan value is toggled only when a new move starts. This means you must either send a (valid) non-extrusion move or M107 to turn it off again.

So it does! I've got to think about how that affects things - I can't see a print (cut) move stopping at the end and just sitting there so I guess it will be OK. There's always a bit of paranoia involve with laser cutting though.

I'll change the code in my fork so that if the Move module runs out of moves, and M571 has been used to turn the fan output on, the fan output is turned off again.

Edited 1 time(s). Last edit at 06/02/2015 07:49AM by dc42.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Duet as Laser Cutter Controller?
June 02, 2015 07:48AM
Quote
shadow651
I do find the lack of open source laser stuff bizarre. For the most part laser cutters/engravers hardware is a 3D printer without the Z axis and extruder drive, and a laser in place of the nozzle. Since the duet supports this I wonder how much work it would be to have a laser cutter head that could be swapped out for the hot end....

Me too! About the only one I can find is Lasersaur: [www.lasersaur.com]
Also, Smoothieboard supported laser cutters before 3D printers, I think.

Ian
RepRapPro tech support
Re: Duet as Laser Cutter Controller?
June 02, 2015 07:54AM
If I have understood correctly this will only affect the operation of the laser cutter at the end of the job - i.e. the laser will not switch off. All other cutting (extruding) moves will either be followed by another cutting move (so the laser can remain on), or a non-cutting move (in which case the laser will correctly switch off). If that is correct, you would only need the addition of a non-printing move in the custom end G-code (e.g. move to park position).

Dave
Re: Duet as Laser Cutter Controller?
June 02, 2015 08:02AM
Quote
dc42
I'll change the code in my fork so that if the Move module runs out of moves, and M571 has been used to turn the fan output on, the fan output is turned off again.

Excellent, that's very good of you. It seems to be a sensible precaution... especially when testing things "by hand"

Noddy question: I'm assuming that the extruder drive rate is matched to the velocity of the combined XY move to lay an even bead - if so how complicated would it be to scale this to the PWM value of Fan0?

This would be the ultimate Laser control adaptation (PWM controlled cutting power to match cutting head verlocity).


RS Components Reprap Ormerod No. 481
Re: Duet as Laser Cutter Controller?
June 02, 2015 08:06AM
Quote
shadow651
I'd be interested in seeing your setup.

I do find the lack of open source laser stuff bizarre. For the most part laser cutters/engravers hardware is a 3D printer without the Z axis and extruder drive, and a laser in place of the nozzle.
Since the duet supports this I wonder how much work it would be to have a laser cutter head that could be swapped out for the hot end....

I should think that a trial cutter could be made simply by duct-taping a laser to the hotend and unplugging the Z-motor and extruder motor (with power off!). Connect the laser so that it is controlled by the fan0 output, cover the bed with a mat that can take the laser burn-through (maybe the glass will be OK), manually adjust the Z screw so the laser is focussed on the material to be cut, disable the "do not extrude when cold" function and slice a part that is 1 layer high with 0 bed & hotend temperature, 1 perimeter, no skirt and no infill.

Dave
Re: Duet as Laser Cutter Controller?
June 02, 2015 08:10AM
Quote
droftarts
Quote
shadow651
I do find the lack of open source laser stuff bizarre. For the most part laser cutters/engravers hardware is a 3D printer without the Z axis and extruder drive, and a laser in place of the nozzle. Since the duet supports this I wonder how much work it would be to have a laser cutter head that could be swapped out for the hot end....

Me too! About the only one I can find is Lasersaur: [www.lasersaur.com]
Also, Smoothieboard supported laser cutters before 3D printers, I think.

Ian
RepRapPro tech support
Hi Ian, it's not just the controller, I find it's the whole workflow. The similarities to 3D printing are considerable, so much so it's looking to me as though the Duet is perfect for this application. Not only is the price keen, but the features are way ahead of the dedicated laser controllers I've found so far.


RS Components Reprap Ormerod No. 481
Re: Duet as Laser Cutter Controller?
June 02, 2015 08:16AM
Quote
dmould
I should think that a trial cutter could be made simply by duct-taping a laser to the hotend and unplugging the Z-motor and extruder motor (with power off!). Connect the laser so that it is controlled by the fan0 output, cover the bed with a mat that can take the laser burn-through (maybe the glass will be OK), manually adjust the Z screw so the laser is focussed on the material to be cut, disable the "do not extrude when cold" function and slice a part that is 1 layer high with 0 bed & hotend temperature, 1 perimeter, no skirt and no infill.
Dave

Semiconductor laser heads up to a couple of Watts are available that would fit that bill - but I wouldn't personally risk strapping one on an Ormerod out in the open! That is BTW, how I slice designs for cutting - the only change in modelling is to add the kerf width to outside diameters as the slicer subtracts the material width from perimeters.


RS Components Reprap Ormerod No. 481
Re: Duet as Laser Cutter Controller?
June 02, 2015 08:38AM
Quote
Radian
Quote
dc42
I'll change the code in my fork so that if the Move module runs out of moves, and M571 has been used to turn the fan output on, the fan output is turned off again.

Excellent, that's very good of you. It seems to be a sensible precaution... especially when testing things "by hand"

Noddy question: I'm assuming that the extruder drive rate is matched to the velocity of the combined XY move to lay an even bead - if so how complicated would it be to scale this to the PWM value of Fan0?

This would be the ultimate Laser control adaptation (PWM controlled cutting power to match cutting head verlocity).

I think the first problem may be to find a laser that can tolerate PWM. My understanding is that semiconductor lasers generally have a feedback mechanism involving a photodiode, to keep the diode power in that delicate region between not lasing at all and lasing too strongly for the coatings to stand up to. Such a feedback mechanism would probably not tolerate PWM'ing the supply. But perhaps you can get laser modules with a separate PWM input. I've not looked at semiconductor lasers for a few years, so I may be out of date. You will need the PWM to be fast enough to avoid leaving visible marks.

If you get that far, then adjusting the PWM according to the extrusion rate should not be difficult. The Move code in my fork already allows for different drives to have completely different movement characteristics (I had to do that to support delta printers), so it would be a matter of adding another drive type.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Duet as Laser Cutter Controller?
June 02, 2015 08:55AM
Quote
Radian
Semiconductor laser heads up to a couple of Watts are available that would fit that bill - but I wouldn't personally risk strapping one on an Ormerod out in the open!

Why not? I don't see that it presents any significant risk so long as you take reasonable precautions. Ensure the laser is attached well enough that it cannot fall off and will always be pointing down, wear suitable goggles that filters the laser in case of chance reflections before switching on and don't do it when there are other people or animals around. There is perhaps some risk of fire, but use a suitable bed mat, have the power switch and an extigushant within easy reach and no highly inflammable materials close, and I do not see it being a significant risk at those sort of powers/temperatures. I was not thinking about attaching a 2000W laser and cutting steel!

IIUC the laser beam is not particularly dangerous (except to eyesight) far outside its point of focus, so no risk of a reflection setting the curtains alight (BICBW).

Dave
Re: Duet as Laser Cutter Controller?
June 02, 2015 08:56AM
My Laser is actually a C02 laser like this:

[www.ebay.co.uk]

The HT supply has a TTL level PWM input already!

The mechanicals are pretty good for the money - stepper motors optics etc. it's just let down by the electronics/software.

This isn't the actual listing I got it from - over a year agp now, but pretty similar.


RS Components Reprap Ormerod No. 481
Re: Duet as Laser Cutter Controller?
June 02, 2015 09:08AM
Quote
dmould
Quote
Radian
Semiconductor laser heads up to a couple of Watts are available that would fit that bill - but I wouldn't personally risk strapping one on an Ormerod out in the open!

Why not? I don't see that it presents any significant risk so long as you take reasonable precautions. Ensure the laser is attached well enough that it cannot fall off and will always be pointing down, wear suitable goggles that filters the laser in case of chance reflections before switching on and don't do it when there are other people or animals around. There is perhaps some risk of fire, but use a suitable bed mat, have the power switch and an extigushant within easy reach and no highly inflammable materials close, and I do not see it being a significant risk at those sort of powers/temperatures. I was not thinking about attaching a 2000W laser and cutting steel!

IIUC the laser beam is not particularly dangerous (except to eyesight) far outside its point of focus, so no risk of a reflection setting the curtains alight (BICBW).

Dave

Nothing to worry about then ;-) My problem is that I tend to start off scared stiff - taking all the precautions - then, once I get used to whatever it is not biting me, I start getting sloppy - whoops!

I think people have used semiconductor lasers for engraving like this on 3D printers before but cutting 6mm acrylic is out of reach at the moment. My laser will also cut 4mm ply and MDF so pretty much all the standard Reprap parts can be managed for around £400 plus the Duet using this plan.


RS Components Reprap Ormerod No. 481
Re: Duet as Laser Cutter Controller?
June 02, 2015 09:19AM
I took a quick look for laser cutters on eBay. Complete machines are not all that expensive:

[www.ebay.com] (Low power)
[www.ebay.com] (40 Watt unit)

Low power laser heads are under $100
[www.ebay.com]

Dave
Re: Duet as Laser Cutter Controller?
June 02, 2015 10:25AM
So here's my current stripboard stepper driver hack:



The Y motor connections are combined with X and Y limit switches on the white flat flexible cable which takes account of the gantry movement. The fixed X motor connects by a 0.1" header. The motors are slightly lower spec NEMA17.
One small innovation is a PIC chip that counts X and Y steps and drives the Laser enable with PWM to match the velocity (and kill the laser if there's no movement)

The driver board sits in the bottom right corner of the photo below. A DB25 parallel port cable links it directly to a LinuxCNC PC



The big PSU in the middle supplies all the KillerVolts to the CO2 tube, the little one to the side supplies 12V for the motors etc.

Using the Duet via Ethernet should give a useful amount of electrical isolation from the computers - a WiFi Ethernet adapter (thanks Sky TV!) would provide a welcome increase in the isolation gap.


RS Components Reprap Ormerod No. 481
Re: Duet as Laser Cutter Controller?
June 03, 2015 08:15AM
A couple of issues I'm having that I haven't yet figured out yet:

The X axis is configured to be 320mm long but X homing only completes properly if the head is <=246mm from the homing switch. i.e. as soon as it has moved -246mm from wherever homing was initiated it stops - doing the little dance as though the switch was tripped.

Also, as there is no Z (yet) I'm not sure what to do with the axis. Firstly, while I can always issue G92 Z0 to satisfy the software that Z is homed, I though it might be possible to use M558 P4 to enable the extruder endstop homing. By default, the open input reads high so I assumed this would satisfy the software that Z was homed. In practice, while it seems to spend no time moving Z it fails to set the homed status. This is my config:

; Ormerod 1 config file for dc42 Duet firmware
M111 S0                             	; Debug off
M550 PLaser Cutter		    	; Machine name (can be anything you like)
M551 Preprap                        	; Machine password (currently not used)
M540 P0xBE:0xEF:0xDE:0xAD:0xFE:0xEE 	; MAC Address
;*** Adjust the IP address and gateway in the following 2 lines to suit your network
M552 P192.168.0.25                  	; IP address
M554 P192.168.0.1                   	; Gateway
M553 P255.255.255.0                 	; Netmask
M555 P2                             	; Set output to look like Marlin
G21                                 	; Work in millimetres
G90                                 	; Send absolute coordinates...
M83                                 	; ...but relative extruder moves
M574 X1 Y2 Z0 S1		    	; set endstop configuration (x low endstop, Y high endstop, active high)
M906 X400 Y400 Z400 E400          	; Set motor currents (mA)
M563 P0 D0 H1                       	; Define tool 0
G10 P0 S0 R0                        	; Set tool 1 operating and standby temperatures
M92 E400                            	; Set extruder steps per mm (calibrated when built)
;*** If you have a modulated IR probe without on-board microcontroller, change P1 to P2 in the following
M558 P4 X0 Y0 Z0                      	; No Z probe E stop. X,Y use own endstops
;*** If you have a Duet board with 4.7K thermistor series resistors, change R1000 to R4700 to the following M305 commands
M305 P0 R1000 H0 L0			; Put your own H and/or L values here to set the bed thermistor ADC correction
M305 P1 R1000 H0 L0			; Put your own H and/or L values here to set the first nozzle thermistor ADC correction
M305 P2 R1000 H0 L0			; Put your own H and/or L values here to set the second nozzle thermistor ADC correction
M201 X800 Y800 Z1000 E1000            	; Accelerations (mm/s^2)
M203 X15000 Y15000 Z15000 E3600       	; Maximum speeds (mm/min)
M566 X600 Y600 Z600 E20              	; Minimum speeds mm/minute
M208 X320 Y220				; set axis maxima (adjust to suit your machine)
M208 X0 Y0 S1				; set axis minimum (adjust to make X=0 the edge of the bed)
;*** Laser additions to Ormerod standard
M571 S1					;Set output on extrude to enable laser PSU
M92 X160 Y160				;steps/mm
G92 Z0					;fake Z homed


RS Components Reprap Ormerod No. 481
Re: Duet as Laser Cutter Controller?
June 03, 2015 10:24AM
Quote
Radian
The X axis is configured to be 320mm long but X homing only completes properly if the head is <=246mm from the homing switch. i.e. as soon as it has moved -246mm from wherever homing was initiated it stops - doing the little dance as though the switch was tripped.

The maximum amount it moves during homing is set by the corresponding G1 command in homex.g and homeall.g. So you need to edit those files.

Quote
Radian
Also, as there is no Z (yet) I'm not sure what to do with the axis. Firstly, while I can always issue G92 Z0 to satisfy the software that Z is homed, I though it might be possible to use M558 P4 to enable the extruder endstop homing. By default, the open input reads high so I assumed this would satisfy the software that Z was homed. In practice, while it seems to spend no time moving Z it fails to set the homed status.

M558 P4 is for a switch used as a Z probe, but you have told it in your M558 command that the Z probe is not used for homing Z. Why not just change the M574 command to M574 X1 Y2 Z1 S1 ? That will tell the firmware that you have a Z endstop switch, but with nothing connected to the Z endstop pins it will read high (i.e. homed) all the time.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Duet as Laser Cutter Controller?
June 03, 2015 02:15PM
Quote
dc42
[The maximum amount it moves during homing is set by the corresponding G1 command in homex.g and homeall.g. So you need to edit those files.
Duh. Of course - I forgot all about those files!

Quote
dc42
M558 P4 is for a switch used as a Z probe, but you have told it in your M558 command that the Z probe is not used for homing Z.
OK, I misinterpreted the documentation for M558. It made it sound as though we were selecting the use of the Z probe IR input vs. Extruder endstop.
I will use M574 Z1 instead as you suggest. Thanks.


RS Components Reprap Ormerod No. 481
Re: Duet as Laser Cutter Controller?
June 03, 2015 02:28PM
Quote
Radian
I will use M574 Z1 instead as you suggest. Thanks.

It's just occurred to me that if you use M574 Z1, you will also need to change homez.g and homeall.g to perform homing using a G1 command (as for X and Y axes), instead of a G30 command.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Duet as Laser Cutter Controller?
June 03, 2015 05:02PM
Quote
dc42
It's just occurred to me that if you use M574 Z1, you will also need to change homez.g and homeall.g to perform homing using a G1 command (as for X and Y axes), instead of a G30 command.

Is there anything wrong with just issuing G92 Z0 instead of a move that checks an unconnected endstop? That's what I did and it all seems quite happy.


RS Components Reprap Ormerod No. 481
Sorry, only registered users may post in this forum.

Click here to login