MOSFET newbie question

Hi.
I'm trying to switch on/off a TFT screen using a n-type MOSFET (IRF3708PBF) in the GND pin to the MEGA2560. This is my first time with a MOSFET.

The MEGA will be 24/7 on, while the screen will be on just when motion is detected in front of it.

Is the attached diagram correct?

IRF3708MEGA.jpg

MiOiM:
I'm trying to switch on/off a TFT screen using a n-type MOSFET (IRF3708PBF) in the GND pin to the MEGA2560.

Then you are doing it wrong. You do not switch the ground of devices which are also connected to data pins.

MiOiM:
This is my first time with a MOSFET.

Indeed!

Actually, you can switch the ground in this case, but before switching it off and until it is switched on at any time, you must set all data pins controlling the display, to INPUT.

It is however a waste of time in general to switch off the display as once you switch off the backlight, you can usually command the LCD itself to turn off and the current draw will be negligible compared to the Mega 2560.

Thank you Paul__B!

This particular screen doesn't seem to allow switching on/off the backlight programmatically (because of the ILI9486 controller)... That's why I asked around and was told to use a MOSFET in the GND pin... luckily I decided to ask here before trying.

I am not sure about how to set all data pins to INPUT... Would you recommend changing the screen for another model which allow to control the backlight instead of trying to make if too difficult?

Call pinMode(pin, INPUT) for all the pins that connect to the LCD, then power the LCD down.

To power it up, switch it on, and set all the pins to their intended mode for normal LCD operation.

When switching with a MOSFET the load is always connected to the DRAIN, when switching with a BJT/darlington the load is always connected to the COLLECTOR.

So source to GND, drain to LCD, gate to gate-resistors and Arduino. The way you've drawn it the LCD cannot be switched off as the current will flow through the body diode.

Thank you, MarkT!

I have fixed the wiring:

Also, in this code I try to set all screen's data pins (22 to 53 of the MEGA) to INPUT, then set the gate's pin to LOW to switch the screen off. 10 seconds later it will be switched back on by setting the gate's pin to HIGH, then calling myGLCD.InitLCD(); to initialize the screen.

Is it correct?

#include <UTFT.h>

#define switchPin 3 //pin to switch the screen on/off

UTFT myGLCD(ILI9486,38,39,40,41); 

void screenOff()
{
  for (int i = 22; i < 54; i++)
  {
    pinMode(i, INPUT);
  }
  delay(500); 
  digitalWrite(switchPin, LOW);
}

void screenOn()
{
  digitalWrite(switchPin, HIGH);
  delay(500); 
  myGLCD.InitLCD();
}

void setup() {
  pinMode(switchPin, OUTPUT);
}

void loop() {
  // to power on the screen:
  screenOn();

  delay(10000); 

  // to power off the screen:
  screenOff();

  delay(10000); 
}

Thank you again for your help, guys.

I don' t know how much current does this screen takes bu consider wiring the source pin of mosfet directly to PSU ground, not to Arduino. It depends of the current draw of the screen. Cheers

szawus:
I don' t know how much current does this screen takes bu consider wiring the source pin of mosfet directly to PSU ground, not to Arduino.

Err, no! :astonished:

Paul__B:
Err, no! :astonished:

Why? Why pull current from Arduino pins if it can be drawn from PSU - I mean 5V of course?

It may be better if 5V and gnd of the screen won't be connected to Arduino. Am I missing something?

Doesn't your display have some an enable pin, that can do the same but in a guaranteed safe manner?

szawus:
Why? Why pull current from Arduino pins if it can be drawn from PSU - I mean 5V of course?

In this case, the actual backlight current is fairly trivial, so it is not a problem. Certainly in general, you do not "draw" significant current through the Arduino.

The point is however, that the ground is the reference point for all the data pins, so it is important that it connects directly to the Arduino rather than the power supply.

szawus:
It may be better if 5V and gnd of the screen won't be connected to Arduino. Am I missing something?

The thing is you see, that the whole and only reason for this cumbersome arrangement is that the display does not allow such a sensible approach. :astonished:

Oh, ok. So theoretically speaking I was right, just in this case it is unnecessary, right?

You always MUST have a reference point, a 0V level, which is we call "ground", and all points must be connected to be at the same absolute potential for your circuit to be a circuit and actually work.

To be clear - I of course assumed that "grounds" are connected.