Lucas Tanure wrote: > Thank you very much Russel. Yes, I'm just a beginner. > > It's Hobby. Its a 4 Series battery , each one is 1.2v, NiCd , AA Type, > 2100MAh. Rechargeable > 2100mAH AA sound more like NiMH. Which is slightly higher volts. The discharge curve of NiCd and NiMH are similar but not the same. 1st two hits on Bing (Google has decided it's clever to simulate Bookmarks and show me places I have been before, or my own sites). http://shdesigns.org/batts/battcyc.html http://www.thomasdistributing.com/techfacts3.htm Detecting 20% capacity left by voltage could be hard as you are likely on flat part of curve. Detecting nearly charged or nearly flat by voltage is fairly reliable. The Curve moves up and down somewhat according to current draw, so you need to know current. http://www.thomasdistributing.com/images/discharge.gif So as Veronica Merryfield said you need to count. That is detect the first sharp drop from fully charged and count Time x Current (= charge or coulombs). The system can be self training by detecting the end point where you leave the flat part. Also each cycle the capacity is slightly less. If you charge before it's flat you have to detect that too. You can measure current on bench once if you think it doesn't change and use a constant, or use 1/4 of an LM3900 and very small series resistor on supply from battery terminal with LM3900 as differential amp that gives 1V at max charge, 2V at no current and 3V at discharge current etc.. or if charge current can be high and discharge is much lower you can offset to higher volts. The battery pack will vary from nearly 6V on charge to nearly 4V when almost empty. So you may want a LDO regulator or some other PSU circuit to drive the PIC. It certainly needs a more stable voltage for the A/D reference. You might want to divide battery volts by 2 using resistors to get a 2V to 3V range for ADC. I'd not run a PIC directly connected to 4 x NiMH. I'd have at least a series diode (not Schottky) or some kind of regulator. 3 x NiMH is fine for direct connection. You may "get away" with 4 x NiMH direct to VDD & VSS of PIC, but fully charged, on 1/100C trickle or near charged on 1/10C or just after charge the battery pack does exceed max ratings of many 5V chips (4.75 to 5.25). I just checked a probably 1/2 charged pack here, the Battery pack volts rises to 5.8 on charge within 2 minutes, on disconnecting it typically drops instantly to 5.3V and then 5.2V within a minute (a 1/2 charged pack). Sticking 4 x AA fresh Alkaline in the holder gives 6.4V,. Can the user swap the cells? (End point on Alkaline is lower than NiMH, maybe 0.9V vs 1V) -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist