Question: How to accurately calculate battery % left?

I would like to know how do electronics (ie smartphones,mobilephones,laptops etc) know exactly what % of juice is left in the battery and how long that juice is going to last.

Thank you in advance

Voidugu: I would like to know how do electronics (ie smartphones,mobilephones,laptops etc) know exactly what % of juice is left in the battery and how long that juice is going to last.

Thank you in advance

Such 'fuel gage' measurements are often pretty inaccurate on many consumer devices. There are two methods commonly used, especially for Li-Po powered devices. The 'low tech' method is to simply measure the battery terminal voltage while in use as LiPo cell has a fairly linear voltage discharge 'curve' of 4.2 at 100% down to 3.0 volts which is the common recommended lowest discharge voltage to use. The more 'higher tech' method is to measure current consumption continuously and integrate the value over time such that one can measure the actual mAH of capacity consumed sense the last full charge.

Lefty

Is there another better/more sophisticated way to measure current other than to pass the current through a resistor and measure the voltage drop across it?

You can use hall effect current sensors but they only work with heaver currents. What current do you have?

What is the minimum amount of current that these sensors can sense? The current i would like to measure would be between 5mA to 10A or even more.

Well the 5mA is right out. You should start to get usable readings at about 200mA right up to 10A and beyond.

Have a look at what is on offer with this selection page on current sensors.

http://uk.farnell.com/sensors-transducers_current

Thanks for the help Mr.Lefty and Mr.Mike By the way these sensors are extremely expensive. I guess i ll stick to the good old resistor for measuring current :d

Put a 1 Ohm resistor in the power supply and measure the voltage drop across it.

Or an even smaller value to reduce the power dissipated and increase circuit efficiency

There is a lot of cheap "high side current sense" chips from TI, LT, Maxim, Microchip, AD, ST. That is what you need. You need a few milliohm resistor (maybe a short pcb trace??) with such HSCS amplifier. Measure the current and voltage with A/D each 10ms and sum it. You'll get roughly the capacity. Just google it.. Reading: http://www.maximintegrated.com/app-notes/index.mvp/id/746