Hello
I want to use a 8.4v Li-Ion battery for my AVr board and
monitor the battery energy like the mobile.It means I like
to show the user how long the battery will be work for him.
I only need to show 4 step (100% ,75%,50% and 25%) battery level.
I think I use AVR's A/D to chapture the battery voltage and current
but don't know how to get the battery level from them.
what is the best and cheap way to show battery level?
Best method is to integrate the current in and out of the battery. That's what cell phone and laptop battery packs do. The actual hardware depends on the amount of current that will be running through your battery. You can look for "battery gauge" chips (my favorite is MAX1660, but there dozens more). You can look at current sensor chips (like MAX471, MAX472). You can roll you own current sensor out of instrumentation amplifier - it's easy.
Cheap way is to measure the battery voltage through a resistive voltage divider. really inaccurate. I'll quote one of my friends: "Battery voltage is a nonlinear function of everything."