How to include Lasers in WLED-Setup?

Hello, dear WLED-community, can plase anybody tell me how to include laser-modules
in a WLED-Setup.
I want to connect it to one of the pins from a ESP32MiniNode and toggle the laser on and off via one of the WLED-interface-parameters.
I found out in the video linked in the following link:

that the on/off-switch can be achieved via setting
“digitalWrite” “high” or “low” in the code.
But unfortunately i´m not good in coding and i dont know how to implement it or how to create such a usermod for wled. I guess another solution would be integrating a relay but i really prefer a solution without a relay because i need a small/lowweightsolution and relays are to big for my project.
I hope someone knows how to accomplish that,
thank you anyway for reading, kind regards!
Tonda

You can use some transistors instead of relays, if they are laser pointers they don’t have to be big…

thx for reply allreaddy ! can you please give me some infos how to use transistors ? Would you use a usermod for this ?

I speak to you from ignorance, because I have not tried any mod, but if it is supposed to be for relays, I think that changing them for transistors will be the same. Look at the image of this link https://i.pinimg.com/originals/6a/af/5c/6aaf5cf6c69d25cb5e6cde1e8682e45a.png, replace the diode and the relay with the laser, I think this would be enough… (as long as the mode works as “high” and “low” on the pins…)

Sorry for my noob-question but which components exactly are needed for this setup seen in the picture https://i.pinimg.com/originals/6a/af/5c/6aaf5cf6c69d25cb5e6cde1e8682e45a.png , i guess a ESP32MiniNode, a KY008 Laser Module and what else… a 1K-Transistor ? thank you for your help & kind regards

Hello, yes, you need a 1k resistor for the driver of the bd137 transistor. And the laser will be connected as if it were the image relay taking into account the polarity.

Could also set it up as an on/off LED.

image

thx for your feedbacks , i tested it now with the multi-relay-usermod.
I just connected the laser instead of a relay directly to the pin which i declared as relay-pin in WLED.
i used a macro-button to controll the relay which was a available option from the usermod, called “extern”.
It directly worked. No transistors or resistors were needed in this case. but i´m not sure if the laser glows at it full brightness.

also thx to tonyno i will also test this option.

You can still connect it directly to the output, but I (speaking from the arduino side) prefer to heal myself and put a transistor in between, any problem with laser consumption that exceeds the maximum power supported by the output could end badly for that exit or even in micro…

Tonyno: Thanks for that information because I haven’t seen it… (I recently discovered this marvelous project).