Narcoleptic library

You are correct. My bad. I just read Gammon's excellent tutorial and see that my assumption was incorrect.

Can anyone help me explain why the current draw is the same 1.0ma regardless of the OUTPUT state of the 2 pins?

Compared to INPUT, no matter if it is HIGH o LOW. How can I get it lower? I would test it without any connections, but that wouldn't help, because I can't disconnects them in the final design. The circuit is simple as described above.

Do I need to cut the trace to the regulator on a Pro Mini? According to what I read this could reduce it by 1ma.

In general, do I have to cut the trace to the voltage regulator on a Pro Mini when supplying 5.0v to save 1ma power?

Have you tried putting 5v into one of the 5v pins? Does that hit the regulator? If so, you are going to have to cut the trace to the voltage reg to get that 1mA.

I did connect it to the Vcc pin, not Raw. The total current is 1.0ma, it should be much less when it's sleeping wo A/D. I have not tried to cut the trace yet. Are you sure this will work before I do it?

Sorry, I thought it was a Mini not a Mini Pro. Vcc bypasses the regulator whereas RAW does not.

If you tried all the other software and chip configurations, what else could be burning the current? No, I do not know for sure for your setup, but Nick's tutorial showed a 8.4mA improvement bypassing the power plug (regulator). I can do a simulation with a breadboard with a LDO7805/100mA and let you know of the change in current. But, it is not like for like, so results may vary.

Yup, there was a couple of mA in there ;)

  • Unoptimized Breadboard 328p bypassing the regulator -

with 7805 in circuit - 33.37mA with 7805LDO in circuit - 31.51mA without regulator - 28.90mA

Thanks will take a chance and try it when I get home!

I have already bypassed the regulator, by connecting 5v to Vcc. The regulator is no longer regulating. But the regulator output is still connected to Vcc. Will cutting this connection save me about 1ma?

I forgot to update you on further testing. Check this out:

  • Narcoleptic Breadboard 328p bypassing the regulator -

with 7805 in circuit - 7.91mA without regulator - 0.41mA

I am just using the Narcoleptic sketch out of box. The pin2 wake works beautiful (~2 secs), hopefully you didn't scrap that on too ;)

sbright33: I have already bypassed the regulator, by connecting 5v to Vcc. The regulator is no longer regulating. But the regulator output is still connected to Vcc. Will cutting this connection save me about 1ma?

That's the idea. At the very worst your current will be down to a Atmega328 DIP on a breadboard at 0.41mA :P

No, that tiny SMD packaged 168 should go much lower.

The Narcoleptic class members other than Narcoleptic.delay() do not seem to work.

Are you able to use Narcoleptic.disableADC(), etc?

No, they do not seem to be necessary. ADC is already disabled? You do not need Narcoleptic.millis() or whatever it is called because you can keep track of how long it is sleeping with a variable. You must multiply the time you are sleeping by a constant which depends on your clock if you want the actual time in milliseconds. Or instead sleep for 910ms when you want 1 second in my case.

I don’t think so. The lowest current draw I could get was 0.4mA with Narcoleptic. I think the ADC is still on.

I used this sketch from Gammon’s site which I know turn’s the ADC off:

#include <avr/sleep.h>

const byte LED = 9;
  
void wake ()
{
  // cancel sleep as a precaution
  sleep_disable();
}  // end of wake

void setup () 
  {
  digitalWrite (2, HIGH);  // enable pull-up
  }  // end of setup

void loop () 
{
 
  pinMode (LED, OUTPUT);
  digitalWrite (LED, HIGH);
  delay (50);
  digitalWrite (LED, LOW);
  delay (50);
  pinMode (LED, INPUT);
  
  // disable ADC
  ADCSRA = 0;  
  
  set_sleep_mode (SLEEP_MODE_PWR_DOWN);  
  sleep_enable();

  // will be called when pin D2 goes low  
  attachInterrupt (0, wake, LOW);
 
  // turn off brown-out enable in software
  MCUCR = _BV (BODS) | _BV (BODSE);
  MCUCR = _BV (BODS); 
  sleep_cpu ();  
  
  // must do this as the pin will probably stay low for a while
  detachInterrupt (0);
  
  } // end of loop

Gives me 0.4uA (PicoNano Power!). BTW, I put the regulator back in circuit it jumps back up to 7.9mA.

I will keep this in mind! So far I have not needed 0.4ua. Are you sure? Anyone else?

Gammon's tutorial measured at 0.35uA for that sketch. My ammeter floated between 0.3-0.4uA. He also has that super low current ammeter.

spcomputing: I don't think so. The lowest current draw I could get was 0.4mA with Narcoleptic. I think the ADC is still on.

In the Narcoleptic code https://code.google.com/p/narcoleptic/source/browse/Narcoleptic.cpp is at least a section to disable ADC, don't know if this is enabled by default.

void NarcolepticClass::disableADC() { PRR |= _BV(PRADC); }

XD

sbright33: In general, do I have to cut the trace to the voltage regulator on a Pro Mini when supplying 5.0v to save 1ma power?

My thinking is "Yes". Before you do, just breadboard a 5V regulator and measure the leakage when back-powered.

Ray

For attiny85, I incorporated several techniques I found ... Gammon's and CodingBadly http://www.hackster.io/rayburne/hot-yet

When you download the Narcoleptic Lib do not use Version "v1a" from Jul 15, 2010 in the download section https://code.google.com/p/narcoleptic/downloads/detail?name=Narcoleptic_v1a.zip

There are some newer files: Go to "Source" tab, then "browse" and now "Download zip | tar.gz". You'll get an archive narcoleptic-ddea922cef70.zip

This code has some configuration options where you can specify what parts should sleep, for the usage see the example file

Narcoleptic.disableMillis(); Narcoleptic.disableTimer1(); Narcoleptic.disableTimer2(); Narcoleptic.disableSerial(); Narcoleptic.disableADC(); Narcoleptic.disableWire(); Narcoleptic.disableSPI();

Perhaps this difference was the reason that some people had not so good results here.