Laser Cutting DXF / Inkscape / GRBL / + Weird PWM behaviour…

This is the header and footer code you can add to the exported Gcode for use with machines using GRBL v1.1. It’s particular important for me as I’m use a dual spindle / laser controller.

;(Header end)

M5; Disable laser
;(Footer end)

Ok I’m going to show you how to install Inkscape 0.92 and then add the J Tech Plugin which will allow you to create Gcode to cut DXF vector files. So once you’ve downloaded the appropriate version of Inkscape for your computer and the Zip file with the J Tech plugin, you want to make sure you install this onto your computer and then extract the Zip file. And then you want to copy the laser Python file and the XML file. Copy it there, Control C. And then I’m going to go to the C Drive, programme files, inkscape, share, and extensions and I’m going to paste into this folder.  And that’s kinda it.

So if I open Inkscape now, and you’ll find the new Plugin under extensions and Generate Laser Gcode. And then you’ve got the J Tech Photonics Laser Tool there.

And the secret to using this is simply importing your DXF and not opening them. If you open the DXF file you will have scaling issues when you then go to export the Gcode. So don’t press open – press import, and find your file and that’s an example.

My origin position is actually the top right point of the CNC machine, so I’d have to position the DXF file off the canvas before generating the Gcode. And it’s simply a matter of going to the plugin, adjusting these so they are at the right settings. I’m going to go into this a little bit more. My CNC machine the power setting is actually in relation to the RPM speed of the spindle so the max power is actually 24000 as opposed to 255 of 12000.

Also I am using GRBL 1.1 so I can use, well there’s a few things I should add to the code to make cutting a little bit safer but essentially even generating this will work. If I press apply it’s created a visualisation of the Gcode around that.

If I open the gcode you can see it’s at the right scale for my wasteboard which is roughly 32cm across and this should be 12-14cm across. I can’t remember now but that looks like it’s to scale and in the position I expected it.

Ok I’m going to try cut a tool path using the laser this is the PLH3-6W laser from Opt Laser, and it looks pretty cool. This fits onto my CNC machine like that. So the laser is about 40mm above this board.

I’ve just open the Gcode that I’ve just exported from Inkscape using the J Tech plugin. I know I’m not using there laser but they have provided this as an opensorce tool (used opensource projects to make something for their commercial benefit) and what I’m going to do is make a few changes to the Gcode. So at the start I need to copy this in, and at the end I’m putting the $32 command and setting that to 0. So basically $32=1 enables the GRBL laser mode, and I’m setting the laser mode to M4 which is dynamic which means when the laser comes to a stand still because the stepper have stopped moving it’s going to turn off, so I don’t burn a hole through the wasteboard. I’ve saved that (in the description) and I’m going to put these on. I’m going to not look directly into the laser. I’m going to keep behind the controller. This should be quite quick and I’ll be able to make a judgement of the effectiveness of what I’ve just done based on the outcome on the paper.

While using the laser I noticed first of all the fan pushed air downward onto the material, in this case pushing the paper all over the place but also the signal voltage was stuck at 4.3v. I tried to toggle the laser signal but wasn’t getting the full range I expecting. I removed the laser head and measured the voltage with a voltmeter at the magnetic docking head. I placed the red probe on the signal wire (which at the time happen to be going to the TTL input) and the ground probe to the ground terminal. No matter what I did I kept getting 4.3v.

So this is where the video comes a little non-linear. Luckily when I made the first few test engravings I specified as max PWM of 225 – thinking that would send 5v to the laser but instead, it sent the lowest signal of a range which happen to be 4.3v. Nathan happen to pop into the workshop and offered to check the signal using his oscilloscope so we could see the waveform. He noticed that the PWM signal from the controller looked like a constant DC voltage and the oscilloscope could not read the wave type. It turned out after looking at a diagram of the Phoenix Controller, that there’s a 1uF smoothing capacitor which changed the PWM from the Arduino ATMega328-PU in anticipation that the signal will be going to the analogue input of a VFD.

