In the picture you connected the MOSFET so that during normal operation the Gate is low and will be able to draw current from the module to the solar panel which is what you wanted to prevent (?). The sink is connected to the + pole of the panel. Don't know what you wanted to accomplish with this. Did you draw it wrongly?
(it 's a P-Channel MOSFET )
normal operation = panel delivers 5V.
MOSFET 'S VGS < 0 (Gate has 0V, Source has more than 0V)
MOSFET is conducting, current is flowing from Drain to Source (left to right), charging normally, everything ok.
NOT normal operation = panel delivers 0V(at night).
MOSFET 'S VGS < 0 (Gate has 0V, Source again has more than 0V (voltage coming from the battery))
So the MOSFET 's conduction does not stop and current is flowing from Source to Drain (right to left ).
Current is flowing from the battery to the panel?
So it 's not working?
(I want to use a MOSFET because it has a lower voltage drop. So I should go for a diode with a low voltage drop?)