Standalone ATmega328 8mhz and high current sleep mode without serial

Hi to all

as i described in thef title i have a problem with my circuit.

I have a simple standalone atmega328 for a security system.

the sketch automatically bring to sleep the micro when no presence is detected.

when i try it connected to arduino i can see some debug info from serial monitor.

The micro goes in sleep power down correctly if no presence is detected and i can see the famous 30uA as described in data sheet.

when i disconnect the serial cable the micro remain in sleep but the current goes to 230 uA and i cannot solve this problem

Try to pullup. pulldown. disable input 10ohm resistors... nothing seems to work

some advice?

thank you

i have a problem with my circuit

And . . ?

(sp. "8MHz" (I hope))

yes.. 8Mhz clock ATmega as described in a title. is a simple transmitter which detect a door and a pir state and send to it by radio to another module. (nrf24)

Everything works except this issue.

I use arduino only for program it and debug.

but normally there is no connection on the serial port.

add my sleep function.

void functionSleep(void)
{



  ADCSRA = 0; // disabilito il sottosistema ADC

  // set_sleep_mode(SLEEP_MODE_IDLE);       // tipo di modalità usata
  // set_sleep_mode(SLEEP_MODE_ADC);      // tipo di modalità usata
  // set_sleep_mode(SLEEP_MODE_PWR_SAVE); // tipo di modalità usata
  // set_sleep_mode(SLEEP_MODE_STANDBY);  // tipo di modalità usata
 set_sleep_mode(SLEEP_MODE_PWR_DOWN);    // tipo di modalità usata

  noInterrupts();

  sleep_enable();  // abilito il bit sul registro MCUCR dell'AVR

  attachInterrupt(0,INT0, RISING);
  attachInterrupt(1,INT1, RISING);

  interrupts();

  // power_adc_disable();
  //  power_spi_disable();
  //  power_timer0_disable();
  //  power_timer2_disable();
  //  power_twi_disable();

  sleep_mode(); // go to sleep

  // disable sleep
  sleep_disable();

    power_all_enable();
   
  detachInterrupt(0);
  radio.begin();

deejayr:
when i disconnect the serial cable the micro remain in sleep but the current goes to 230 uA and i cannot solve this problem

Try to pullup. pulldown. disable input 10ohm resistors… nothing seems to work

some advice?

thank you

Definitely use pullups, try 100k the serial pins are idle high. 10 ohm resistors??

deejayr:
yes.. 8Mhz clock

No, 8MHz clock.

Anyway, I thought it was a problem with your circuit?

sure it is.. but.. i can't solve the issue..

tried 10k 100k pull-ups no luck...

when i connect the serial cable everything it works...

I thought there was a problem with your circuit, which we can't see

Ok Sorry for that
This is my circuit.
Tried with and without nrf module. No differences.

Devi disabilitare l'ADC prima di entrare in modalità SLEEP.

You have to deactivate ADC before entering SLEEP mode.

Gia fatto.. non ho avuto risultati.

"ADCSRA = 0" in the sketch. correct?
Already done.... no results....

https://www.gammon.com.au/adc

is correct... if i delete the row in the sketch i jump to 500uA... the command seems works....

now is 250uA without any loads...

This thread is from 2017. My calendar still shows 2017 so I`ll take my chances :slight_smile:

Your schematic does not show where and how you measure your current consumption, but the “battery sense” circuit alone will drain the circuit in exess of 200uA through the resistors, depending on the battery voltage (4V / 15300 = 261uA). I suspect your reading of only 30uA while serial is in use must be because you connect your currentmeasuringdevice in a way that does not account for currentdraw from your serial device, because there is no way your “battery sense” alone will draw less than 30uA from your battery regardless of the Atmega sleepstate.