I live in the south of Spain, we get a lot of sun, so I was thinking of hooking up a solar panel on the roof to our fridge. Fridge runs on 220-240 volts AC 50/60Hz, 10 Amps. My current problem is to set it up to switch to the mains whenever there isn't enough sun to provide all the energy it needs.
I was thinking of using a volt meter as a sensor, because it seems straightforward enough, but I'm not sure how to do this
For the rest I was intending to use the "how to use the 5V relay on arduino" (electronicshub.org/use-5v-relay-arduino/) for the circuit and its program (with a few modifications)
That's a 270W 37V DC panel. If you want to run a 2400W device (240V@10A) you're going to need a lot more than a single panel. And to convert the panels output to AC you're going to need an inverter and they're not cheap. A proper solar power inverter will manage the mains/solar switching for you.
But perhaps you just want to top up mains power a little which is a completely different matter. But you'll still need an inverter somewhere in the system to convert solar panel DC to AC.
A thing to watch out for with mains powered fridges is the enormous inrush current when the synchronous motor starts. I have a 1kW (2kW peak) inverter because an 800W (1.5kW peak) was not sufficient. Even with the 1kW inverter the fridge won't start immediately after it is stopped - presumably the intenal pressure is higher and puts a heavier load on the motor. When it doesn't start it can draw 40 amps or more from the 12v battery - which would deplete the battery very quickly, and is probably not good for the fridge either.