If the voltage of Solar Panel is higher than the battery, the diode will conduct because it is set to forward polarity, then negative votage will be detected by the pin 1 of the mosfet, and the pin 2 and 3 will remain open. The result: the lights are off.
If the sun goes down, the PV will cease to produce power (0 Volts), the mosfet will detect +12V through resistor. The pin 2 and 3 of the mosfet will close. The result: lights on
We added LM7815 as 15V voltage regulator, to make the voltage that will be fed to the battery lower. Because of the diode has 0.7V drop, the maximum voltage that will be fed to the battery will be 14.3V. Right voltage for absorption charging
Credits: Mr. Ed Brisenio