Jump to content

Laser on Klipper


Recommended Posts

Hello good people!

I have raised this question on the Klipper forums but there is no answer over there... 😞 I thought maybe someone here has this experience already and worth  a try  anyway... Honestly I have observed that over here the members are more friendly than elsewhere!

So, I have an SKR Pico module and a PWM controlled laser. Until now I have tried the following (as suggested here github sample-pwm-tool)

[pwm_tool LASER]
pin: gpio20
pwm: True
cycle_time: 0.001
shutdown_value: 0

[gcode_macro M3]
gcode:
    {% set S = params.S|default(0.0)|float %}
    SET_PIN PIN=LASER VALUE={S / 255.0}

[gcode_macro M5]
gcode:
    SET_PIN PIN=LASER VALUE=0

Also tried a simple macro to see if makes any difference:

[gcode_macro LASER_ON]
gcode:
    SET_PIN PIN=LASER VALUE=1

[gcode_macro LASER_OFF]
gcode:
    SET_PIN PIN=LASER VALUE=0

The fan of the laser module is working but there is no laser action. I’ve seen that the Pico board has the same pin “io20” for the laser and for the FAN3 port. skr-pico-pinout

When I execute the “laser on” macro, a small LED next to FAN3 port, lights up. Currently the laser module is plugged in the dedicated laser port of the Pico. Can you please give me some idea? I really appreciate it!

Edited by eugen360
Link to comment
Share on other sites

1 hour ago, eugen360 said:

Honestly I have observed that over here the members are more friendly than elsewhere!

Welp, we're going to have to work on that. 😄

I'm not even close to being knowledgeable about this but here goes anyway.

According to the drawing... The SKR laser connection has two addressable pins. io0 and io1. If you're sending a signal to io20, that would make sense that it lights the led associated with it.

image.thumb.png.03e2ad8ca4b9704f793b6a1150a541d3.png

Link to comment
Share on other sites

Hi, really thank you for the reply!

Well I am connecting to the other side of the Pico:

image.png.bac4820050d58cc4efd5de13b632cb3f.png

This connector has 3 pins: V+, GND and PWM (what I need), the one that you are showing me is for TTL (see the 5V pins...). At least this is what I understood from all the searches made in the last weeks... 🙂 I even asked Chat GPT... 🙂

  • Like 1
Link to comment
Share on other sites

OK, I see that now. And it kind of makes sense that the fan and the laser are tied together, assuming that the fan needs to be on when the laser is on. 

Have you read thru the Using_PWM_Tools.md document? 

I think this might be your issue...

You're setting you laser output value to 1 and it states below that you need to select a value between 0 -> 255. Setting it to 1 is pretty much off so I wouldn't expect any real output. try setting it to 125 which is ~1/2 of max power. I pretty sure the laser is is capable of outputting at 10%, 50%, 100% or somewhere in between.

image.png.cac1a514e3a898f08adae82e194e9d5b.png

[gcode_macro LASER_ON]
gcode:
    SET_PIN PIN=LASER VALUE=125

Also probably have the laser pointing in a safe direction when doing that.

 

Link to comment
Share on other sites

 

LASER VALUE=1 was only a test. First one I've tried the other one, as in the PWM tool example

 

[gcode_macro M3]
gcode:
    {% set S = params.S|default(0.0)|float %}
    SET_PIN PIN=LASER VALUE={S / 255.0}

 

 

Link to comment
Share on other sites

9 hours ago, Yezariael said:

Why Klipper? LaserGRBL is designed for this purpose.

Klipper has a nice web interface and can be run on many different control boards while, from what I can find, GRBL needs to run on an Arduino connected to your PC. I found a GRBL hat for a Raspberry pi but that project has been dead for quite a while. The LaserGRBL software looks interesting and was very recently updated but I can't find anything about using it to control an engraver over the network. Are you running LaserGRBL and what does your setup look like?

