Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 7 of 7

Thread: Low power uses too much power...

  1. #1

    Low power uses too much power...

    Hello,

    I was trying to reduce power consumption following the advice given here : https://www.pjrc.com/teensy/low_power.html
    so I implemented this :

    Code:
    if (LOW_POWER_MODE) {
        Serial.end();
          for (int i=0; i<sizeof unusedPins/sizeof unusedPins[0]; i++) {
            pinMode(unusedPins[i], OUTPUT);
          }
      }
    The problem is that the "low power mode" uses 3mA more that the default mode... Did I miss something ?

    Cheers

    M

  2. #2
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    2,915
    try INPUT_DISABLE

  3. #3
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    7,576
    That pages links to the AVR Teensy 2 - is that the Teensy in use? The Arm Teensy's are different. On T_3.x and T_LC the pins are in disabled state unless acted on with pinMode - setting to output will actually enable them.

  4. #4
    Good point, I should have mentioned that I was using a Teensy 3.2

    It makes sense then if I was actually enabling the pins...
    What about Serial.end, is it worth it ?
    Any other tip to save juice ?

    Cheers

  5. #5
    Is there a way to read the state of an input (i.e. enabled/disabled ?)

  6. #6
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    2,915
    you can check out duff’s snooze library, for very low power states

    yes, its possible to determine if a pin is used as input or output

  7. #7
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    7,576
    There is a SNOOZE library that offers various 'sleep' options. Also search for "WFI" - that sleeps CPU between interrupts - it may offer some reduction.

    I'm not sure what USB Serial does with .end()? If this is the code behind it:
    Code:
    void end() { };
    Unless the CODE does a PinMode() - or an Analogxx() the pins unused will be disabled.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •