Enabling laser engraving using Ender 3 S1 Pro

Basic Information:

Printer Model: Ender 3 S1 Pro
MCU / Printerboard: Chip - STM32F401

Describe your issue:

I have been trying to post on Reddit to find an answer but without any luck… I have an Ender 3 S1 Pro, and I would like to use the laser module that comes with it without having to reflash to the original firmware every time. I want to use Klipper instead. Does anyone have an idea of how I can achieve this?

So what I want to achieve are two things:

  1. Apply the branch @Cirromulus has developed to speed things up
  2. Configure printer.cfg correctly
1 Like

For application of the branch, I suggest reading this HowTo for git to understand the commands: How To Checkout Git Pull Request In Three Easy Steps

So basically, for my PR, you first get the code changes in your local repository: git fetch kevin pull/4128/head:pwm_sync_channel.
Then, to actually apply this branch, type git checkout pwm_sync_channel.
(In doubt, to revert to kevin’s main branch, type git checkout master).

To apply, restart the klipper service: sudo systemctl restart klipper.service (assuming you use the systemd service).

As I don’t have your printer, I don’t know the pinout of the laser’s PWM input.
How is the pin called in the original printer’s firmware? You would need to translate that.

Just for Interest, the laser pin seems to be PC0 (see Ender-3S1/pins_CREALITY_S1_F401RC.h at 7ea2f46033db0e9229cbb950e74ce569366dfbef · CrealityOfficial/Ender-3S1 · GitHub).
If someone can test this, would be nice.

I have tried PC0, but I get no response. No error message is shown in the console or log. The command is simply ignored.

I am not the only one with this issue. For anyone interested, take a look at the discussion here (and reply here!):

For setting up the printer.cfg, I used the following as a guide:

If someone has successfully enabled the laser module using either the current Klipper branch or the branch by @Cirromulus, please let us know.

Ok, I see.
It seems that there is (thankfully) a protection circuit (see https://www.reddit.com/r/klippers/comments/xeywbj/comment/ir5y4yp/?utm_source=share&utm_medium=web2x&context=3)
The user reports that the fan turns on immediately when inserting the laser ribbon cable.
This makes sense to me, as most lasers I know are active-low, and without that, the laser would start burning as soon as you plug it in.

Does anyone have a detailed photo of the PCB, or even a layout diagram? There may be a switch that detects a plugged-in laser.

I only have these

Only allows me to upload 1 image per post

That was me, the weird thing is i can’t control the laser with PC0 which is the pin according to Marlin config. I tried all values from 0-255, its always off. I even tried configuring PC0 as a fan and setting the fan speed from GUI, still no output. Works fine with stock Marlin :roll_eyes:

Ok, do you find a Mosfet or something for the “24V in 24V out” (probably GND and VCC)?
Maybe they have a different pin that enables GND and/or VCC to the connector.

I can’t read chinese, but I do not find hints on a software-enabled switch (Probably most interesting area:
Ender-3S1/spindle_laser.h at main · CrealityOfficial/Ender-3S1 · GitHub)
Reading that, I suppose a hardware-solution.
But in any case, it says that the Laser is active low, as expected.

Hi there.

I can confirm the pin is PC0. The worse is, there seems to be a design bug, i had used the laser a few hours. Not with kipper, because i was not able to run klipper without the hotend/extruder, maybe someone can help me out here.

I was using the stock firmware, it’s very buggy, it can turn the laser on unexpected, for example during Z axis tune (focus). Be carefull. Stock commands are M3 (0-1000) and M5. Also M3 I S0 is fine and inline S works.

The problem is my PWM pin stopped working. It seems to be connected directly from the STM from the PC0 pin via 32 Ohm R243 resisor to the PWM pin. It’s late today, but tomorrow i will try to run the board on the desk and measure if the STM pin PC0 is alive.

Hi is there any progress on the topic or is everybody reverting back to stock firmware to use the laser module?

I am back at stock for engraving. Was not able to configure klipper without hotend temperature sensor, and can not connect this when in engraving mode because the extruder is removed then.

Thanks for the info although I am surprised no one managed to get iz going with Klipper since it is a paint to revert back and forth with stock fw and it is kind of hard for me to let go of Klipper and ali things that it brings.

That is true. I even can’t find information how to run klipper without the printhead (without hotend temperature sensor). Possible the development and discussion is somewhere else, discord or any other platform, I dont know.

I still got no success with Klipper + Ender 3 S1 Pro. Maybe it’s just not possible?

Klipper does not need a hotend temperature sensor.
I suggest using a configuration without extruder, then it does not require a temp sensor.

1 Like

I created a solution for this, which I wanted to share. The solution is made to upload a gcode to klipper and “print” it. I use a ender 3 s1 pro - f103 chip - laser module. As far as I know the 401 Chip should be fine with this too.

The printer.cfg needs to be changed massivly. So make a backup for you printer settings and start anew for laser.

First of all: remove everything which does interact with the [extruder]. Also something like bed_mesh or btouch needs to be removed.

add
[pwm_tool laser]
pin: PC0
shutdown_value: 0

and at least those two macros. Watch out: A lot of M3 is for debbuging settings. I use the cura printer software for creating my gcodes for the laser. It does Scale from 0 up to 1000. If your software has other steps, you should scale M3.

[gcode_macro M3]
description: Laser an mit vereinfachtem Power-Handling
gcode:
{% set power = params.S|default(0)|int %}
{% if power < 0 %}
{% set power = 0 %}
{% elif power > 1000 %}
{% set power = 1000 %}
{% endif %}
RESPOND MSG=“Laser Power: {power}”
SET_PIN PIN=laser VALUE={ power / 1000.0 }

[gcode_macro M5]
description: Laser off
gcode:
SET_PIN PIN=laser VALUE=0

I also added another macro, since you dont have BTouch anymore.

Change stepper_z so you can move your head a little downwards after “homing”

[stepper_z]
endstop_pin: !PA7
position_endstop: 0
position_max: 270
position_min: -30

for simulating the home process use the following. This just accepts the current z position as z=0, which lets you move your laser through klipper. Without homing klipper does not allow anything:

[gcode_macro HOME_ALL]
description: Home all axes
gcode:
G28 X Y
SET_KINEMATIC_POSITION Z=0

[gcode_macro HOME_Z]
description: Home Z axis
gcode:
SET_KINEMATIC_POSITION Z=0


Alright. This was the setup. Now to the laser process. I use the Cura Software to create a gcode. I tried other softwares, but I am not using the laser much, so I am fine with the custom software.

The gcode is created as follows:

G0X101.750 S499
G1X117.250

The S499 is the laser for 50% power. Klipper does not take that input. I use a chatbot to transform my whole code to:

G0X101.750
M3 S499
G1X117.250
M3 S0

With this transformation the code and klipper is fine to laser my gcode. I know that’s a lot of changes, but I still wanted to share a functioning workaround, since I did not find anything.

1 Like

Hello @mischva11 !

Please format your code with the Preformatted text feature of the forum editor, else the code may become useless because or the reformatting of the editor (this is prevented by using Preformatted text - its the </> icon)