Link to comment
Share on other sites

Hi. 

I have also klipper with skr pico and with laser pwm control on the same input as you. Klipper see on the first start a problem with IO20, this was in the printer.cfg file 2 times. One for the laser, second for the fan. So I delete this for fan in printer.cfg

See attached image. 

And my simple g-code 

 

Laser is J-tech with 5v pwm input 

 

IMG_20240615_204125.jpg

IMG_20240615_204107.jpg

IMG_20240615_204254.jpg

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

Posted (edited)
23 hours ago, Penatr8tor said:

What laser are you using?

I have this 20W version laser

 

21 hours ago, Yezariael said:

Why Klipper? LaserGRBL is designed for this purpose.

Klipper has a nice interface, easy to modify, you write a macro in code and just like that you have a button on the main page. I know GRBL exist but as far as I know can only be used on 8bit electronics... And with all this new fancy and fast 32bit boards, I do not want to return to the old CNC shield for Arduino Uno or to the Ramps 1.4 board 🙂 And the Pico was just waiting there for a new project / headache ...

Edited by eugen360
  • Like 2
Link to comment
Share on other sites

12 hours ago, Kaktuscai said:

I have also klipper with skr pico and with laser pwm control on the same input as you. Klipper see on the first start a problem with IO20, this was in the printer.cfg file 2 times. One for the laser, second for the fan. So I delete this for fan in printer.cfg

Thank you for your reply!

I have the fan deleted in cfg file from the first time so isn't the conflict for me... One interesting fact is that if I use "hardware_pwm: True" I get this error:

Option 'hardware_pwm' is not valid in section 'output_pin laser'
Once the underlying issue is corrected, use the "RESTART"
command to reload the config and restart the host software.

If I put just "pwm: True" (as indicated somewhere else) than I have no error but also laser not working.

 

 

Link to comment
Share on other sites

I have tested just the laser module itself with +12V, GND and shortly adding the same +12V on the PWM pin... someone on Klipper suggested me to try that. Well, the laser it's not working at all. 😞 I do not know if this is a legit way of testing the laser but sure thing, there's no laser!

  • Sad 1
Link to comment
Share on other sites

Hello again. 

I think, you may have destroyed your laser board. My laser from J-tech has 12v for power and 5v for pwm. 

So, I think, 12v for pwm is a bad idea... 

Do you have the exact datasheet for your laser and control board? 

Link to comment
Share on other sites

5V is for TTL, 12V for PWM is Ok. This module can be operated on PWM from 3 to 12V.

It's not a problem with the voltage... if the module is still working must be something else regarding the proper config file.

Link to comment
Share on other sites

Hi again,

I have another guess ... maybe it is something with the GPIO pins. Pico has two gpio20, one for FAN3 port and same gpio20 for laser port. I guess I am controlling the one for the FAN3 port because like I said the small LED is acting accordingly on the M3 and M5 commands. The question is how do I "transfer" this to the laser port?

Found some information's here and here but still not enough ... I'm pretty sure that even if there are 2 gpio20 only one is generating the PWM signal and in this case obviously is the FAN port... Somehow I must route that to the laser port. 

Link to comment
Share on other sites

I guess the journey will soon end...

With the laser came a small piece of paper with the following:

-Operating voltage 12V
-PWM / TTL input 3.3-12V
-Prefered 5 KHz
With the laser module connected and all electronics started, I’ve commanded the laser from Mainsail to Fully ON and measured the voltage on the pins. The voltages are correct; 12V between GND and (+) pin and 3.3V between PWM and GND. This 3.3V oscillates correctly as I modify the power from Mainsail.
So everything is ok but the laser module does not fire… I guess I know what is the problem. The SKR board generates PWM signal between 0-3.3V and the laser requires between 3.3-12V according to the paper, or am I missing something??  I have tried to connect the FAN3 (+) pin to the PWM pin on laser module but there is no more start / boot of the board.

