How to switch ON/OFF laser from GPIO of flight controller?

Hey everyone!
I am working on a project that is required to switch ON/OFF a laser from the GPIO output of the Pixhauk. I figured out how to switch on/off a LED by reading the documentation of the ArduSub and adjusting the parameters RELAY_PIN & BRD_PWM_COUNT parameters.

For my needs I choosed to use a photocoupler in order to switch on/off the laser but the signal of the GPIO isn’t enough. Could you suggest me an alternative way in order to achieve this. I am quite sure that by using a relay module it would work just fine but I would like to avoid it if it is possible.

Note: The laser works with 5V

Thanks in advance.

No, it is not possible.
Why do you want to avoid using a relay module?
They are only 1-2 dollars each at most.
Overdrawing current from GPIO pins may permanently damage the board.
There are relays with contactors and also some solid-state, take a pick.
Also, there is a way to on/off the load with a transistor.

1 Like