-
One way to drive a laser cutter would be to set up the gcode to command extrusion where you want the laser on, then use the M571 command to set PWM on a pin whenever extrusion is taking place. This would keep it in sync. Currently the M571 command always uses the Fan0 pin but in the forthcoming 1.17dev8 release the pin is selectable.
Does anyone know whether there is a standard way of using gcode to drive a laser cutter?
In 1.16 this code is driving the laser rather well with perfect cutouts and no dwell with the laser on (not that the PWM needs to be inverted for my Simpledrive board) -
;laser off
M42 P3 S0 I1
;go home
G0 Z30.000 F1500
G0 X0.000 Y0.000 F9000
;move to first cut
G0 X32.092 Y123.544 Z2.100 F9000
;first cut depth
G1 Z0.000 F1500.0
;laser on
M42 P3 S255 I1
G1 X31.690 Y123.540 F900.0
G1 X31.286 Y123.531
…
G1 X32.092 Y123.544
;complete buffer before commencing next line
M400
;laser off
M42 P3 S0 I1
;move to next outline
G0 Z2.100 F9000
G0 X78.278 Y94.219 F9000
;first cut depth
G1 Z0.000 F1500.0
etc.Have not tried using this method for pixel engraving and I suspect the need to issue the M400 is going to slow things down for each scanline pass.
Reading up on M571 it does sound better suited to running the laser with 1.17. Will upgrade and test it out. Just a bit of a pain as Cut2D doesn't natively output E values. I can however customise a post-processor to put E values out on the G1 cut moves. Please note that my config.g does not have any defined extruders at the moment. Do I need to add the extruder setup back into the config to make M571 behave as intended?
-
Well, M571 did not invert the PWM when I tried the I1 option I was using with M42. Back to M42 for now…
Also, these gcode files not only lock up the web interface, after the job is finished I can no longer issue any commands (after reconnecting) or start a new job without hitting the reset button.
-
Can you give me an example of the code that Cut2D outputs, so I can look at supporting whatever gcode it uses to turn the laser on/off?
-
Posted a link further up the thread.
@jgrouse:I'm now on 1.16 with the 1.13 Web code and I still get the web interface locking up when I start a job which does not extrude or use hot ends/beds. I now get the following as soon as the job is started:
Communication Error
An AJAX error has been reported, so the current session has been terminated.
Please check if your printer is still on and try to connect again.
Error reason: SyntaxError: Unexpected token ] in JSON at position 446I can only reconnect to the web interface when the job is complete. Interestingly the emergency stop button still works, however I would like to get some form of feed back as well as the ability to press pause and adjust feedrates.
Here is a very simple gcode file set up to laser cut a square using the first PWM port on the Duex5 board (M42 P3 S255) to set the Laser driver power - https://app.box.com/s/7h697i7c9qghmhw13rqwjwc34iun59f0
Happy to add whatever is needed to the gcode to allow the web interface to give me some feedback and control over the job.
Thanks Dave/Christian in advance if either of you can help me out?
Here is a newer file using the M400 call to clear the buffer - https://app.box.com/s/2pdgx6qogjhxvfp3se5te3xh04el453o. This one cuts a square out of 3mm ply using a 7W blue laser. Cut2D does let you define your own postprocessors so I do have quite a bit of control over what it puts out. The one thing that is not used as a variable in Cut2d is the extruder values (clearly). At this point I'm satisfied with the output I'm creating with my custom postprocessor for Cut2D and the only grief I'm having is the whole web interface crashing when I start a print. If that can get addressed then I'm sure quite a few people wanting to expand beyond just 3d printing with this hardware will be able to move forward in this direction.
-
@Russ:
yeah, i have been doing similar, but using a servo control for a brushless control.
Next Up Laser!
ill need to figure that one out, its just straight up 12VDc so i'm hoping i can use a Fan PWM output to drive a SSR of some kind…
or i may be able to use a heater channel, will test the laser when i get it, 2.5W 80$, ebay, cheep so will see how well it works lol
~Russ
Great to see you're discovering the potential in utilising the mechanics of a 3D printer to route/laser as well. The fundamental difference I see is the rigidity and torque of a dedicated router (and much lower speeds). Your average belt driven setup is all about speed at the sacrifice of resolution and torque so at best the adoption of a laser is as far as most people go. The rig I built from scratch still uses belts however I've upped the resolution using the new Duet WiFi/Duex5 stepper drivers and the belt is pressed down into a toothed track so that the accelerations can be set quite high without the usual elasticity you get with stretched belts. The motors are also a little larger than normal without stretching the amps that these new drivers can deliver. The spindle I have is also on the small size however this rig is really just for cutting 3mm ply with laser or 6mm ply with the spindle and at 48V this little thing rips into 6mm ply with little effort. I also have a 1100 x 830 mm cut area on a regular 1200x900 sheet of ply.
Once I have this thing doing laser/spindle routing nicely I'll finish it off with the 3D printer parts. This involves a case that has a large cavity below the table that the heat bed lowers down into via four lead screws a two steppers giving a 300x300x500mm build area. Having an abundance of stepper driver ports to hook up to allows me to just run with different config.g files for each setup. The only cable switching will be the wires that feed to either the spindle (2 wires), laser (4 wires) or extruder (4 wires + switch plug from z axis stepper to extruder stepper). At some point I will swap out the stupidly fat stepper cables Homann Designs sent me with narrower ones so I can have another stepper cable to the head. Note that a laser diode requires a driver board specifically designed to regulate the amps which is not what an SSR is designed for. Typically this just needs a PWM signal and 12V in. The Simpledrive board I have also has an NTC thermistor to ease off the power if it gets too hot and an interlock to fully disable the laser when short circuited (external safety switch). Also has pins to read the amps you are feeding the laser using a multimeter. http://www.ebay.com.au/itm/5A-analog-linear-PWM-laser-diode-driver-with-thermal-protection-/162291013120?hash=item25c94c5600:g:w7oAAOSwiYFXHE-T. Please don't think about purchasing from ebay seller Laserlands. The driver board they sent had a whopping great heatsink on it, however the MOSFET was not even touching it - the heatsink served no purpose at all.
If you want a powerful laser without all the fuss with CO2 tube lasers the best place is DTR's Laser shop where I purchased my NUBM44 laser diode which dropped into the 12mm copper housing/heatsink I already had https://sites.google.com/site/dtrlpf/home/diodes/6w-nubm44-445nm-laser-diode. Beam is a bit wide on this one however the lens I had with the 3.5W laser worked really well at getting a nice 0.1-2mm spot out of it. Having a strong jet of air at the cut point is also a must as it really reduces the charring of the wood. Still designing the air jet head at the moment.Will take pictures/video soon of where I'm at with this thing.
-
Thanks jgrouse,
yeah, I built my own spindle, could have used a lower rpm… went for a 45Krpm motor lol direct drive... for the small cutters im using it has plenty of torque. i wanted a compact spindle, I could not find one so I made one...
you can see how i built i here: http://rwgresearch.com/open-projects/brushless-cnc-spindle-build-3d-printer/
it has a vacuum attachment that i made as seen in that other video.
The Laser I got from here http://www.ebay.com/itm/361709323088?_trksid=p2057872.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT and it states it has a built in current / driver circuit… will see about that once i get it, i may need to buy/make an external driver. I want to be able to control the beam strength. I'm hoping that a PWM pin will work, as David stated. then I can even use the extra heater channel. I want to use a SSR just to control the voltage ( if it has a built in current circuit.) then again i may need way more control, something that is constant out put. will see, i guess it could be all or nothing for first go
and yeah, cheep laser, so i might get what i pay for
~Russ
-
Posted a link further up the thread.
@jgrouse:I'm now on 1.16 with the 1.13 Web code and I still get the web interface locking up when I start a job which does not extrude or use hot ends/beds. I now get the following as soon as the job is started:
Communication Error
An AJAX error has been reported, so the current session has been terminated.
Please check if your printer is still on and try to connect again.
Error reason: SyntaxError: Unexpected token ] in JSON at position 446I can only reconnect to the web interface when the job is complete. Interestingly the emergency stop button still works, however I would like to get some form of feed back as well as the ability to press pause and adjust feedrates.
Here is a very simple gcode file set up to laser cut a square using the first PWM port on the Duex5 board (M42 P3 S255) to set the Laser driver power - https://app.box.com/s/7h697i7c9qghmhw13rqwjwc34iun59f0
Happy to add whatever is needed to the gcode to allow the web interface to give me some feedback and control over the job.
Thanks Dave/Christian in advance if either of you can help me out?
Here is a newer file using the M400 call to clear the buffer - https://app.box.com/s/2pdgx6qogjhxvfp3se5te3xh04el453o. This one cuts a square out of 3mm ply using a 7W blue laser. Cut2D does let you define your own postprocessors so I do have quite a bit of control over what it puts out. The one thing that is not used as a variable in Cut2d is the extruder values (clearly). At this point I'm satisfied with the output I'm creating with my custom postprocessor for Cut2D and the only grief I'm having is the whole web interface crashing when I start a print. If that can get addressed then I'm sure quite a few people wanting to expand beyond just 3d printing with this hardware will be able to move forward in this direction.
I tried printing that file (Square.gcode) on both my Duet 0.6 powered Cartesian printer and my Duet WiFi powered delta, after sending M307 H3 A-1 C-1 D-1 in both cases. I didn't get any web interface disconnects. But the Ajax error message you reported above clearly indicates that the firmware on your machine is sending an incorrectly formatted JSON response.
Please upgrade your firmware to 1.17dev8, which is what I am running, and make sure you are running DWC 1.13. If the disconnect persists and you are still getting that "Syntax error" message, then what I really need is the .pcap file from a Wireshark trace covering the disconnect.
-
I tried printing that file (Square.gcode) on both my Duet 0.6 powered Cartesian printer and my Duet WiFi powered delta, after sending M307 H3 A-1 C-1 D-1 in both cases. I didn't get any web interface disconnects. But the Ajax error message you reported above clearly indicates that the firmware on your machine is sending an incorrectly formatted JSON response.
Please upgrade your firmware to 1.17dev8, which is what I am running, and make sure you are running DWC 1.13. If the disconnect persists and you are still getting that "Syntax error" message, then what I really need is the .pcap file from a Wireshark trace covering the disconnect.
The JSON error was the result of using 1.17dev8 and the 1.13 web control, as it was with 1.16FW/1.13WC. Are you using Chrome as your browser as well?
-
I tried printing that file (Square.gcode) on both my Duet 0.6 powered Cartesian printer and my Duet WiFi powered delta, after sending M307 H3 A-1 C-1 D-1 in both cases. I didn't get any web interface disconnects. But the Ajax error message you reported above clearly indicates that the firmware on your machine is sending an incorrectly formatted JSON response.
Please upgrade your firmware to 1.17dev8, which is what I am running, and make sure you are running DWC 1.13. If the disconnect persists and you are still getting that "Syntax error" message, then what I really need is the .pcap file from a Wireshark trace covering the disconnect.
The JSON error was the result of using 1.17dev8 and the 1.13 web control, as it was with 1.16FW/1.13WC. Are you using Chrome as your browser as well?
No, I am using FireFox because I have big problems with Chrome under Windows 10.
-
Might give FireFox a go…
-
Getting the same error with FireFox. Here is my config.g -https://app.box.com/s/z6254z515p21p8uu92zg3uwhdgeaqcvy. Surely it is something to do with not having any hot end or headbed defined?
Current web error is -
"An AJAX error has been reported, so the current session has been terminated.
Please check if your printer is still on and try to connect again.
Error reason: SyntaxError: JSON.parse: unexpected character at line 1 column 453 of the JSON data" -
Thanks, with that config.g I was able to reproduce the problem. Fixed in 1.17RC1 due out soon.
-
I thought this was an appropriate place for this…
Please subscribe to my you tube channel if you want to keep up to date on this project...
Here is the home made spindle running from the Duet wifi.
https://www.youtube.com/watch?v=6QpJ_aUhH1s
Best, ~Russ
-
Fairly sure the G2/G3 support was in DC42's wishlist already? I'll double check…
I didn't find it. But what's the point in supporting it if none of the slicers support it? Writing gcode by hand?
http://forums.reprap.org/read.php?262,407139,737519#msg-737519
http://reprap.org/wiki/G-code#G2_.26_G3:_Controlled_Arc_Move -
@nokian:
Fairly sure the G2/G3 support was in DC42's wishlist already? I'll double check…
I didn't find it. But what's the point in supporting it if none of the slicers support it? Writing gcode by hand?
http://forums.reprap.org/read.php?262,407139,737519#msg-737519
http://reprap.org/wiki/G-code#G2_.26_G3:_Controlled_Arc_MoveI believe CNC GCodes more often contain G2/G3 commands so to widen the applicability of RepRapFirmware this would be good to add. Also there is a bit of chicken and egg. If no firmware supports it then why bother implementing it in a slicer.
Of course we also need to move past STL style model formats (which contain only straight lines) to a model format that has curves before it makes sense for slicers to support arc!
None the less the implementation chain has to start somewhere. For example RepRapFirmware had mixing capabilities long before multiple input hotends were publically available and that's only really been.useduch realtively recently.
-
I created a thread in the firmware wishlist section of the forum about adding G2/G3:
https://www.duet3d.com/forum/thread.php?id=755