The problem I have is the VFD is expecting a 0-10v signal so it can adjust the RPM speed but the Laser Engraver expects 0-5v signal instead. I remember seeing a schematic in the VFD manual which included a jumper to swap the analogue input from 10-5v – but I never found this so stuck with the pre-set 10v.

I decided to take the front panel off, and there it was – JP1. After I swapped the jumper I had to adjust the blue potentiometer on the Phoenix Controller so it sent a 0-5v signal instead.

The thing which makes my controller unusual is I am swapping between a VFD and a laser. I have two toggle switches at the front of the controller, the first is an on/off switch which when on sends 24v power to the laser, and the second switch is a on/off/on switch which sends PWM signal and Spindle Enable to the VFD or just the PWM to the laser.

The s command instead of going between 1-255 references the spindle speed. So S24000 now sends a 5v signal from the controller and when received by the VFD results in the max RPM, but the lowest signal I can send is 2v which would be something like 9600 RPM on the spindle. I changed the relevant PWM settings in the config.h file but this hasn’t made a difference, I can only send a signal between 2-5v. Because I’m using an air cooled spindle I shouldn’t run it bellow 10000 rpm but when I use the laser I’d like to have the full PWM range of 0-5v.

To be honest I could live with this but I’d like understand what is causing the range in the voltage signal. Is it something pre-written on the control board to act like a failsafe, or is there a more advanced setting in the firmware what could override this that I’ve overlooked?

What I have done is changed the value for the spindle PWM minium to 1. Originally I had it at 109 to try set a minimum speed but what I’m going to do is let the controller send the full range… I got a little bit desperate for an answer so I posted a question on the issues section of the GRBL v1.1 github page, and Chamnit replied and told me to look at the CPU_Map.h file and I think I found…

I think not. I have no idea what’s going on. The changes I made to the firmware did nothing. There you go.

I think I’m going to just live with this for now. I was speaking to Nathan about the problem with the PWM jumping from it’s off position from 0v to just over 2v and then being able to go through the range 2-5v. Which obviously in this case translates to the spindle starting at 10000 RPM which isn’t really an issue but when the laser I start at about just under 50% of the overall power of the laser. And it would be nice to be able to go from 0-100% throughout all the increments as opposed to missing the initial part out. The main thing I guess that effects is rastering black and white images and creating the impression of a grey scale on something your engraving. You miss that kind of detail out. Anyway I was speaking to Nathan about this and he thinks there’s a type of circuit that we could produce although he would have to tell me how to do it. I have no idea how I would go about this, in which the PWM from the controller would be mapped essentially 0-100% instead of what is roughly 50% and to 100% at the moment. I’d be curious to know if anyone has a similar problem or has noticed anything with their firmware or controller? The gentleman who produced this sent me a version of his firmware which I put on the controller but that didn’t work either. He’s been really helpful getting back to my emails so I’m really thankful for that. So it’s either something to do with what I’ve done with the controller, how I’ve set it up, or maybe I’ve damaged it in someway. His seemed to work – maybe there’s something problems with uploading the firmware although it seems to be uploading correctly from the arduino IDE. Like I said I think I’m going to live with this but what I will do is try get my hands on another controller maybe a different type or just a plane arduino board with a shield, in fact I do have one in the old controller. If I take that and flash it with the same firmware I should be able to compare the PWM signal from that with my current one.

So going back to the initial thing that this video was meant  to be about, cutting DXF files with a laser. Obviously you have to select the interior vectors first before cutting the outter vectors and tooling that up appropriately but also using something like a sheet of metal on your wasteboard which you can then put your piece of paper on and magnetically hold the piece that you’re trying to cut down. I’m sure if I just rested this like this I’d burn the wasteboard underneath so maybe I should think about maybe putting something else down as well. That was meant to be a drawing of a pug.

Leave a Reply