1

I have a Sparkfun GPS Logger Shield and I want to save power by shutting it off when I do not need GPS readings. Now reading the hookup guide it says that the "EN" pin can do this: "Active-high chip-enable – pull low to reset or turn off".

I wanted to ask some advice as to what this actually means and how I safely go about it. Is it as simple as:

pinMode(pin, OUTPUT);

//turn off    
digitalWrite(pin, LOW);

//turn on
digitalWrite(pin, HIGH);

Where the pin is a digital pin on the Arduino and it is connected to the "EN" pin of the GPS shield.

  • 1
    Please note that when the GPS is turned off, it is not tracking satellites. That means that when you turn it back on again, it doesn't have the faintest idea where it is. To find out, it has to listen on all channels looking for one satellite to at least tell it what time and date it is. Once it has that, it can start to calculate satellite orbits and guess as to which satellites are where. As it gets more and more information, it will finally start to resolve its location. According to the GP3906 datasheet, this can be as much as 35 seconds from Cold. – John Burger Aug 30 '16 at 12:04
  • Yeah, I figured it would require a little run up time to determine where it is. I also have a GPRS module that will also need a run up time to obtain signal. I was planning to test out a number of different wake times to ascertain an effective, but still short duration.Thanks for the extra detail on the 35 seconds for this GPS module, that should come in quite helpful! – Calco Aug 30 '16 at 12:14
  • 1
    Take a look at SparkFun's datasheet. It's got all sorts of info: cdn.sparkfun.com/assets/learn_tutorials/4/6/8/… – John Burger Aug 30 '16 at 12:38
2

Yes, it is as simple as that.

However, since the pin is pulled up already you could also do this:

pinMode(pin, INPUT);
digitalWrite(pin, LOW);

// Turn off
pinMode(pin, OUTPUT);

// Turn on
pinMode(PIN, INPUT);

That then emulates an Open Drain pin which means you're not actively driving the pin when turned on, only when turned off.

Personally I prefer system that are active low not active high, and are pulled down by default (normally off) so that you don't waste power driving the pin in order to save power (it's kind of silly really) - you drive the pin to turn on and let the pin float to turn off (especially good with deep deep comatose sleep on some MCUs where the IO pins all switch off).

However the designers of this module decided otherwise, so you're stuck with driving the pin LOW to make it sleep.

  • I'm just trying to understand your example and how an open drain works. So an INPUT of LOW is pulling down (0v)? How is an OUTPUT of LOW pulling up? – Calco Aug 30 '16 at 11:22
  • 1
    Sorry, other way around (coffee hasn't kicked in yet). Output of LOW pulls down. Input of LOW floats (internal pullup disabled) allowing module's pullup to pull it high. – Majenko Aug 30 '16 at 11:23
  • Ok that makes a bit more sense to me! Where you say 'internal pullup disabled', is that something I actively have to do? – Calco Aug 30 '16 at 11:36
  • I think I found the relevant information with the fact that using pinMode INPUT automatically disables the internal pullup. – Calco Aug 30 '16 at 11:55
  • INPUT with the output LOW has the pullup disabled. INPUT with the output HIGH has the pullup enabled. Or INPUT_PULLUP is the same. – Majenko Aug 30 '16 at 11:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.