TFT SPI Control backlight

Hello,

I am using a TFT SPI display with an ESP32 microcontroller. As soon as i power on the ESP32 the LCD gets fully white and when the program starts the display shows the black background color i want.

I have a LED pinout on the display and when i disconnect the cable the backlight is off but the display boots correctly.

Can i use a MOSFET to power the backlight as soon as the program starts?

I have a BCP54-16 mosfet laying around but i am not sure if i can switch +5v instead of ground?
I think i need to connect B to a GPIO pin, but i don't know how to power the Emitter and Collector between the +5v (or 3.3V)

Can someone help me please?
PS, i also have a FR5505 mosfet laying around, this is a p-channel mosfet? I read this is for switching positive signals?

Thank you!

You can switch the LED pin high\low in that way to turn the screen on\off.

A BCP54-16 is a NPN Bipolar transistor, not a MOSFET.

To switch the LED pin high, to turn on the display, you need either an PNP bipolar transistor or a P Channel MOSFET.

I think i have connected this one FR5505 the way it supposed to be, the only "problem" is that the display is on already when power is connected. Is my wiring wrong or is this not the correct PNP transistor?

bluebirdsoftware:
Is my wiring wrong or is this not the correct PNP transistor?

No idea, you have not shown how its wired.

Sorry for the quick drawing but i hope it is clear enough

You should add a low value resistor, say 2k2 in series with the gate and a high value resistor say 47K between gate and +3.3V to keep the display off till you want.

What is the gate threshold voltage of that MOSFET, probably want a max of 2V (or less) for reliable switching ?

So you mean like this?

Can you explain how you got the resistor values? I have 10K resistors, 2K7 but not the values you said. Will this work too or do i have to buy those exact resistors?

They are more rule of thumb from practical experience, of using MOSFETS to switch such devices, than calculated values.

But is my diagram correct?
And switching the 47K to 10K and the 2K2 tot 2K7 is not going to be okay?

bluebirdsoftware:
But is my diagram correct?
And switching the 47K to 10K and the 2K2 tot 2K7 is not going to be okay?

Looks OK.

No idea if it will work, did you check the gate threshold of the MOSFET ?

i don't know much about it but the manual says:

Gate Threshold Voltage:
MIN - 1
MAX - 3

What does it mean?

That means its not a logic-level MOSFET.

Threshold voltage is the point the device switches fully off.

Typical logic level MOSFETs have threshold voltages under 1V.

The only things you need to check in the datasheet are max voltages and the on-resistance rating
(for instance if it says Rds(on) = 50 milliohms for Vgs=10V, you need 10V to turn it on and get 50 milliohm on resistance.)

If there's no entry for a logic level voltage such as 3V, 5V, and only for 10V, its not logic-level at all.

The IRFR5505 shows only an entry for Vgs=10V, and is thus not logic level.

You have an alternative?
Also i connected it as showed above and it does work, but still better to search for an alternative?