Quote Originally Posted by lerameur View Post
and lastly,

i want to use a 9v battery to power the system. I want to add a led to signal when the battery need to be changed. would you know at what voltage this would be ?
For one thing, I don't know what your system is made of (I know bits and pieces, that's it, not the whole thing). And another thing, a 9v battery would be dead in a short matter of days running this system, especially if you're using a linear regulator (7805 type), even if you set it up to spend most of it's time sleeping and only waking up like once a minute or so.

Better idea would be to go with a 4 cell (AAA or AA, doesn't matter) NiMH pack and skip the regulators altogether, then charge it up for about 12 hours using a 9v wall wart and an inline 200-ish ohm series resistor (less resistor = quicker charge at the expense of battery life). 4 2000mAh NiMH batteries would last a LOT longer than a 9v battery.

But if you insist on a 9v battery, I'd hook it up to an unused A/D input thru a voltage divider consisting of 2 equal resistors. Get the A/D input working and displaying correctly, then turn on the 'change battery' light at about 6.5v. Anything below that and the regulator won't regulate (if you're using a 7805 type).