I think this is related to earlier discussions about the current x-carve version of GRBL being compatible to laser engraving, but just in case…
I got my J-Tech 2.8W engraver running the other night. I got through a couple of simple jobs and then realized I was going to have to modify some gcode to fix issues…mostly z-moves where the laser was spending too much time on one spot. I fixed those and I think I would be done for basic engraving needs, if I could issue the equivalent to the S M3 and M5 commands. I should be able to issue something like S255 M3 for full power to the laser driver.
Now I happen to be the owner of a spare gShield and an Uno clone, and I loaded the JTech GRBL hex file to that Uno. The M3/M5 commands work beautifully through the X-Carve power supply on this board. It acts just like a PWM router would, w/ a spindle (power) range between 0 and 255. I haven’t tested anything w/ the steppers yet but I assume they work.
I really don’t want to run two different boards for these different functions. So, has anyone decompiled the JTech code to see how they’re making the changes to talk PWM to the laser? I think both setups are using pin 11 for PWM, and I certainly didn’t change anything except the Uno and the gShield in my so-far-successful attempt…straight swap, no wiring changes. I’m just thinking that somewhere in that uncompiled code there are some small but obvious differences between spindle and laser, and that a dual-mode setup might be easy if those differences are understood.
The only thing I can’t say right now is whether I’m getting PWM off of my regular X-Carve setup (i.e. if I’m chasing the wrong problem). There’s a new PID in play and my multimeter took a dive yesterday, so I haven’t had time to confirm.
The J-Tech GRBL hex is set at 1Khz for the PWM to be compatible with the J-Tech laser driver. The X-Carve GRBL is set at 7.812Khz, so it does not work properly with the J-Tech laser driver.
gosh there is still so much that I don’t understand. That makes total sense. Now just to get my hands on the source code so that I can make the proper adjustments.
sorry for another question, but do you know if that’s the only difference between the two builds? Where I’m going with this is: can I assume these are the only differences, then build my own recompiler that really only needs to handle changing z-moves (on a router) to S-/G-commands (for the laser)? I could live with that…the only real difficulty - other than recompiling gcode for the laser, which I could script - would be in selecting the correct USB device before sending the commands.
The other difference is, with the X-Carve grbl it does not execute the S commands in real time (setup for spindle speed), where the J-Tech grbl does run the S commands in real time which is important that it has no dwell when your raster engraving images.
yeah I’m not really a Unix guy (diff) but I figure I could find the differences if I had the uncompiled source code. I am kind of an armchair coder masquerading as an IT professional and part-time engineer. I’m starting to think that two USB connections is a good compromise.
The J-Tech grbl will run Z commands for using a spindle also. It’s the only grbl that I have tested that will run X,Y,Z,S & F on every line of gcode. However, it will not run arc commands and limit switch checking is disabled.
If running the X-Carve standard GRBL, issue an M3 S18000 for full power, e.g. equivalent to M3 S255, and M5 for off. On X-Carve GRBL M3 S1200 gives a low power focusing spot.
As you’ve found, mod the gcode to turn Z movements to laser on/offs.
So you engrave and cut just fine on standard X-Carve setup.
However, if you want to do raster pictures, then you’ll need a different firmware. I’ve not bothered for now, I’m waiting until GRBL can do both.
You might give Notepad++ a try.
This is an open source text editor that is way above native notepad on windoze machines and has a really good compare plugin that provides a diff function.
Also great for macro search and replace of GCode too for laser/other usage. If you are on a Mac have a look at Text Wrangler, a great editor too with similar tool set.
yeah that’s basically what I’ve been doing in Windows (using Notepad++ to “recompile” gcode).
I may add a new class to GRBL 0.9 for laser control - I’m reviewing Sonny’s code now.
I took some basic measurements off of the PWM using each Arduino (one w/ working JTech PWM, the other with working X-Carve PWM). JTech modulates both voltage and current through the range, while X-Carve only modulates current @ 5V.
I guess it’s time to crack a book or three…
Thanks so much for this - I’m not sure how I missed it earlier. Work had me a little busy but I just got back to this. I think my wiring may have been to blame earlier because I could have sworn that I tested this method! It wasn’t until I reconnected the PWM to the laser board until it worked…I just unscrewed the wires from the terminals, and screwed them back down. Weird.
Anyway, thanks again. This will do me for now, for simple engraving. I’ll definitely head over to get PicEngraver when I am ready for that…hopefully everything will be on a single GRBL build by then.
Hi Ian, I recently received and installed a Jtech laser in my xcarve. I was wondering how did you end up wiring your laser? I currently have the diode plugged into the output on the driver board and wires running from the input of the driver board to pins 11 and ground on the arduino. Any help would be greatly appreciated! Thanks
I ran the driver input wires to same but just did it on the front of the 24v power supply on the mini green terminal block rather than at the gsheild outputs.
Switch the spindle from auto to off on the switch to prevent the spindle firing up but the PWM signal still makes it to the laser driver.
With the driver set to default power (3 jumpers, 1.6amps, 2 watts) sending a requested 18,000rpm spindle speed from Easel will give you full power. Sending a requested 1200rpm will give a low power focusing spot.
I use Easel to do my marking/cutting layouts but export the gcode, modify it (change Z movements to laser on/offs) then actually send using Chilipeppr.
Gcode wise “M3 S18000” will send 100% PWM signal to laser driver. “M3 S1200” will give a low power spot for focusing/zeroing. “M5” will turn the laser off.
If you open a gcode file exported from Easel you can search/replace Z axis movements with these laser on/off commands. Takes seconds to do.
Hope that helps.
Guys. Need some help. Recently got a uno/gshieldv5 for my xcarve kit and jtech 3.8w laser. Loaded grbl from Inventables and it runs smoothly but laser poweris.SXXXX. So I went and loaded jtech I can turn laser with SXXXX but the movement of the motors is uberly slow. I checked the setting to the same I hade with Inventables grbl but did not work. Any suggestions? Thanks
I am running the Inventables GRBL on my X-Carve with the Jtech 2.8W laser and use S10000 for the lasers high power setting. If I need to see the lasers location without burning I use S100.
Thanks Mike. What software are you using to generate the gcode?
So far I’ve been playing around with Laser Etch and Pic Laser Pro.
I’ve just uploaded an experimental version of the Estlcam machine controller with continuous PWM support that still allows the machine to go very fast (> 45kHz for the stepper drivers). Maybe someone likes to give it a try? (I have no laser yet)…
Download: www.estlcam.com (Version 8.213 - the smaller link below the large main version)
- You need to select the “GRBL Laser” pin layout as shown in the picture above.
- There needs to be a “M03” command at the beginning of the program to switch the PWM output on.
- Important: even if you don’t use the Z-Axis at least one Z coordinate needs to exist at the beginning of the program.
- PWM is set with the spindle speed word “S”.
If you set lower RPM to 0 and upper RPM to 100 you can control PWM from 0 to 100% with “S0” to “S100” accordingly:
If there are any problems please let me know - I’d really appreciate some feedback.