Hi Ray_of_hope,
So you're looking to make a 'general purpose' battery
charger that can be used for various types of battery.
Well some batteries like to be charged gently over a
good few hours, some batteries can be charged at a
fair current, up to a point, then gently to full
charge.
You wont be able to get the unit to tell which is
which so that will have to be set by the user.
A rotary switch with a few settings for those voltages
you think you will want, and maybe a switch to limit
the current so as small batteries dont get damaged.
12 volt max current for motor car lead acid types.
various voltages for Ni-Cad, Lithium, etc, most of
which would want low currents to charge, ranging
from 100 mA to 300 mA.
The state of charge on most batteries can be found
from the open cicuit terminal voltage, but it varies
between different types.
And its not a very good guide on ageing batteries,
I dont think a computer could assess the various
parameters necessary to determine the charging needs
of any battery presented to it.
The PC could present the user with a set of choices,
from which the PC could then operate.
Such as:
please enter LA for lead-acid, NC for nicad, L for
lithium.
please enter the voltage this battery is supposed
to be.
please enter the Ampere Hours rating.
Such a program could be run in the background, it
could possibly be arranged that if the battery were
removed, the set of choices could be presented again
in the event that the battery may have been changed
for a different one.
I dont think it can be done automatically, unless it
is known that only a given type of battery will be
connected.
Best of luck with it,
John