Does anyone have another idea please? Slowly I'm loosing my mind...

Yesterday I have tried more than 3 hours to connect a BTT Pi board to the Wifi network, installing, reinstalling OS of different versions, powering the module on USB, powering on 12/24V port, measuring voltages on the board to see if 3.3 and 5V are present, modifying the router setting, making new Wifi networks with different settings on the router.... all in vain!  In the end I've found on some forums the amazing fact that there is a problem with BTT Pi boards connecting to Wifi... 😞 I've put a LAN cable and ... problem solved under 1 minute.

This has nothing to do with the laser story... It's just another story...

 

Link to comment
Share on other sites

1 hour ago, eugen360 said:

Yesterday I have tried more than 3 hours to connect a BTT Pi board to the Wifi network, installing, reinstalling OS of different versions, powering the module on USB, powering on 12/24V port, measuring voltages on the board to see if 3.3 and 5V are present, modifying the router setting, making new Wifi networks with different settings on the router.... all in vain!  In the end I've found on some forums the amazing fact that there is a problem with BTT Pi boards connecting to Wifi... 😞 I've put a LAN cable and ... problem solved under 1 minute.

I struggled with the WiFi on my CB1 board for a while before remembering to plug in the WiFi antenna.

BTT_Wifi.thumb.jpg.6fccbc22eb1660046aa0d34f6b7c97e4.jpg

Link to comment
Share on other sites

9 hours ago, eugen360 said:

Does anyone have another idea please? Slowly I'm loosing my mind...

I feel your pain. I've had stuff happen that has caused me to throw my hands up and say, never again.

One thing I will never buy are... Raspberry Pi clones, for all of the reasons you've outlined. And the same goes for other Chinese clones like Cartographer and BTT Eddy, Clone hotends, etc.

When I was riding dirt bikes... my friends gave me crap b/c I spent an extra 100 bucks to get Alpinestars boots. I was like... If you're 2 hours away from camp and you have a blister because of your cheap boots... you would gladly pay the extra 100 to not have to ride back in excruciating pain.

The headaches of cheap stuff because I wanted to save a few bucks isn't worth the frustration to me.

  • Like 3
Link to comment
Share on other sites

5 hours ago, Penatr8tor said:

One thing I will never buy are... clones

My mum (Bless her soul) taught me that buying cheap initial,  is expensive buying in the end.  Have been using beacon on two machines and cartographer on 4 (only because of canbus)

"After about 6 weeks of use, I have decided that  am changing the cartographer probes to Beacon - even if the USB cable will be adding to the umbilicus.

This is an individual choice, based on my personal experience." (Have posted this in my thread, sorry to hijack this)

  • Like 1
Link to comment
Share on other sites

Hi,

Well, in very simple words... I found the problem! But what a journey... hours and hours, days of work in vain! Unbelievable! I'm so tired and empty that I can not express myself... Last night I decided to abandon the fight and opened up the laser module, maybe is something wrong over there, I thought. Only 4 screws that holds the small module on the heatsink that hides the laser diode. Well, guess what? One of the 2 leads that goes to the laser diode was unsoldered, disconnected, in air...  I mean, how on Earth can happen such thing? The diode is in it's brass heatsink and that is the big aluminum heatsink (down the hole), impossible to reach, impossible to take out, impossible to re-solder... I could try to heat up the aluminum maybe it will release the brass tube, but... I'm just tired

  • Like 1
Link to comment
Share on other sites

15 hours ago, mvdveer said:

My mum (Bless her soul) taught me that buying cheap initial,  is expensive buying in the end.

Yep. 🙂

My nephew (sisters' son) lived with me for 5-6 years (he made a few life mistakes and needed some help). He was/is one of those guys that's always looking for some shortcut. 😁 I told him... The problem with shortcuts is that there's always a dead end and you end up having to double back. The long way "IS" the shortcut. 😉

  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...