How to prevent current leakage from inactive I2C bus

I've noticed that total circuit current slightly increased after i attached RTC like that to I2C bus. Increase is pretty small (from 60uA to 220 uA) but it is metter in my case, i need to minimize power consumption as much as possible.

Details:

  • Arduino Mini Pro 3.3V;
  • RTC is powered off (it is attached to one of the pins, so i'm powering it on when i need to get time);
  • Power goes down only when i detaching SCL and SDA pins from powered-off RTC;
  • Power consumption measured in deep sleep mode (GitHub - rocketscream/Low-Power: Low Power Library for Arduino) with ADC and BOD turned-off;

Any ideas why and how to prevent this?

Are you trying to improve the accuracy of timekeeping in the Arduino by the addition of the DS3231?
Setting the power difference aside for a moment, did you achieve the accuracy you were hoping for?
Did it actually improve the accuracy of timekeeping in the environment where your final project will exist?

Set the pins to input after powering down the clock:

pinMode(A4, INPUT); //SDA
pinMode(A5, INPUT); //SCL

Should do it.

Perehama:
Are you trying to improve the accuracy of timekeeping in the Arduino by the addition of the DS3231?
Setting the power difference aside for a moment, did you achieve the accuracy you were hoping for?
Did it actually improve the accuracy of timekeeping in the environment where your final project will exist?

Arduino UNO\Pro Mini does not have any decent timekeeping abilities at all, so using the DS3231 i'm filling this gap.
This RTC is extremely accurate, much accurate than ordinal RTC's with external clock generation.

Danois90:
Set the pins to input after powering down the clock:

pinMode(A4, INPUT); //SDA

pinMode(A5, INPUT); //SCL




Should do it.

Thanks Danois90, i'll try this today after work.

Remember that you might need to do a "rtc.begin()" (library depend) after you have powered the clock back on again, elsehow I2C will not work.

Mental_Force:
Arduino UNO\Pro Mini does not have any decent timekeeping abilities at all, so using the DS3231 i'm filling this gap.
This RTC is extremely accurate, much accurate than ordinal RTC's with external clock generation.

Did you test this? I do not use arduino modules in my projects but barebones ATmegas with precisely calibrated Pierce-gate crystal oscillators. I do the calibration using a frequency counter. I have never had more accurate results from any of the Dallas/Maxim TXCOs, despite their fabulous claims. You are using off-the-shelf, bolt-on modules and needing both accuracy of timekeeping and conservation of power to the microampere. Perhaps consider designing the circuit entirely at the component level and do some muntzing on the bolt-on parts.

Perehama:
Did you test this? I do not use arduino modules in my projects but barebones ATmegas with precisely calibrated Pierce-gate crystal oscillators. I do the calibration using a frequency counter. I have never had more accurate results from any of the Dallas/Maxim TXCOs, despite their fabulous claims. You are using off-the-shelf, bolt-on modules and needing both accuracy of timekeeping and conservation of power to the microampere. Perhaps consider designing the circuit entirely at the component level and do some muntzing on the bolt-on parts.

Of course, i was using 1Hz interrupt timer to call system tick() event to increase current time. The accuracy was horrible because of frequency deviation, the shift from atomic time was ~25 sec by the end of the day.
If i'm not wrong, doc says that oscillator deviation is 5-8% depending on environment temperature.

Finally, i'm not sure that micro-controller based timekeeping will work properly in deep sleep mode or while using other power saving techniques.

P.S. DS3231 has thermal probe to adjust clock accuracy.

Danois90, it helped! Thanks again.

I think something is being missed here. If you power on (the RTC) only when you need the time, how are you keeping the battery charged? What good will the RTC be if the battery dies during a power down period? Unfortunately with the 328p and 2560, in all but SLEEP_MODE_IDLE you lose pretty much all time keeping capabilities as the clocks are shut down to save power. The exception is the watch dog which runs on a separate 128kHz oscillator. Caveat is that WDT consumes power and is recommended to be switched off (if not needed) for power save. As always, GOOD, FAST, CHEAP, pick two.

DKWatson:
I think something is being missed here. If you power on (the RTC) only when you need the time, how are you keeping the battery charged? What good will the RTC be if the battery dies during a power down period? Unfortunately with the 328p and 2560, in all but SLEEP_MODE_IDLE you lose pretty much all time keeping capabilities as the clocks are shit down to save power. The exception is the watch dog which runs on a separate 128kHz oscillator. Caveat is that WDT consumes power and is recommended to be switched off (if not needed) for power save. As always, GOOD, FAST, CHEAP, pick two.

RTC module manufacturer claims that it will work for few years from one CR2032 battery, so i don’t need to charge it.
My code can handle moment when RTC time is reset (RTC.get()<=CompileTime) and will ask to replace the battery.

Mental_Force:
I've noticed that total circuit current slightly increased after i attached RTC like that to I2C bus. Increase is pretty small (from 60uA to 220 uA) but it is metter in my case, i need to minimize power consumption as much as possible.

Details:

  • Arduino Mini Pro 3.3V;
  • RTC is powered off (it is attached to one of the pins, so i'm powering it on when i need to get time);
  • Power goes down only when i detaching SCL and SDA pins from powered-off RTC;
  • Power consumption measured in deep sleep mode (GitHub - rocketscream/Low-Power: Low Power Library for Arduino) with ADC and BOD turned-off;

Any ideas why and how to prevent this?

If you power down the RTC you must drop all its connections to ground or you'll phantom-power the chip through
them.

Those particular DS3231 modules have several unnecessary components that need to be removed for truly low power (and proper) operation.

The details are given in this blog article, which also discusses various tests of the timing accuracy. The modules work extremely well.

Mental_Force:
Of course, i was using 1Hz interrupt timer to call system tick() event to increase current time. The accuracy was horrible because of frequency deviation, the shift from atomic time was ~25 sec by the end of the day.
If i'm not wrong, doc says that oscillator deviation is 5-8% depending on environment temperature.

Finally, i'm not sure that micro-controller based timekeeping will work properly in deep sleep mode or while using other power saving techniques.

P.S. DS3231 has thermal probe to adjust clock accuracy.

This is the Arduino's external resonator, not one that can be and is tuned to give a precise frequency for a given temperature and pressure. The DS3231 uses temperature compensation to improve fluctuation over a greater range of temperature shifts. If your device is operating in a controlled environment for extended periods of time(i.e. indoors), you can achieve greater precision in timekeeping if you tune the oscillations for that environment.