Narcoleptic library

This works with Atmega328. Shouldn't it also work the same way with Atmega168?
It's a Pro Mini 168 using Vcc instead of Raw I measure 25ma with or without sleeping.
Aren't they very similar chips? Other than the memory capacity?

#include
void setup(void) {
while(1) Narcoleptic.delay(8000);
}

Turns out it is working? When it's awake it uses 36ma, asleep 23ma. That difference is about right.
But where is the 20ma or so going? The sketch is like I posted so all pins are Input mode?
There's an LM335 connected to A0 and D12.
My battery is attached to Vcc not Raw.

AND A 20 ohm RESISTOR between Vcc and A0.
How did that get there? It was mixed in with my 2k res's.
Let me fix that...
Huh? Really? That explains it?

I scraped off the green power LED, now only 1.0ma!!!!!!!!

According to the white papers, @ 1MHz/1.8V, 1uA is as low as you can go with Power-down mode.

Nice job.

Still it should be 18+4=22ua according to this:
http://www.rocketscream.com/blog/2011/07/04/lightweight-low-power-arduino-library/

Why is my circuit taking nearly a milliamp when pinMode(all are INPUT)?

The LM335Z is across A0-D12 with the 3rd pin open.
1K res from Vcc to A0 which is an INPUT.
Nothing else is attached not even the serial pins.

As Inputs, digitalWrite(HIGH) or LOW for those 2 pins didn't help.

Did you try the power down example?

// **** INCLUDES *****
#include "LowPower.h"

void setup()
{
    // No setup is required for this library
}

void loop() 
{
    // Enter power down state for 8 s with ADC and BOD module disabled
    LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);  
    
    // Do something here
    // Example: Read sensor, data logging, data transmission.
}

Yes very nice, same results as Narcoleptic.
I'm confused.

It doesn't matter if the pins are INPUT or OUTPUT if the pins are not connected.

But mine are, as described above, so it should matter if A0,D12 are INPUT or OUTPUTHIGH or OUTPUTLOW.
Yet the results are always 1.0ma. Help?

void setup(void){
//pinMode(A0,INPUT);
pinMode(12,OUTPUT);
//digitalWrite(A0,HIGH);
digitalWrite(12,LOW);
while(1) Narcoleptic.delay(8000);

I am no expert in the pico power, but what I do understand is that everything is shut down with exception of a watchdog timer and a 125kHz signal for that timer, and of course power. Your A0,D12 shouldn't matter until the WDT wakes the system up.

..show the schematics..

@spc- That's not true, you can even drive an LED while sleeping. The pins stay in the state you left them when you fell asleep.

The circuit is kindergarten simple. And the sketch is only 3-5 lines above. I've changed the first 2 it doesn't effect current.

I have a Pro Mini 168 5v
The LM335Z is across A0-D12 with the 3rd adj pin open.
1K res from Vcc to A0 which is an INPUT.
Nothing else is attached not even the serial pins.
Power to Vcc, not Raw.

It doesn't get much simpler than that eh?

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 :wink:

  • 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?