Go Down

Topic: Narcoleptic library (Read 12335 times) previous topic - next topic

sbright33

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?

spcomputing

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.

spcomputing

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

sbright33

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

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?

spcomputing

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 ;)


spcomputing


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.

spcomputing

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

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

sbright33

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. 

spcomputing

#24
Sep 15, 2012, 06:03 pm Last Edit: Sep 15, 2012, 06:19 pm by spcomputing Reason: 1
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:

Code: [Select]
#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.

sbright33

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

spcomputing

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.

Clemens


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.

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


mrburnette

XD

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

Clemens

#29
Jun 16, 2014, 10:46 pm Last Edit: Jun 16, 2014, 10:50 pm by Clemens Reason: 1
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

Quote

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.

Go Up