Connect your 3.7v battery to Ground (-) and +5V (+). The rated operating speed for the ATmega is (5.555 MHz/Volt) - 5 MHz (for voltages over 2.7) so a voltage of 3.7 would get you a speed of about 15.5 MHz. You could play it safe by running at 8MHz or overclock a bit by running at 16 MHz (the only two valid choices for Arduino).
I would not expect to get 3.3V from the 3.3V pin if you are running on 3.7V
I use a 8 MHz Promini from 3.7V LiPo in a remote control, runs fine, recharge it every 4-5 weeks.
Will eventually rebuild it into a standalone '328 design, drop the regulator which I’m bypassing.
I'll have play with 3.7v and see if I can put it to sleep and wake it up by external stimulus eg clock.
I'm working on an idea for a low power data logger (temperature) for my garden and will need to use solar to top up the battery. I already have a solar charger for 3.7v lipo
from some old outdoor Christmas lights.
I got an Arduino datalogging, running off a 12v battery, and was using a PIC16F84a (running on lowish power) to switch on the arduino via a relay. The arduino logs data for a few seconds every 10mins then is switched off - hence saving power. I know the PIC and relay seems like overkill but I had some anyway to play with.
But I now want a more elegant solution, that's why I thought of sleep, interupts (via clock) and solar/ lipo and low power. Should I use the promini I wonder? I don't have any but do have quite a few 328's. Is there an advantage (apart form small size) of using ProMini? I'll be happy if my datalogger is about the size of a brick, in fact I might disguise it as one :)
Skip the promini & just build one up standalone. No regulator, no power LED, just tthe ATMega, 8 MHz xtal, two22pf caps, 100nF caps on the VCC/AVCC/Aref pins.
What are you storing data to?
Will I still need an external RTC to interupt the atmega from a deep sleep? I note that some RTC chips have programmable "pulses" so I could wake the atmega periodically, but only when data is to be collected. There is an RTC DS1302 on the datalogger shield, but it doesn't have such a feature.
As I described on the above page, you can use the watchdog timer to wake you after 8 seconds. Of course that might be too soon, but a loop of 8 such pauses, and you have over a minute. After all, for datalogging it wouldn't need to be millisecond accuracy.
The SD card itself works on 3.3V, I don't know the impact of putting 3.3V into the shield.
However I have seen projects described where you simply connect directly to an SD card (after all, they just use SPI). If you get a micro-SD card, and then one of those SD-card adapters, you solder wires onto the adapter, and then plug the SD card inside it.
I'm working on setting the fuses to minimise power use and use the WDT with sleeps and interupts etc.. as per your link http://www.gammon.com.au/forum/?id=11497. I'm using an STK500 compatible ISP and avr studio 4 to play with fuses (I had a problem with studio 5.0 recognising my Olimax stk500)
When the 328 is set to use the internal oscillator does the external Xtal-capacitor rig still use power, even though it is not used by the avr? If so maybe I should leave it out of my circuit. However it seems useful to have the option of using the external crystal sometimes, so I can maybe use USB or FTDI too.
I doubt the external crystal would use an appreciable amount of power if not activated. On my test board, and during my tests, I was getting under one microamp consumption in various modes, and that was without detaching the crystal.
[quote author=Nick Gammon link=topic=86611.msg683199#msg683199 date=1328731103]
I doubt the external crystal would use an appreciable amount of power if not activated. On my test board, and during my tests, I was getting under one microamp consumption in various modes, and that was without detaching the crystal.
[/quote]
It can't make a difference to leave the caps/xtal in circuit when the oscillators switched off since at DC the caps and the crystal all look like open-circuits... Since the oscillator has an internal bias resistor then when it is switched off the oscillator input terminal won't be floating either. Also those folks at AVR thought of this (they wouldn't sell many chips if it couldn't be used standalone at micro-power levels!)
I’ve got the fuses on the 328 set to minimise Power consumption except I am using the 8MHz internal (I still have the external 8MHz as well for reasons mentioned earlier).
Voltage set at 3.7v and current during sleep is 5.1uA - yippee. I’m well chuffed, only 18.87uW in sleep mode as per your code sample