Presumably the battery is a single LiPo cell.
You cannot simultaneously charge and discharge a battery.
I_battery = +Icharge - Iload.
If I battery above is +ve the battery is charging.
If Ibattery above is negative the battery is discharging.
This is not a problem, just needs to be understood.
A LiPo cell MUST NOT EVER be charged above 4.2V and MUST NOT EVER be "floated" at 4.2V. There are two choices
- Charge with a purpose designed charger controller.
There are effective low cost modules available using a TP4056 IC.
Buy ONLY the versions with separate Vout and battery terminals - these handle charge control, over and under voltage protection and more.
Examples only - NOT a recommendation HERE AND HERE
- Clamp the battery at 4.1V or less so that it NEVER reaches 4.2V.
Voltages in the range 4.0V - 4.1V are OK.
Higher than 4.1V risks early death of the battery.
Lower than 4.0 will result in a low battery capacity.
If you check operation in full sun with a fully charged battery a zener diode (perhaps 3.9V) may do the job of battery clamp well enough.
A TL431 clamp regulator will allow a precision clamp voltage of say 4.0V to be set.
Depending on the battery mAh and PV panel rating you may need a clamp circuit with a external pass transistor as well.
Q1: What is the battery mAh?
Q2: What are the PV panel specifications.
Any datasheet links?