Author Topic: LaserGRBL doesn't switch the Laser ON  (Read 1596 times)

rpt007

  • Newbie
  • *
  • Posts: 48
    • View Profile
LaserGRBL doesn't switch the Laser ON
« on: January 12, 2018, 05:38:01 AM »
... my headline might be a bit misleading as I am not reporting a software failure.
Quite the contrary:

I am using currently an Eleksmaker L7 board (no mod with a pull down resistor yet).
As others I do have the issue with Eleksmaker's software and also T2Laser that the laser is switched ON when starting or closing the apps.
Before modding my board with a recommended pull down resistor, I replaced the laser with a blue LED (and a 1k resistor in series) to avoid too much burning innocent material to test the different software packages to make sure the LaserON problem is/is not software GRBL related, as read here and in other forums.

In my given configuration I got the following test results:

1. The Eleksmaker app switches the LaserON when starting up and when I close the app ...)
2. T2Laser has the LaserON problem (1-2sec) when switching from the LaserControl window back to the initial screen (only that direction causes a LaserON issue in my configuration, others report the other way round or in both directions, when switching between the windows).
3. LaserGRBL does NOT switch my Laser ON, neither on startup nor when closing the app - without having changed anything on the hardware side!

So, at least LaserGRBL is apparently configured in a way that it overcomes the floating issue, which is due to the boot up sequence of the Arduino. So a mod is not necessary for users who only use LaserGRBL.

My next step is to solder the pull down resistor to the L7 board to see if I can persuade T2Laser to leave the Laser OFF when returning to the main window and test, if it has any impact on LaserGRBL. Eleksmaker software has already been sent to the bin.

Do you have already thought about a solution yourself or is a part of the problem sitting in front of the screen?

ggallant571

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2171
    • View Profile
Re: LaserGRBL doesn't switch the Laser ON
« Reply #1 on: January 12, 2018, 07:08:20 AM »
I started out using a L7 and observed very similar results. I suspect it has something to do with the particular MOSFET on the board. You have a 4 pin connector which has the various signals including a convenient place to solder the resistor. A reverse engineered schematic is posted on this site,
 
SARCASM - Just one more service we offer here.

rpt007

  • Newbie
  • *
  • Posts: 48
    • View Profile
Re: LaserGRBL doesn't switch the Laser ON
« Reply #2 on: January 12, 2018, 12:38:49 PM »
Quote
I suspect it has something to do with the particular MOSFET on the board.

But it is a bit strange that LaserGrbl doesn't have the same issue with this board as T2Laser has.  I have both apps on the same Laptop and can switch back and forth from one app to the other without changing anything on the hardware connection side. So LaserGrbl somehow does something different so that the Laser MosFET is not triggered.

If I am not mistaken, one can find the source code of LaserGrbl on GitHub; so if somebody with more software knowledge than me could analyse why LaserGrbl seems to be a bit more clever than its competitors.
Do you have already thought about a solution yourself or is a part of the problem sitting in front of the screen?

ThothLoki

  • Hero Member
  • *****
  • Posts: 2019
  • Tinkerer
    • View Profile
Re: LaserGRBL doesn't switch the Laser ON
« Reply #3 on: January 12, 2018, 03:41:11 PM »
I had an A5 engraver with a 2 wire laser and an L7 board. At first, I always had issues with the laser on at connection. Then for some reason it went away. I was using T2 the entire time. I figured it was something in an update that fixed it and though nothing about it after that. Then I got my A3 engraver with a ManaSE board and have that issue again. I have not fixed it yet, but instead keep the board turned off until the connection is completed.

Yes, you are right. It is all in the connection and booting of GRBL in the Arduino. I would suspect that some programs are faster at initializing that others. Probably based on what language they were written in and how they were written. For all I know, some programs might have a delay function built in to assure a connection. Heck, some of it could be the individual arduino and how fast it is. Some are built better than others.
Laser: A5 2000mw with L7 Board / A3 2500mw PWM with Mana SE -- All using T2Laser
3D Printer: Monoprice Maker Select v2.1
Image Resizer Applications (All OS): http://benboxlaser.us/index.php/topic,1434.msg17297.html#msg17297

Zax

  • T2Laser
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5873
    • View Profile
    • T2Laser
Re: LaserGRBL doesn't switch the Laser ON
« Reply #4 on: January 14, 2018, 06:15:10 AM »
When you connect (open the COM port) the Nano gets power from the USB and boots-up, it's that brief moment it takes the bootloader to start Grbl that the output pin is floating (not assigned) which causes the laser to pulse. There is no software workaround except to keep the COM port open (a bad practice) or to leave the laser power off while Grbl initializes.

