i need 2 things 1st thing how can i know that my nimh battery is empty or how to calculate how full is it (30,40,50 percent)?
second thing is there is a way to calculate the amps with my micro? i can calculate the voltage easily , but i dont know how to calculate the current flowing (it will help me to know if the motor is moving or not(if the drawn amps >= max amps drawn then its not moving ))
If you have a stable voltage to test against for an analog in put, you can get reasonable numbers for your battery voltage. With battery voltage you can know approximately what percentage your battery discharge is.
Current is also easy. Ohms law states Voltage (in Volts) = Current (in Amps) * Resistance (in Ohms). If you are after amperage, you solve for current; Current = Voltage / Resistance. You will get more accurate current numbers with more accurate resistors. OddBot has a post about current sensing for motors.