Looks like people have beat me to all of the good answers
I was under the impression that running from a 9v and regulating it to 5v would produce a longer life as there is 5v it can drop whereas if i used a 6v hooked up without regulation there is only 2v to drop before its considered flat.
There is some truth to that (the discharge curve of alkalines is anything but flat), but also consider what a "9V" battery actually is: if you saw one open, it is 6 "AAA" cells (actually something much smaller) wired in series! So the internal resistance is higher, and a lot of the space in the battery is wasted (round cells in a square case), so the capacity (mAh rating) per $ and per volume is not great. You may get much better runtime from 4 "AA" (or larger if you have room) cells in series, even if the voltage "headroom" is less.
will a low voltage cut off draw more power? im not sure that it is entirely necessary, i have discovered already that with flat batteries the PIR trips constantly, so i will have a pretty good idea when the batteries run down.
In general a low-battery cutoff will draw "some" extra ("some" may not be enough to worry about; there are very efficient circuits/ICs for this nowadays), but it sounds like you wouldn't need it anyway
any thoughts on the TDA3664? ive fond them on ebay and am waiting to hear before i buy some.
Here is the datasheet for TDA3664 - looks good! Some lesser leakage ones exist (I am partial to Microchip's MCP170x family, but not sure if you have easy access to those) but 15uA is pretty respectable. And sometimes "available" is the most important spec of all!
Looks like people have beat me to all of the good answers
i dunno, think you doing pretty well...
There is some truth to that (the discharge curve of alkalines is anything but flat), but also consider what a "9V" battery actually is: if you saw one open, it is 6 "AAA" cells (actually something much smaller) wired in series! So the internal resistance is higher, and a lot of the space in the battery is wasted (round cells in a square case), so the capacity (mAh rating) per $ and per volume is not great. You may get much better run time from 4 "AA" (or larger if you have room) cells in series, even if the voltage "headroom" is less.
i have pulled apart a 9v when i was a kid, so i can picture what your saying. I see what you mean.
the MCP1702 are sourceable, but not economically with the postage. .50c item with $12 postage
What sort of battery life would you expect if i did away with the regulator and its 2 capacitors, hooked up it directly to 4x 2500mAH rechargable NiMH which are 1.2V fully charged? Assuming i can get the sleep code working too. know how to wake it after its sleeps, and is the sleep method from the nightingale sketch the way to go?
gr0p3r:
What sort of battery life would you expect if i did away with the regulator and its 2 capacitors, hooked up it directly to 4x 2500mAH rechargable NiMH which are 1.2V fully charged? Assuming i can get the sleep code working too. know how to wake it after its sleeps, and is the sleep method from the nightingale sketch the way to go?
If you use regular NiMH cells, they will lose their charge through self-discharge in a small number of months. If you use low self-discharge (also called hybrid) cells, they should last longer than a 9v battery, probably several years if you get the current consumption low enough. The starting voltage of a fully charged NiMH cell can be as high as 1.4v so you may briefly be running the processor at 5.6v.
The starting voltage of a fully charged NiMH cell can be as high as 1.4v so you may briefly be running the processor at 5.6v.
The batteries ive got ive had for a while and tested them alot, after a full charge they sit at 1.2V. so i dont think ill be running the risk of running at over 5v. What is the likelihood of causing damage by doing this out of interest?
Because i already have loads (like 30) NiMH hanging around, ild be inclined to use them. If i can get a couple of months out of them a few times in a row, then ild probably go get some of them lithums. that datasheet was a good one, i like the look of the graph for Lithium vs Alkaline for low current continuous usage. very steady.
the last bit of info ill need before i go and make all these changes is to know for sure that the "void system_sleep()" function is from the nightingale is right for me and how to wake it up from the "ISR(ANALOG_COMP_vect )"
Another thing about regulators: Even the most efficient regulators are not 100% efficient. Linear regulators are far, far from efficient. So, if you're dropping 4v from a 9v to reach 5v, that's 4v that's just heating the air around your regulator. This pretty much scraps any advantage from trying to conserve power through sleep modes. Running it direct from batteries removes this waste.
The ATmegas are rated to 5.5v, so while four alkalines might be pushing it (don't fresh ones start around 1.45 or so? I don't know), NiMH would likely be just fine. Remember, 5.5v is the serving suggestion. The actual capabilities of the chip could be well beyond that. (You take a risk if you overvolt it, but if it's worth the $4 to you to try it and see what happens, by all means.. give it a shot.)
Fuses aren't bad. Don't be intimidated, just devote an afternoon to reading up on them. There are online calculators that let you pick your options and it'll spit out the values. Then, you follow a tutorial on using avrdude from the command line -- which also isn't a big deal. You can just about copy the command line used by the IDE.
The BoD would be worth it, in my opinion. I would rather have a clear indication when the batteries need to be swapped than slowly having performance turn to crap. Ultimately, it's your call, just don't let having to set fuses scare you off. It's not hard.
so while four alkalines might be pushing it (don't fresh ones start around 1.45 or so? I don't know)
The ones I use start life at 1.6 volts, quickly run down to 1.5 volts, very slowly run down to 0.8 volts (almost linearly), at which point they are effectively dead.
void setup(){
ACSR =
(0<<ACD) | // Analog Comparator: Enabled
(1<<ACBG) | // Analog Comparator Bandgap Select: AIN0 is applied to the positive input
(0<<ACO) | // Analog Comparator Output: Off
(1<<ACI) | // Analog Comparator Interrupt Flag: Clear Pending Interrupt
(1<<ACIE) | // Analog Comparator Interrupt: Enabled
(0<<ACIC) | // Analog Comparator Input Capture: Disabled
(1<<ACIS1) | (0<ACIS0); // Analog Comparator Interrupt Mode: Comparator Interrupt on Rising Output Edge
void system_sleep() {
cbi(ADCSRA,ADEN); // switch Analog to Digitalconverter OFF
set_sleep_mode(SLEEP_MODE_PWR_DOWN); // sleep mode is set here
sleep_enable();
sleep_mode(); // System sleeps here
sleep_disable(); // System continues execution here when watchdog timed out
sbi(ADCSRA,ADEN); // switch Analog to Digitalconverter ON
}
ISR(ANALOG_COMP_vect )
{
pinMode(13, OUTPUT);
digitalWrite(13, HIGH);
sleep_disable(); // System continues execution here when watchdog timed out
sbi(ADCSRA,ADEN); // switch Analog to Digitalconverter ON
wake = 1;
}
set_sleep_mode(SLEEP_MODE_PWR_DOWN); // sleep mode is set here
From the datasheet...
When entering Idle mode, the Analog Comparator should be disabled if not used. When entering ADC Noise Reduction mode, the Analog Comparator should be disabled. In other sleep modes, the Analog Comparator is automatically disabled.
Hey Guys,
Thanks for all your help. ive finally got it finished. Ended up using a couple of watchdogs as i could not get the Analog Comparator to work in sleep mode.
In other sleep modes, the Analog Comparator is automatically disabled.
"Automatically", i couldn't find the manual on. and sleeping to IDLE mode wasnt going to give the power savings needed, so watchdog timers set to differing lengths for different light levels and slowing the clock down.
Could not have a slow clock while fading on the lights as analogWrite doesn't work properly and the lights flash on and off instead of fade till the are on. i worked around that with 2 little subroutines.
here are my initial power consumption results:
it draws 22mA (both with the PIR off or on)
it draws 47mA when LED's are at full brightness (for 9 seconds)
here they are now:
In dark: 0.03mA - 4mA (16 Second sleep)
In Light: 0.3mA - 5mA (1/2 Second Sleep)
LED on: 40.7mA (on for 4 Seconds)
Last night tested battery at 5.18v at 8:30PM and tested again at 8:30am (12 Hours) 5.1v
Thanks so much for everyones help. been a great learning.
Hey Great project! I have a write up about a similar project posted on my blog that friend just finished. He had the same problems but ended up tackling them in different ways. You might want to take a look since the project is so similar.
I like your case. Looks pretty. My one is just all the parts lacky banded to the roof. It comes on in the hallway. Also, 1mhz wouldnt work as the fading on and off flickers. My light fades on and off rather than just being on or off. I should post a video like you have.
Thanks! I made the project that aleph8nought mentioned.
My light also fades from color to color, I had to up the pwm base frequency after dropping the clock to 1MHz.
The code is linked in the blog post for specifics...