Author Topic: A5 2.5Watt not responding to commands in file correctly using UGS  (Read 1225 times)

Hooty

  • Newbie
  • *
  • Posts: 11
    • View Profile
I'm not sure if this is limited to Universal G Code Sender, but it is the only program I have running that can send a .ngc file. 
 
I have a 2.5 Watt A5 that has been flashed to Grbl 0.9 and the jumper has been switched over.  If I manually send S5 nothing happens (as expected), then the laser turns on at a very low intensity with M3 and off with M5.  If I use file mode to send a .ngc file with the following commands, the laser turns on as soon as "G00 X10.000000 Y03.000000" command is sent with no regard for the M commands but the laser is at low intensity.  The same thing happens when I enter the first G00 line manually as well.

S5
F10000

G00 X10.000000 Y03.000000
G01 M3 F10000.0
G01 X15.000000 Y03.000000

G00 X0.0000 Y0.0000
M2

The same goes for if I enter the "G01 X15.000000 Y03.000000" line as well.  Anyone know why this keeps making my laser turn on?

Hooty

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: A5 2.5Watt not responding to commands in file correctly using UGS
« Reply #1 on: June 20, 2016, 07:58:02 PM »
First, I confirmed that I get the same results with 2 other G Code senders.  I found a way to get around this problem, but I would like to find out why I'm getting this behavior.  In the following example, the M commands don't do anything in Grbl 0.9.  (this is the resulting output of a 10mm square in Inkscape using Gcodetools)

%
(Header)
(Generated by gcodetools from Inkscape.)
(Using default header. To add your own header create file "header" in the output dir.)
M3
(Header end.)
G21 (All units in mm)

(Start cutting path id: path3352)
(Change tool to Cylindrical cutter)

G00 Z5.000000
G00 X10.000000 Y20.000007

G01 Z-1.000000 F10000.0(Penetrate)
G01 X10.000000 Y9.999996 Z-1.000000 F2000.000000
G01 X20.000000 Y9.999996 Z-1.000000
G01 X20.000000 Y20.000007 Z-1.000000
G01 X10.000000 Y20.000007 Z-1.000000
G00 Z5.000000

(End cutting path id: path3352)


(Footer)
M5
G00 X0.0000 Y0.0000
M2
(Using default footer. To add your own footer create file "footer" in the output dir.)
(end)
%

To get this to work on my machine with Grbl 0.9 I first deleted the M codes (except the M2 at the end) because they weren't doing anything even if I added an S code.  After a lot of trial and error I found that if I replaced every instance of Z5.000000 with S0 M5 and Z-1.000000 with S50 (or whatever power I need) M3. 

It works and gets my laser turning on and off when it's supposed to, but I still don't understand the weird behavior of the laser switching on with the lines that start with G and a number.

Zax

  • T2Laser
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4235
    • View Profile
    • T2Laser
Re: A5 2.5Watt not responding to commands in file correctly using UGS
« Reply #2 on: June 21, 2016, 04:57:25 AM »
Well you don't say which Grbl firmware you have loaded, but I suspect that's the issue.

I always set S0 and M05 to ensure the laser is off and M03 then the S power you want to turn it on.

Can you post an example of your .ngc file? I suspect it's just G-Code which you could open with any program.

Are you only interested in cutting? BenCutLaser may be of interest to you.

