[HELP NEEDED] Switch OPN/OFF laser with Pixhawk & Ardusub

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.

This article should give you some ideas.


Hi @Ioannis,

The Pixhawk GPIO pins aren’t intended to supply much current (like required by a laser), and they operate at 3.3V. @wholm’s article link is a good one, although it’s worth noting that if you have or can get a logic-level MOSFET (which the author just didn’t happen to have) then you should be able to skip the opto-coupler and just switch the MOSFET directly using a relay signal from the Pixhawk, which can then power the laser :slight_smile: