Battery drain

Hi all,

I have designed a "WIFI postbox notifier" (open source, when it finished :slight_smile: ) with a transmitter based on a Digispark.

I use a 555 timer chip and a tilt switch, to give the Digispark and the transmitter module power in 12 sec, so it have time to send the data. Its designed to only use power when someone lifting the lid on the mailbox. See attachment.

All things work now, but I have a problem. It drains the 9 Volt battery in a 2 to 3 days.

Do the 555 timer use power ?

kryder:
Do the 555 timer use power ?

Yes. A CMOS 555 timer will use less power.

Russell.

You might like to think about using the Arduino to control the power and then going to sleep mode.

Russell

Hi russellz,

Okay, thought I designed well with the 555 timer :frowning:

How much power does the Digispark use in sleep mode ?

Hi,

you can use a simple latch circuit, which will turn on when the lid is lifted and cut power via an output pin when work is done.

Depends on the exact circuit how much power it takes - for IC's the datasheet will show the
quiescent current drain.

Typically an analog circuit will take a few mA, enough to drain a battery. CMOS logic when inactive
takes a few uA, so is much more useful for micropower applications. A microcontroller with a sleep-mode
is usually the way to go - no need to power it down, in sleep mode the oscillator is switched off and the
current drain a few uA. Aim for 10uA or less total current for such an application if you want a battery
life measured in years.

By raising the the Rs in the 555 circuit you can reduce the current slightly. You will need to reduce the timing C as well.

Weedpharma

Hi all,

Thanks for all the answers. :slight_smile:

I have gone after the "sleep-mode" idea. (But "hauerdie's" idea with the latch circuit is probably the best, but I have not any mosfets on the shelf right now)

My new setup :

And sketch : (And yes, It's not great , but it works :blush: )

#include <avr/sleep.h>//this AVR library contains the methods that controls the sleep modes
#include <VirtualWire.h>
char *controller;
int task1Status=0;
int task2Status=0;

void setup()
{
    pinMode(13,OUTPUT);     // set pin 13 as an output so we can use LED to monitor
    digitalWrite(13,LOW);   // turn pin 13 LED off
    pinMode(2, INPUT);      //Set interrupt pin 2 as input
    digitalWrite(2,HIGH);   //activate the internal pull-up resistor to pull it high when jumper is not connected to GND
    vw_set_ptt_inverted(true); //
vw_set_tx_pin(12);
vw_setup(2000);// speed of data transfer Kbps
}

void loop(){
  doOneThingOfTask1();
  doOneThingOfTask2();    
}

void doOneThingOfTask1()
{

       controller="1"  ;
vw_send((uint8_t *)controller, strlen(controller));
vw_wait_tx(); // Wait until the whole message is gone
delay(200);
       controller="1"  ;
vw_send((uint8_t *)controller, strlen(controller));
vw_wait_tx(); // Wait until the whole message is gone
delay(200);
       controller="1"  ;
vw_send((uint8_t *)controller, strlen(controller));
vw_wait_tx(); // Wait until the whole message is gone
delay(200);
       controller="1"  ;
vw_send((uint8_t *)controller, strlen(controller));
vw_wait_tx(); // Wait until the whole message is gone
delay(200);
       controller="1"  ;
vw_send((uint8_t *)controller, strlen(controller));
vw_wait_tx(); // Wait until the whole message is gone
delay(200);
       controller="1"  ;
vw_send((uint8_t *)controller, strlen(controller));
vw_wait_tx(); // Wait until the whole message is gone
delay(200);
       controller="1"  ;
vw_send((uint8_t *)controller, strlen(controller));
vw_wait_tx(); // Wait until the whole message is gone
delay(200);
       controller="1"  ;
vw_send((uint8_t *)controller, strlen(controller));
vw_wait_tx(); // Wait until the whole message is gone
delay(200);
       controller="1"  ;
vw_send((uint8_t *)controller, strlen(controller));
vw_wait_tx(); // Wait until the whole message is gone
delay(200);
       controller="1"  ;
vw_send((uint8_t *)controller, strlen(controller));
vw_wait_tx(); // Wait until the whole message is gone
delay(200);
       controller="1"  ;
vw_send((uint8_t *)controller, strlen(controller));
vw_wait_tx(); // Wait until the whole message is gone
delay(200);
       controller="1"  ;
vw_send((uint8_t *)controller, strlen(controller));
vw_wait_tx(); // Wait until the whole message is gone
delay(200);
       controller="1"  ;
vw_send((uint8_t *)controller, strlen(controller));
vw_wait_tx(); // Wait until the whole message is gone
delay(200);
       controller="1"  ;
vw_send((uint8_t *)controller, strlen(controller));
vw_wait_tx(); // Wait until the whole message is gone
delay(200);
       controller="1"  ;
vw_send((uint8_t *)controller, strlen(controller));
vw_wait_tx(); // Wait until the whole message is gone
delay(200);
       controller="1"  ;
vw_send((uint8_t *)controller, strlen(controller));
vw_wait_tx(); // Wait until the whole message is gone
delay(200);
       controller="1"  ;
vw_send((uint8_t *)controller, strlen(controller));
vw_wait_tx(); // Wait until the whole message is gone
delay(200);

  }

void doOneThingOfTask2()
{
  if (task1Status==10)
    task1Status=0;

  switch (task2Status)
  {
    case 0:
      delay(2000);  // Stay awake for 5 seconds, then sleep. These are the 5 seconds when we see ~40mA on the multimeter.
    sleepSetup();   //now we see ~27 mA until pin 2 is connected to GND

}
}

void sleepSetup()
{
    sleep_enable();
    attachInterrupt(0, pinInterrupt, LOW);//Set pin 2 as interrupt and attach Interrupt Service Routine (ISR)
    set_sleep_mode(SLEEP_MODE_PWR_DOWN);//define power down sleep mode
    digitalWrite(13,LOW);   // turn LED off to indicate sleep
    sleep_cpu();//Set sleep enable (SE) bit, this puts the ATmega to sleep
    digitalWrite(13,HIGH);   // turn LED on to indicate wake up

        
}

void pinInterrupt()//ISR
{
  sleep_disable();//this is important. It is possible that the interrupt is called between executing "attachInterrupt(...)" and sleep_CPU() in the main loop
                  //if that happens without the sleep_disable() in the ISR, the ISR would be called, the interrupt detached and the device put to sleep.
                  //since the interrupt would be disabled at that point, there would be no way to wake the device up anymore.
                  //by putting sleep_disable() in the ISR, sleep_cpu() would not be effective during that loop, i.e. the main loop would run one more time
                  //and then properly attach the interrupt before hitting the sleep_cpu() a second time. At that point the device would go to sleep, but 
                  //the interrupt would now be activated, i.e. wake-up can be induced.
  detachInterrupt(0);//disable the interrupt. This effectively debounces the interrupt mechanism to prevent multiple interrupt calls.

}

I do not have as fine an ammeter to measure what it power use now, so time will tell.

If using a Nano (or Pro Mini, or in fact any Arduino board) you must of course, remove the pilot light (and the regulator).

Hi Paul__B,

Yes, I had an unemployed Nano, and my new sketch did not work on the Digispark.

How can I remove the regulator when I run it with 9 volt ?

You cannot.

nano needs either 5 or 3.3 v.

Regulator is needed to get correct voltage but the regulator draws current itself

Use a different battery.

It should run on 4.5 V, 3X pencells.

Boardburner2:
You cannot.

nano needs either 5 or 3.3 v.

Regulator is needed to get correct voltage but the regulator draws current itself

Use a different battery.

The transmitter module needs 9 Volt.

Would a small buck converter use the same as the Nano regulator ?

You don't need a Nano and its USB/Serial chip, which draws current all the time. Use a Promini instead, or one of my 328 mini cards which has even fewer components, just the processor, crystal, and some Rs & Cs. Use a small switching regulator, maybe a step up to make 9V from 2 AAs, run the board at 3V/8 MHz:
http://www.crossroadsfencing.com/BobuinoRev17/

Check www.pololu.com for low current stepup/boost reguators.

kryder:
The transmitter module needs 9 Volt.

Would a small buck converter use the same as the Nano regulator ?

There will still be some drain.

As crossroads pointed out the usb causes drain also.

As mentioned earlier could you use a latch.

switch operates latch.And signal latch.
Latch powers up circuit and transmits signal.
Arduino then turns off power latch.

Using this method however the arduino will be waking from a cold start not a sleep mode.

CrossRoads:
Use a Promini instead
Use a small switching regulator, maybe a step up to make 9V from 2 AAs, run the board at 3V/8 MHz:

I have a Promini (16MHz). Do the 8MHz use less power ?

CrossRoads:
Check www.pololu.com for low current stepup/boost reguators.

I have a handful of this LINK to Ebay (China made)

Boardburner2:
There will still be some drain.

As crossroads pointed out the usb causes drain also.

As mentioned earlier could you use a latch.

switch operates latch.And signal latch.
Latch powers up circuit and transmits signal.
Arduino then turns off power latch.

Using this method however the arduino will be waking from a cold start not a sleep mode.

Yes, I have ordered mosfets (N and P) to make the "latch circuit". :slight_smile:

8 Mhz is required when running off 3V .

5V required for 16 Mhz use.

Yes lower power but not really pertinent here.

Crossroads idea best, run off 3 v and only use 9 v boost reg when needed.

Personally i would do this with discrete hardware but this is the arduino conf....

kryder:
I have a Promini (16MHz). Do the 8MHz use less power ?

Maybe. But they take twice as long to get the job done. If speed of performing the task is limited by something else, then slower execution may save a little power, but if you can get the job done twice as fast in computing terms and then switch off, that may save more power.