To begin this project I'd like to give an overview of the process of charging Lithium batteries of various chemistries. There are two primary phases in charging a lithium battery: A Constant Current phase (CC), and a Constant Voltage phase (CV). A discharged battery will be fed a constant current until the battery measures a pre-determined voltage, at which point that voltage is held while the current drops to a pre-determined value related to a battery's rated capacity. Once this point has been reached, the battery is considered charged and the charger that is connected should not pass any additional current into the battery.

A figure of the process occurring with a Li-ion cell. A battery is formed from one or more cells.

In the roughly 30 years that lithium batteries have been on the commercial markets, several types of lithium chemistries fulfill most of the world's demand (described as the compound of the cathodes): Lithium Cobalt Oxides (LCO), Lithium Nickel Manganese Cobalt (NMC), Lithium Nickel Manganese Oxide (NMO), Lithium Iron Phosphate (LFP), etc... In this list all but the LFP chemistries can be charged surpassing 4.1 volts (LFP at roughly 3.6V), the absolute latest designs can withstand a CV set point of 4.4V! Most chemistries are considered discharged below 3.0 volts.

With advances in the design of lithium batteries, in addition to the slow increase in capacity, a tradeoff can be made in how fast a lithium cell can be charged. Higher charge and discharge rates for a small sacrifice in capacity. We label charge/discharge rates with a "C" nomenclature. This "C" rating is linearly proportional to the capacity of a battery, e.g. A 2 amp-hour (Ah) battery charging at 1C has 2 amps going into it.
A large portion of charging ICs for the consumer market are designed to charge batteries roughly around 0.5-1C. Also, a battery charging at a rate of 1C means 100% of the battery's capacity is put into it in one hour, A rate of 2C would mean the battery was charged at twice the rate (finished in half an hour).

And to begin with describing how a lithium charger is designed, let's look at common examples. The hobbyist market has been dominated with very inexpensive chargers based on the TP4056, designed by Top Power ASIC. This is a linear charger which is mainly designed for a 5V input and charges batteries to roughly 4.2V (not for LFP chemistries) at rates of up to 1.2A.
A block diagram of the device can be found online, and here is a copy for reference. This will provide a solid foundation for creating a CC-CV charger of our own.

TP4056 Datasheet, Page 7

A second reference is a Microchip brand charger, the MCP73831. This IC is also a linear charger. Several options of output voltage exist (from 4.2 to 4.5V) and can output up to 500mA. The datasheet contains a useful block diagram as well.

MCP73831 Datasheet, Page 2

Both ICs have similar structures. Externally, both ICs have a single resistor which programs the CC stage. There is a means to display the state of the charger through one or more LEDs. The pass transistor, which sits between the battery and the input supply voltage both seem to want to be turned on hard, and are put into regulation by Op Amps. I want to highlight how unintuitive this form of regulation sounds with an comparison. We drive our cars with out feet on the pedals. Press down on the accelerator and our car goes faster. This IC of a car has a brick on the pedal and the Op Amps make it go slower by lifting the brick up.

Whatever current is going through the pass transistor is mirrored through another transistor in the IC. Not 1:1 mirroring, but a small fraction (1:1000 in the MCP IC, 1:1200 in the TP IC). This fraction goes through the PROG pin to ground. i.e. 1200mA going into the battery means 1mA is going through the resistor on the PROG pin, and that voltage generated on the resistor is tied to the inputs of several internal Op Amps. While the current mirror approach is elegant, it cannot be easily recreated in a standalone discrete circuit. We will have to try another method of current measurement.

In the following updates I will go through the specifics on designing each stage this charger incorporates.