Pwring Arduino from 3v Source

Hi all,

Got a little project thats nearly done (traffic lights for my nephew), but it is showing some strange behaviour. I have 3 LEDs hooked up to an XINO (similar to a ardweey, breakout for 328P), running off two AA batteries. All good.
I've run the above example for 12 hours straight. Put fresh batteries in tonight, ran it for 1 hour, turned it off and on turning it back on found that no LEDs were lighting up, the onboard power LED was lit. I replaced the batteries and it worked fine.
Any ideas as to why this is? First thing I thought of is that the arduino needs >2.8v to "boot", but once up and running can drop below that threshold and continue to run? All I can think of seeing as I've had it running happily for 12 hours straight.

Other question I had, if I switch battery packs to 4.5v (3xaa) would I see the same behaviour?

Many thanks!

I believe the standard brown-out threshold is 2.7V, and you will need to change this.

This might be as simple as changing the board setting to "Pro Mini 8MHz", or you might have to:

a) work out which fuse bit settings to change for a brown-out setting less than 2.7V
b) create new boards.txt entry
c) burn new bootloader
d) test your app

You realise that at 3V the crystal frequency should be 8MHz to guarantee the chip will work?

Thanks for the quick reply!
What do you mean by brown-out threshold? Sorry, I am struggling to understand this.
Would I be able to alter the chip to run with a reduced threshold and an increased likelihood of failure? This is fine.
Find it strange that arduino will run continuously for ages and yet fail after an hours use?

The board I'm using has a crystal, would I still be able to run it at 8mhz.

"The board I'm using has a crystal, would I still be able to run it at 8mhz. "

No. 16 MHz board needs ~3.8V to run reliably.
Running

Easiest solution would be to use 4.5V.

Other question I had, if I switch battery packs to 4.5v (3xaa) would I see the same behaviour?

Why you asking, just do it and see..

@CRossroads - can I run it at 8mhz with a 16mhz crystal?
@Saad - Project is built and adding a 3aa battery box would necessitate redesigning the whole project.
Thanks for the replies guys!

"run it at 8mhz with a 16mhz crystal"
You could re-do the fuses to slow things down. Read the datasheet for your options. I don't recall seeing this discussed in the forum,
so am not sure of the method for doing this. Here's where to look to get you started
http://www.atmel.com/dyn/resources/prod_documents/doc8271.pdf dated May 2011

Click on the "System Clock and Clock Options" tab, then scroll down to the "System Clock Prescaler" paragraph.

9.11 System Clock Prescaler
The ATmega48A/PA/88A/PA/168A/PA/328/P has a system clock prescaler, and the system
clock can be divided by setting the ”CLKPR – Clock Prescale Register” on page 38. This feature
can be used to decrease the system clock frequency and the power consumption when the
requirement for processing power is low. This can be used with all clock source options, and it
will affect the clock frequency of the CPU and all synchronous peripherals. clkI/O, clkADC, clkCPU,
and clkFLASH are divided by a factor as shown in Table 29-12 on page 324.

When switching between prescaler settings, the System Clock Prescaler ensures that no
glitches occurs in the clock system. It also ensures that no intermediate frequency is higher than
neither the clock frequency corresponding to the previous setting, nor the clock frequency corresponding
to the new setting. The ripple counter that implements the prescaler runs at the
frequency of the undivided clock, which may be faster than the CPU's clock frequency. Hence, it
is not possible to determine the state of the prescaler - even if it were readable, and the exact
time it takes to switch from one clock division to the other cannot be exactly predicted. From the
time the CLKPS values are written, it takes between T1 + T2 and T1 + 2 * T2 before the new
clock frequency is active. In this interval, 2 active clock edges are produced. Here, T1 is the previous
clock period, and T2 is the period corresponding to the new prescaler setting.
To avoid unintentional changes of clock frequency, a special write procedure must be followed
to change the CLKPS bits:

  1. Write the Clock Prescaler Change Enable (CLKPCE) bit to one and all other bits in
    CLKPR to zero.
  2. Within four cycles, write the desired value to CLKPS while writing a zero to CLKPCE.
    Interrupts must be disabled when changing prescaler setting to make sure the write procedure is
    not interrupted.

Then go down a little farther to 9.12.2, couple of tables that won't copy well here.

Thanks for that Crossroads, a lot of it went straight over my head, but I'll sit down tomorrow and try to get my head around it!

Don't know if this would fit in your project but have you considered a boost converter for the batteries? http://www.reuk.co.uk/DC-Voltage-Multiplier-Circuit-Plans.htm

Yeah, not sure how that register is written myself, need a real software guru to pipe up here.

Yankee,
There are US sources for those boost converters also, here are some Pololu.com offers in different package sizes, current capabilities as examples:
Pololu - Regulators and Power Supplies

Oh yeah! They've got a very nice selection. I particularly like the ones integrated with a battery holder. I'll bookmark this page for future reference.

CrossRoads:
There are US sources for those boost converters also, here are some Pololu.com offers in different package sizes, current capabilities as examples:
Pololu - Regulators and Power Supplies

Some really small units there. I was thinking if space is an issue, the mintyboost could be usable, but some of those are even smaller. To say nothing of the price difference.

Yeah, a boost converter is probs the way I'm going to go. This'll teach me to develop at 5v and then expect everything
to run for 12 hours at 3v!! Thanks for the links, but I'm in the UK so I'll have to find something over here...
Just a thought, what sort of battery life can I expect using a boost converter?
Ie. I can run 2 batteries @ 3v for 6 hours with no boost
I can run 2 batteries @ 5.5v for 4 hours with a boost?

If anyone in the UK is looking for one,
http://www.hobbytronics.co.uk/pololu-5v-boost-regulator

Rather than use a boost converter, it looks to me that it would be much simpler to replace the 16MHz crystal by an 8MHz one and re-burn the fuses to reduce the brownout level.

From what I've seen most boost converters run somewhere around 80% efficiency so you should get at least 4 hrs.

@dc42 - could you elaborate on the "burn the fuses" part of your post? I've heard this used a lot lately and not too sure what it means?
@Yankeee - Sounds good, not too sure which path is better/cheaper.

inboxjason:
@dc42 - could you elaborate on the "burn the fuses" part of your post? I've heard this used a lot lately and not too sure what it means?

There are 3 fuse bytes in the atmega328 processor, which can be programmed and reprogrammed in the same way that the bootloader can be programmed in to the chip. Programming the fuse bytes is commonly referred to as burning them, for historical reasons. One of the things that is controlled by one of the fuse bytes is the brownout level, i.e. the voltage below which the mcu will automatically reset.

To program the fuse bytes, you can either use an in-circuit serial programmer (ICSP) or an Arduino configured as an ICSP.

Retrospectively you bought the wrong arduino for the job :~. You could either buy another 3v3 based ardiuno board, or you could just change the crystal/resonator to an 8mhz type and redownload the sketch using the pro mini 3v3 option.
What you could also do is check if the LED's current limiting resistors can be increased to conserve power, or use PWM fast enough for them to appear on all the time.
Texy

You could buy the 8MHz version of the Xino without the atmega328p, along with a blank atmega328p chip, and use ICSP to set the fuses and program your sketch on it. See Prototyping small embedded projects with Arduino | David Crocker's Solutions blog for how I use ICSP to set fuses and load a sketch.