Switching MOSFET with AUX pin

I want to switch some 5 V LED lights using a spare AUX port on a Pixhawk Clone. I’ve set this up using the “relay” option and it basically works fine.

What I didn’t consider was, that the logic level voltage is only 3.3 V and the MOSFETs I have available, need more voltage on the gate to completely switch on (LEDs light only dimly now, not enough current coming through)

Now the most forward thing to do, is getting some logic level MOSFETs, which I most certainly will…

But I was still thinking of maybe solving this problem by using some components I already have.

First idea is using a NPN BJT on the gate, but then I would need to invert the signal (normally high not low) - is this possible by configuring the Pixhawk/Arducopter?

The documentation states, that the “relay” pin will use a voltage of either 3.3 V or 5 V. But I guess this doesn’t mean the voltage can be changed but refers to different boards? Or is this possible?

Any other/better ideas?

I was also thinking of using a Darlington transistor like the TIP120, which would work, but the downside is, that it will drop the voltage too much.

I’ve used a optocoupler to switch the MOSFET gate with 5 V instead of 3.3 V.

Drone5VLEDMOSFETSwitchImproved.pdf (21.3 KB)

If you have a second transistor you can invert the signal again… If you just want to switch lights, does the inverted signal even matter? Just send the inverted command to effect the transition you want… I have inverted output signals for driving dual half H bridge motor drivers but accomplished this by altering the code.

The solution with the opto-coupler does work fine so far. It doesn’t invert the signal and also isolates the MCU pin from the MOSFET and the higher voltage.

But you are right, I simply forgot, that I can adjust my signal however I like. :wink:

How did you set up the mosfet on the pixhawk.

I am trying to charge an electromagnet with a mosFET where I use my battery to get 24V to the electromagnet and through the mosFET. Now I need a signal to the mosFET from the pixhawk but I think this needs to be through the aux out. But I cannot set this up properly to work… any help?