Author Topic: Pin 11 PWM remains after image completes  (Read 14617 times)

Agastar

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1878
    • View Profile
Pin 11 PWM remains after image completes
« on: July 09, 2016, 05:20:15 AM »
I disconnected the arduino and hooked up my O'scope to pin 11 to see the PWM in action. I loaded an image using grey scale and clicked send gcode. After T2 completed I noticed there was still a 4.2us wide pulse on that pin. This goes away after you left click the stop button so I don't know if it is related to T2 or the J-TECH branch of GRBL that I'm using.

Obviously my laser module doesn't currently work with PWM so it's not an issue but I just wanted to let you know.

kn4ud

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 753
    • View Profile
Re: Pin 11 PWM remains after image completes
« Reply #1 on: July 09, 2016, 05:35:59 AM »
Very odd, I would think the pulse width would be changing. I have tried the firmware for Ralph's Bencutlaser and had better control of the laser over a larger range than with the j tech firmware. Please, keep us informed of your progress.
Allen

Zax

  • T2Laser
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5234
    • View Profile
    • T2Laser
Re: Pin 11 PWM remains after image completes
« Reply #2 on: July 09, 2016, 05:56:10 AM »
At the end of your G-Code (in T2Laser) there should be an M03 S0 which sets the output to 0 (essentially off) and then an M05 which disables the laser output.

If there is still an output on D11 it must be something with the firmware, but I haven't seen that behavior.

Agastar

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1878
    • View Profile
Re: Pin 11 PWM remains after image completes
« Reply #3 on: July 09, 2016, 06:35:57 AM »
@kn4ud The pulse width does change during the process (if I look at pin 11 directly but that's a whole other issue) but once the process has completed, a very small pulse remains.

@Zax I figured it might be which is why I'm going to try another grbl branch and see what it does with that. Also, what does left clicking the stop button do? I only ask because that caused the behavior to stop. I can't see the end of the gcode since I'm running the trial version.

kn4ud

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 753
    • View Profile
Re: Pin 11 PWM remains after image completes
« Reply #4 on: July 09, 2016, 07:15:38 AM »
Thanks for setting me in the right direction on that, I was misunderstanding I thought the pulse was not changing. My bad.
Allen

Agastar

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1878
    • View Profile
Re: Pin 11 PWM remains after image completes
« Reply #5 on: July 09, 2016, 08:18:19 AM »
no worries :)

Zax

  • T2Laser
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5234
    • View Profile
    • T2Laser
Re: Pin 11 PWM remains after image completes
« Reply #6 on: July 09, 2016, 08:24:04 AM »
Left click is essentially a soft reset, it does several things which includes setting the laser off and forcing Grbl to clear it's motion buffer and immediately stop motors.

Agastar

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1878
    • View Profile
Re: Pin 11 PWM remains after image completes
« Reply #7 on: July 09, 2016, 08:40:17 AM »
Yeah, it definitely sounds more like it has to do with the GRBL firmware.

Agastar

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1878
    • View Profile
Re: Pin 11 PWM remains after image completes
« Reply #8 on: July 09, 2016, 12:11:57 PM »
Ok here is what I found out...

GRBL 0.9i does not continue to pulse the laser once it has completed executing the gcode. The frequency is about 7.8Khz and the maximum pulse width measured was 36us.

Laserink GRBL does continue to pulse after the the gcode has completed executing. The frequency is about 7.8Khz and the maximum pulse width measured was 100ms.

J-TECH GRBL does continue to pulse after the gcode has completed executing. The frequency is about 1Khz and the maximum measured pulse width was 100ms.

kn4ud

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 753
    • View Profile
Re: Pin 11 PWM remains after image completes
« Reply #9 on: July 09, 2016, 12:18:13 PM »
Good work Agastar. Which one is going to work better with the ttl conversion.
Allen

Zax

  • T2Laser
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5234
    • View Profile
    • T2Laser
Re: Pin 11 PWM remains after image completes
« Reply #10 on: July 09, 2016, 12:41:23 PM »
Here's a quick video I made using the TTL controller board with T2Laser:

https://youtu.be/t3h7l1PbrPU

It produces a very linear progression all the way through the range (0-255). Since the camera didn't capture much change after around 50 (it was changing to my eyes but the camera was saturated) I just jumped in units of 10.

This was using a 250mW red diode, connected directly. The board allows you to setup both voltage and current.

So next step would be to wire this permanently to the laser module.

Zax

  • T2Laser
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5234
    • View Profile
    • T2Laser
Re: Pin 11 PWM remains after image completes
« Reply #11 on: July 09, 2016, 12:54:32 PM »
Here's some pictures of the connection, you just need to connect the diode to the laser output and the PWM pin (I plugged onto the 0.9 pin directly under the Nano) and a ground connection to the TTL input.

Zax

  • T2Laser
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5234
    • View Profile
    • T2Laser
Re: Pin 11 PWM remains after image completes
« Reply #12 on: July 09, 2016, 12:57:03 PM »
In case anyone wants the G-Code for testing, here's what I used.

Agastar

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1878
    • View Profile
Re: Pin 11 PWM remains after image completes
« Reply #13 on: July 09, 2016, 01:24:13 PM »
@kn4ud Personally I'm going to stick with the J-TECH grbl branch as it seems to perform the best for me and I'll just be sure and left click stop or close that window and it will be fine. I don't think it is going to be that big of a deal as that small of a pulse probably won't even turn on the laser. Knowing it is there I'll be sure and watch out for it though.

@Zax, Nice job! I like the idea of driving it from pin 11 directly. That's what I'm planning to build the TTL circuit to run off of anyway. Seems simpler and it won't be carrying any load so no reason not too.

Zax

  • T2Laser
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5234
    • View Profile
    • T2Laser
Re: Pin 11 PWM remains after image completes
« Reply #14 on: July 09, 2016, 01:37:29 PM »
I used J-Tech for testing and at S0 there was no output (as you can see from the video), so the short pulse is obviously ignored by the driver.