Hooty

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: A5 2.5Watt not responding to commands in file correctly using UGS
« Reply #3 on: June 21, 2016, 07:17:14 AM »
I am running Grbl 0.9.  (I may have been having a similar issue with Grbl 0.8 and didn't realize it)

16mm Die 24 +1 +1_0001.ngc (I don't expect this one to work)
   is the original unmodified output from Inkscape using the Gcodetools extension.  It doesn't add F and S values in the header so the gantry crawls to the initial job position and then the first speed setting is defined so it begins moving at the defined speed, but the laser never turns on.  I know that it has M3 in the header, but that doesn't matter because I'm using Grbl 0.9 and no S value has been set.  It looks like the Gcodetools extension is made for rotary tool CNCs running Grbl 0.8.  It turns on the tool at the beginning of the Job with M3 and uses Z axis commands to raise and lower the tool.  This is not a big deal because Inkscape is still the best free tool I have found for the type of precise layout I need to do and performing a simple Find/Replace on the output file to replace the Z commands only takes a few seconds.

16mm Die 24 +1 +1_0002.ngc
   has been modified to remove the initial M3 in the header and replace it with S50 to set the pwm speed (in this case, power level of the laser) and F10000 to get gantry moving faster to the initial cut.  I replaced all of the Z0.100000 (tool up) commands with M5 to turn off the laser and Z-1.000000 (tool down) commands with M3 to turn it on.
   In theory this should work, however I never got to test this theory.  As soon as it gets to the first G00 line, the laser turns on and remains on until the M2 command at the end of the job.  Something about the G commands is making my machine act screwy.

16mm Die 24 +1 +1_0003.ngc
   is what I did to achieve the output I was looking for.  Instead of setting an initial pwm speed, I left it 0 and replaced Z0.100000 with S0 M5 and Z-1.000000 with S50 M3. S0 by setting S to 0 and only changing the value to high when I wanted the laser on, I got the intended output.  I added the M codes, but they really aren't necessary in this case because the laser will activate with power level 50 as soon as the G command on the next line is sent.

Further Testing
   I found that if I manually send S50 I can use M3 and M5 to turn the laser on and off.  However, if I manually send S50 and then G00 X93.999999 Y17.999992, the laser turns on and doesn't turn off with M5.  I have to send M2 (program end) to get it to shut off.

Zax

  • T2Laser
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4235
    • View Profile
    • T2Laser
Re: A5 2.5Watt not responding to commands in file correctly using UGS
« Reply #4 on: June 21, 2016, 07:33:53 AM »
It is missing a portion of the file (or showing it incorrectly) as you are using arcs which T2Laser doesn't support, but your code looks good.

So what's the original look like?


Hooty

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: A5 2.5Watt not responding to commands in file correctly using UGS
« Reply #5 on: June 21, 2016, 08:03:09 AM »
16mm Die 24 +1 +1_0001.ngc:  The laser never turns on
16mm Die 24 +1 +1_0002.ngc:  The laser turns on and never turns off so the paths between objects get burned as well
16mm Die 24 +1 +1_0003.ngc:  I get the output you posted.

I'm trying to figure out why it kicks on the laser as soon as the G commands start.  It's not just Universal G Code Sender.  I tried it with bCNC and got the same results.  Any Ideas?

I was just looking at some G code examples and they all have G0, G1, etc. and my inkscape output has G00, G01, etc..  I wonder if that makes a difference.  I am at work right now so I'll have to test when I get home.

Zax

  • T2Laser
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4235
    • View Profile
    • T2Laser
Re: A5 2.5Watt not responding to commands in file correctly using UGS
« Reply #6 on: June 21, 2016, 09:46:52 AM »
You say your using Grbl 0.9, but are you using v0.9j or something else?

(I believe "j" included a bug fix for the issue you are describing)


G01 X10.00000 Y0.50000 is the correct format but due to Grbl having a limited buffer it is common to remove unnecessary characters so that line would become G1X10Y.5 and run exactly the same.

Hooty

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: A5 2.5Watt not responding to commands in file correctly using UGS
« Reply #7 on: June 21, 2016, 11:07:06 AM »
I am using one of the following 2 from your "Some Grbl firmware" thread under "Flashing Firmware"  Not sure what version they use.

* jtech_grbl.hex (75.99 kB - downloaded 131 times.)
* laserink_grbl.hex (74.3 kB - downloaded 84 times.)

I swapped between the two for a while trying to figure out why my laser quit working after flashing and can't remember which one I was on when I realized that I needed to define S for the PWM output.

Zax

  • T2Laser
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4235
    • View Profile
    • T2Laser
Re: A5 2.5Watt not responding to commands in file correctly using UGS
« Reply #8 on: June 21, 2016, 11:20:50 AM »
OK, those are laser branch Grbl for engraving (scanning) most likely 0.9g.

If you are only doing vector and don't need to change S values on-the-fly you can go with the master branch version 0.9j which should fix your issue.