When light intensity is too low, the panel discharges the battery.
First, the solar panel was directly connected to the battery. When light intensity is too low, the panel discharges the battery. I first tried to prevent this using a MOSFETcontrolled by the Arduino to detach the panel from the battery and measure the voltage, but failed. I don't know why anymore, was months ago and i never fully understood.
Also i think i still need an option to protect the battery from overcharging. Either some resistor will generate heat or the solar panels disconnect.