I haven't played with LaserGRBL (although they obviously have with T2Laser  ;) ) so I don't know what they are doing with the port but if you don't see the pulse then they must be leaving Grbl running which is a safety concern for me.

There is no way to cause the bootloader to be faster, but you can eliminate the bootloader and put Grbl on via ICSP and the pulse goes away, but so does the ability to flash via USB.

ggallant571

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2171
    • View Profile
Re: LaserGRBL doesn't switch the Laser ON
« Reply #5 on: January 14, 2018, 06:38:43 AM »
Is D11 used by the boot loader? If not, why not modify the the boot code to set the direction and levels as needed by the typical laser machine?
SARCASM - Just one more service we offer here.

arkypita

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: LaserGRBL doesn't switch the Laser ON
« Reply #6 on: January 15, 2018, 10:30:11 AM »
Quote
If I am not mistaken, one can find the source code of LaserGrbl on GitHub; so if somebody with more software knowledge than me could analyse why LaserGrbl seems to be a bit more clever than its competitors.

Better, you have me who I am its developer!

LaserGRBL open and close the COM port using the standard .NET SerialPort object.
https://msdn.microsoft.com/it-it/library/system.io.ports.serialport(v=vs.110).aspx

This is how COM port is initialized in GRBL

Code: [Select]
com.DataBits = 8;
com.Parity = System.IO.Ports.Parity.None;
com.StopBits = System.IO.Ports.StopBits.One;
com.Handshake = System.IO.Ports.Handshake.None;
com.PortName = mPortName;
com.BaudRate = mBaudRate;
com.NewLine = "\n";
com.WriteTimeout = 1000; //se si blocca in write

Logger.LogMessage("OpenCom", "Open {0} @ {1} baud", com.PortName.ToUpper(), com.BaudRate);
com.Open();
com.DiscardOutBuffer();
com.DiscardInBuffer();

And this is how it is closed:

Code: [Select]
Logger.LogMessage("CloseCom", "Close {0} [{1}]", com.PortName.ToUpper(), auto ? "CORE" : "USER");
com.DiscardOutBuffer();
com.DiscardInBuffer();
com.Close();

Quote
When you connect (open the COM port) the Nano gets power from the USB and boots-up, it's that brief moment it takes the bootloader to start Grbl that the output pin is floating (not assigned) which causes the laser to pulse. There is no software workaround except to keep the COM port open (a bad practice) or to leave the laser power off while Grbl initializes.

This is not correct. The nano is powered from the USB in the specific instant in which you plug the cable, the +5V is always present on a USB port and there is no way to control the +5V line of the USB line. The presence of power on the USB does not reflects the opening-closing of the serial.

Quote
I don't know what they are doing with the port but if you don't see the pulse then they must be leaving Grbl running which is a safety concern for me.

However LaserGRBL close the COM port both if you press the "disconnect" button from the UI or if you close the software, or if you kill the program from task-manager.
« Last Edit: January 15, 2018, 10:43:01 AM by arkypita »

arkypita

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: LaserGRBL doesn't switch the Laser ON
« Reply #7 on: January 15, 2018, 10:41:21 AM »
I dont' really know why the user rpt007 report two different behaviour with our two software and I cannot repeat the issue because i am not an owner of benbox. However if two different behaviour exist, something inexplicable must be there.

I suggest a deep analysis using a COM analyzer like https://www.eltima.com/it/products/serial-port-monitor/

Someone who has the issue (rpt007) could record a session with T2Laser and with LaserGRBL and export the recorded data.
Then share the dump file with us and let the boss (Zax and me) draw conclusions :-)

out of topic: this is not so uncommon to have different behaviour with different sw. some user report to me that LaserGRBL does not connect to some china cnc like CNC3018 that use woodpecker control board (a control board made with Atmega328 and grbl 0.9) but they can connect with UGS and other software...

Zax

  • T2Laser
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5873
    • View Profile
    • T2Laser
Re: LaserGRBL doesn't switch the Laser ON
« Reply #8 on: January 16, 2018, 06:23:55 AM »
If you connect your machine and then open the port using any software (Arduino IDE, CoolTerm or whatever) it causes Grbl to boot-up and the pulse happens BEFORE the startup string is sent by Grbl so I see no way software can prevent it.

arkypita

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: LaserGRBL doesn't switch the Laser ON
« Reply #9 on: January 16, 2018, 10:26:31 AM »
If you connect your machine and then open the port using any software (Arduino IDE, CoolTerm or whatever) it causes Grbl to boot-up and the pulse happens BEFORE the startup string is sent by Grbl so I see no way software can prevent it.

