What additional steps to take before powering on/off LCD & I2C RTC during run?

Hi

I want to power a small project via a small solar cell, and a lithium battery with a boost circuit (from a re-purposed USB solar charger). A 16x2 character LCD consumes just 3mA max if it doesn't have a backlight connected so I'd like to include one. There is also a DS1307 real-time clock module. This will be an ATMega328P standalone, running at 8MHz to further reduce consumption and component count.

For much of the week this project will be in SLEEP_MODE_PWR_DOWN. It can awaken by either a button press, or a number scheduled events which is what the RTC is there for, and my intention is to use the watchdog timer with an 8 sec interval such that it wakes, and based on some multiple of a counter will check if a event should occur every 5 minutes or so, otherwise it will go back to sleep.

I was intending to switch the GND on the RTC and the 1602 LCD using two NPN transistors because most of the time the uC comes back to life neither of those needs to be powered. So far I'm hoping this approach is sound - please let me know if I'm charging toward any newbie blunders.

A couple of questions (presuming the concepts above are sound) :

  • I was hoping to drive all the ATMega pins LOW before going to sleep. Will I need to do anything special with the Wire or LiquidCrystal instances? I do not see an end() method in the headers for either library so don't know if there's a clean way to get them to stop and then restart...or is that even necessary?
  • The I2C bus has pull-up resistors so should I also be switching that off somehow too?

Thanks
Geoff

It can awaken by either a button press, or a number scheduled events which is what the RTC is there for, and my intention is to use the watchdog timer with an 8 sec interval such that it wakes, and based on some multiple of a counter will check if a event should occur every 5 minutes or so, otherwise it will go back to sleep.

In this case use a DS3231, it has two programmable alarm times with an appropriate signal output to wake your microcontroller at time. This way you can save a lot of wake-ups and a lot of battery power.

For the rest of the sleeping stuff take a look at Nick Gammons page about that topic: Gammon Forum : Electronics : Microprocessors : Power saving techniques for microprocessors.

Thanks for giving this some thought Pylon.

pylon:
In this case use a DS3231, it has two programmable alarm times with an appropriate signal output to wake your microcontroller at time. This way you can save a lot of wake-ups and a lot of battery power.

I would, but I have these others in the parts bin so this path was quicker. Also, I'm going to use the watchdog to periodically fire off a 1/5sec burst on a 3mm LED so I know the thing is still alive so all's not lost.

It was actually after reading through Nick's page that I had the inspiration to do this Reading through it again I see he's not using transistors at all in his examples and since the two items I'm turning off won't consume lots of power I'll take his lead and just ensure I follow the instructions about keeping the cap from discharging.

I see the note on turning off the I2C pull-ups though there's no mechanism suggested. Could this be as simple as attaching the pull-ups to the digital pin (in his schematic below, D8) used to power the RTC without using the 220R resistor to reduce the voltage?


(source: Power saving techniques for microprocessors by Nick Gammon)

Thanks, Geoff

I see the note on turning off the I2C pull-ups though there's no mechanism suggested. Could this be as simple as attaching the pull-ups to the digital pin (in his schematic below, D8) used to power the RTC without using the 220R resistor to reduce the voltage?

Yep, that should work (because the power consumption is low enough for a digital output pin to handle).

Thanks for your feedback. That's how I'll run it. Will report back here on the results.