2N7000 as power swtich ?

Hi, I am looking to switch an SD card on and off to allow maximum power saving in SLEEP mode and wonder if using a 2N7000 Mosfet to switch the SD 3V3 supply via arduino pin D2 is the best bet?

My circuit looks like this which may be wrong, any pointers appreciated.

Yes the circuit is wrong.
This is an N channel FET and to do top switching you need a P-channel FET.

Also note that having inputs to any device with that device not being powered is one of the best ways of destroying the device.
So you need to make sure that there are no inputs or if there are they are all logic zeros before removing the power.

Thanks Mike,

Is there any advantage of going for a P channel FET over say the circuit below (which may also be wrong?) in terms of keeping this a really low power switch? Maybe the question should be more like: what is the best way to switch periferals on and off with low power consumption as the main aim?

BC817.JPG

See below for my temperature and humidity sensor which does just that:

Hi Nick,

Thats just what I was looking for, thank you.
May I ask how you deal with restarting the SD card in code each time you use it as powering off presumably means reinitialising?
Was the 6-7 uA in powerdown a measured value? very impressive - I'm currently running at 400uA !!! I need to get this lower :slight_smile:

Was the 6-7 uA in powerdown a measured value?

Measured, yes. And predicted too from the datasheet (page 405):

May I ask how you deal with restarting the SD card in code each time you use it as powering off presumably means reinitialising?

The writing is in a function, and therefore the SdFat and SdFile objects go out of scope when the function ends (thus calling their destructors and getting rid of any memory they might be using). Plus I close everything I can:

void recordReading ()
{
// ... take readings ...

// file system object
SdFat sd;

  // warn them not to unplug the SD card
  flashLED (10);

  if (!sd.begin (SD_CHIP_SELECT, SPI_HALF_SPEED)) 
    {
    showError ("Sd Error");
    return;  // failed to start
    }

// Log file.
SdFile file;

  SPI.begin ();

  if (!file.open (fileName,  O_CREAT | O_WRITE | O_APPEND))
    {
    showError ("FILE");
    return;  // failed to start
    }  

// ... write stuff here ...
  
  file.sync ();
  file.close ();
  
  delay (100);  // enough?
  
  SPI.end ();

  flashLED (2);
  
}  // end of recordReading

It definitely works reliably. For example I was measuring a room in the house recently:

2013-08-27 14:00:14	48.30	20.10	20.93	8.86	649
2013-08-27 14:15:07	49.80	19.80	20.41	9.04	632
2013-08-27 14:30:48	49.70	20.10	20.67	9.28	670
2013-08-27 14:45:40	48.70	20.60	21.11	9.44	791
...
2013-10-06 06:45:22	54.60	18.00	18.33	8.73	300
2013-10-06 07:00:13	54.80	18.00	18.24	8.79	276
2013-10-06 07:15:04	54.90	17.90	18.24	8.72	354
2013-10-06 07:30:44	54.70	18.00	18.33	8.76	387
2013-10-06 07:45:34	53.30	17.90	18.24	8.29	439

3813 lines in the original file.

That's a reading every 15 minutes for 40 days, without a problem. That was off the same 3 x AA batteries shown in the article.

That fact that it captured 3000+ lines, and we only have 2048 bytes of RAM, shows that there is not a single byte being leaked during the file open / close procedure.

Hej Nick, that's pretty impressive and very encouraging. Do you know how long the AAs last for in the field? I'm looking forward to getting my tests going again to see if I can shave a mere 393uA of my baseline :slight_smile:

... forgot to ask if I need to change the power switching circuit in any way if my system is 3V3?

point5:
Hej Nick, that's pretty impressive and very encouraging. Do you know how long the AAs last for in the field?

I think at 7 µA they last roughly as long as the self-discharge time. You need to account for how much you are using when the device powers on and does something useful. You would need to look at the specs for the battery, take into account how old they are, what temperature they are operating at, and so on.

... forgot to ask if I need to change the power switching circuit in any way if my system is 3V3?

You might need to check if the MOSFET turns on fully at 3.3V, and if not, if that matters. The one I used quoted Rds(on) at a test condition of -10V, so I presume it isn't fully on at -4.5V. However for a few milliseconds any extra heat generated by the extra power consumption probably isn't too big a worry.

Thanks again Nick, I will do some reading and learn a little more about MOSFET MATH so I can fully understand :slight_smile: Cheers.