Is it expected that to maintain constant current up to 4.2V, I will need to raise the…
- User
Is it expected that to maintain constant current up to 4.2V, I will need to raise the charging voltage to above 4.2V?
Assistant
Yes, absolutely. That is not only expected, it is a fundamental requirement of electricity.
To maintain a constant current flow into the battery, the voltage of your power source () must always be higher than the internal voltage of the battery ().
Let's break down why this is the case.
The Water Analogy
Think of electricity like water flowing between two connected tanks.
- Voltage is the water level (potential energy).
- Current is the rate of water flow.
- Resistance is the narrowness of the pipe connecting them.
For water to flow from Tank A (your power supply) to Tank B (your battery), the water level in Tank A must be higher than in Tank B. The difference in water levels is what drives the flow.
The Electrical Explanation
Your charging circuit can be simplified to this model:
R_circuit V_supply O----/\/\/\----+----O V_battery | | |-----> I | | --- GNDWhere:
- : The voltage you command your AP33772 to output.
- : The actual voltage of the battery cell, which increases as it charges.
- : The total resistance of everything between the power supply and the battery terminals. This includes your wires, connectors, PCB traces, and the internal resistance of your current sensor.
- : The charging current you want to keep constant.
According to Kirchhoff's Voltage Law, the relationship is:
The term is the voltage drop across your wiring and components. To maintain a constant current (), you must constantly adjust to be slightly higher than the rising .
Practical Example
Let's assume your target constant current is 1A and the total resistance of your wiring and sensors () is 0.1Ω.
The voltage drop across the circuit will be:
Now, let's see what needs to be at different points in the charge cycle:
-
Battery is discharged (e.g., at 3.4V):
-
Battery is mid-charge (e.g., at 3.8V):
-
Battery is nearly full (e.g., at 4.19V):
As you can see, to continue pushing 1A of current into the battery just before it hits 4.2V, your USB-C power supply will need to output a voltage greater than 4.2V.
CRITICAL SAFETY WARNING
This leads to the most important part of your charger design: The transition from Constant Current (CC) to Constant Voltage (CV).
- Your control loop MUST monitor the battery's terminal voltage () at all times.
- While in the CC phase, your code will be increasing to keep the current constant.
- The moment your sensor reads that has reached 4.2V, you must immediately switch your algorithm.
- Never allow the battery terminal voltage itself to go above 4.2V. Overcharging a lithium-ion cell is extremely dangerous and can lead to permanent damage, venting, or fire.
What your code must do:
Your main loop should look something like this:
# Assuming you have functions to read sensors and set voltage TARGET_CURRENT = 1.0 # Amps MAX_BATTERY_VOLTAGE = 4.20 # Volts while True: measured_current = read_current_sensor() measured_battery_voltage = read_voltage_sensor() # --- PRIMARY SAFETY CHECK --- if measured_battery_voltage >= MAX_BATTERY_VOLTAGE: # ---- CONSTANT VOLTAGE (CV) PHASE ---- # The battery has reached its max voltage. Hold it there. # The goal is to keep measured_battery_voltage at 4.2V # You may need a small PID controller here, but a simple approach is: # Nudge the supply voltage to keep the battery voltage at 4.2V. # The current will naturally taper off. current_supply_voltage = get_current_supply_voltage() # Get the last set voltage if measured_battery_voltage > MAX_BATTERY_VOLTAGE: set_usb_c_voltage(current_supply_voltage - 0.01) # Nudge supply down else: set_usb_c_voltage(current_supply_voltage + 0.01) # Nudge supply up if it dips # Terminate charging when current drops to a low threshold (e.g., < 0.05C) if measured_current < (0.05 * BATTERY_CAPACITY_AH): print("Charging complete.") set_usb_c_voltage(0) # Stop charging break else: # ---- CONSTANT CURRENT (CC) PHASE ---- # This is the logic from the previous answer error = TARGET_CURRENT - measured_current # Use a PI or PID controller for better stability, but simple adjustment works: voltage_adjustment = error * KP_CONSTANT # KP_CONSTANT is a tuning factor new_supply_voltage = get_current_supply_voltage() + voltage_adjustment set_usb_c_voltage(new_supply_voltage) time.sleep(0.1)In summary: Yes, your supply voltage will and must exceed 4.2V to complete the constant current phase. Your safety and success depend on accurately measuring the battery terminal voltage and switching to a constant voltage phase the instant it reaches 4.2V.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.