This sound more reasonable. I have write a simple arduino sketch to test what you say.

Code: [Select]
int counter = 0;
void setup() {
  Serial.begin(9600);
  counter = 0;
}

void loop()
{
  Serial.println(counter++);
  delay(1000);
}

With this code each time I open the arduino serial monitor the counter restart from zero.
This confirm that arduino is reset and boot at each connection.

BUT... not with LaserGRBL: with LaserGRBL the counter continues to increase.
I checked in debug and the com.Close() is successfully called without exception.

I am quite sure that the difference is not in the close moment but in the open. When LaserGRBL open the com it always show that the number is growing, also if the previous work session was done with Arduino that open and close serial.

Need more deep analyse

arkypita

  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: LaserGRBL doesn't switch the Laser ON
« Reply #10 on: January 16, 2018, 10:38:52 AM »
Look like it depend by DTR line. The board is not reset by the open/close COM but by the serial port DTR line going low and pulsing the Arduino reset pin AT CONNECT. You can prevent this if you can disable DTR on your T2Laser.

com.DtrEnable = false

instead of

com.DtrEnable = true;



Best regards
« Last Edit: January 16, 2018, 10:44:41 AM by arkypita »

Zax

  • T2Laser
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5873
    • View Profile
    • T2Laser
Re: LaserGRBL doesn't switch the Laser ON
« Reply #11 on: January 16, 2018, 10:42:26 AM »
No matter what they do, the pulse would still happen the first time they connect and power up the Nano. It cannot be avoided, as I've stated many times this is a design issue with the hardware and not a software bug.

If the USB remains powered so Grbl doesn't terminate when exiting their software (which it must since it doesn't reset) that's a safety issue as other programs could attempt communication with the COM port and cause unexpected motion or laser output.

DTR is already an option in T2Laser (Settings/Advanced menu on the Laser Control screen).

ggallant571

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2171
    • View Profile
Re: LaserGRBL doesn't switch the Laser ON
« Reply #12 on: January 16, 2018, 11:49:18 AM »
I tend to think it is best solved by adding the pull-down resistor. I also think disabling the DTR at the host is an option. I use Linux and have 3 etchers, one pulse on com port select, the other two don't. Could be they have different USB chips and that means different host system device drivers. Perhaps that is also possible on Windows.
SARCASM - Just one more service we offer here.

rpt007

  • Newbie
  • *
  • Posts: 48
    • View Profile
Re: LaserGRBL doesn't switch the Laser ON
« Reply #13 on: January 16, 2018, 12:20:13 PM »
I fixed the LaserON issue with adding a 10k pull down resistoron my l7 board as I want to use T2Laser once having paid for the license and while it has some features which LaserGRBL not (yet?) has.

My "usage sequence" is always like follows:
1. powering up (i.e. connecting the USB cable with my Laptop) while the control board is still OFF
2. starting the application
3. only then I switch the board ON
4. preparing the Laser operation
5. etch / burn

So I take care to not run into the boot sequence of the Arduino at the very start.
But, as stated above: after that sequence T2Laser and LaserGRBL behave differently on my machine and T2Laser powered the Laser ON for a couple of seconds when returning from the Laser control window to the start up window. Thus I started this thread stating that there must be a different handling of GRBL by the 2 applications.

Nevertheless all is ok now having applied the pull down resistor to my L7 board.
BTW: I also fixed the nerving hiss of my motors when T2Laser starts or switches between its two main windows by soldering a pull up resistor from D8 (=Enable Pin for the drivers)  to +5V.
See my pictures in this thread: http://benboxlaser.us/index.php/topic,2942.0.html

Raimund

« Last Edit: January 16, 2018, 12:21:33 PM by rpt007 »
Do you have already thought about a solution yourself or is a part of the problem sitting in front of the screen?

Zax

  • T2Laser
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5873
    • View Profile
    • T2Laser
Re: LaserGRBL doesn't switch the Laser ON
« Reply #14 on: January 16, 2018, 03:35:05 PM »
You are missing the most important fact I already stated. T2Laser does NOT power the port unless you are in the laser controller, it doesn't need to be on when you are setting up the job and/or generating G-code. Regardless this isn't a software issue, Eleks have already fixed the issue and acknowledged it was a poor design.

If you turn on the laser board and start any software which opens the port it would do the exact same thing if you have a bad driver. Obviously if the port was open and left open then it wouldn't.