Lil' Blackbox

Coding => v1.0 - v1.1 => Topic started by: hakcenter on July 20, 2015, 11:14:28 AM

Title: Low Power
Post by: hakcenter on July 20, 2015, 11:14:28 AM
Well since I redid my whole radio / lbb box setup... I really didn't want to use the radio accessory power to power the little guy.

Just running on straight always on battery power from the upper cigarette lighter, but then I'm concerned on power usage.. not like it'll ever drain 2 batteries in its lifetime, but no sense in wasting power if you don't have to.

Enter low power stuff

So I nabbed a simple low power library that uses the watchdog to wakeup the arduino. Instead of an interrupt... which imho is a waste of a pin, and the code is never going to fault out and break.. pretty robust.

So the library is in the library thread, Arduino Libraries (http://community.lilbb.com/coding/arduino-libraries)

In main includes

#include <LowPower.h>


Loop adjustment

void loop() {
  // Sleep
  unsigned int sleep = 0;



    // Freq Measure
    if (FreqMeasure.available()) {
      sleep = 0;
      [...]
    } else {
      sleep++;
    }
    if (sleep > 33000) {
      if (serial_out) { Serial.println("Going to sleep"); }
      delay(10);
      LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
      delay(10);
      if (serial_out) { Serial.println("Waking up"); }
      sleep = 0;
    }


else falls out to a 1ms delay, that counts up to 1second, if no frequency updates in a second, fall out to full sleep for 8 seconds, reset timer, and repeat.

Working pretty stout so far. I haven't measured draw but I'm expecting atleast 10mA less draw.
Title: Re: Low Power
Post by: Rx7man on July 20, 2015, 11:24:23 AM
I was wondering about the same thing... I was just going to see what I could do to kill the power to all the externals at least.. stepper driver, CAN, etc.

I think you can do a software reclock on the arduino and bring it down to a couple MHZ to reduce power... On a Mega that has a ton of extra digital IO's you could poll every second or whatever and if it's been powered off for X number of cycles, lower the clock speed.
Title: Re: Low Power
Post by: me78569 on July 20, 2015, 12:57:27 PM
Why not just run your power from a keyed power source?  you could use a relay if you wanted to I suppose.
Title: Re: Low Power
Post by: hakcenter on July 20, 2015, 01:03:04 PM
Waaaaaay to lazy for that, LOL

30-40mA is not even a real draw anyways.
Title: Re: Low Power
Post by: me78569 on July 20, 2015, 03:29:54 PM
Got ya.  I ran mine on the same lead as my tuner ignition sense so it was easy.

Are you cycling the veins ever to clean them?
Title: Re: Low Power
Post by: hakcenter on July 20, 2015, 04:21:35 PM
Ya when the box is turning on it takes a whole second to send position, so it defaults to full open, then starts to close.
Title: Re: Low Power
Post by: me78569 on July 20, 2015, 04:36:12 PM
Duh,


With no measure it will go wide open haha.  My mind is mush.