I have both solar and mains voltage at my house and since the solar isn't enough to continuously power the house , we switch between it and mains when there is less sun.I was hoping to make an automated system to do this switching using a relay and a raspberry pi.

I understand that a solid state relay provides a fast switch,
Is this a realistic project ?
Is a Solid State or Mechanical relay which would fit the requirements available?
If so what should I be looking for ?

To make it more clear,I have two sources of power and I use a manual switch as shown below to switch between them enter image description here

I want to use a relay instead of the change over switch and would like to know what kind of relay I should use. (Indian 220V system)

  • 1
    Welcome to StackExchange. There are many facts about your system which you have not told us. Often this is due to assuming "all systems are just like mine", but sometimes the asker simply does not know the details. We need more info both to understand your system and try to work out if it would be within your reach to alter it. Aug 3, 2018 at 20:26
  • Sorry if it was not clear , I have a 1KW solar system set up with an inverter producing 220V AC and also a grid connection providing 220V.A manual change-over switch is used to switch between the solar battery source and the grid power.I was hoping to use a relay instead of the manual change over switch to control it remotely and automate it.Hope this makes it clear.
    – ijk
    Aug 3, 2018 at 20:35
  • This sounds like a "does such a product exist" question, which unfortunately is off-topic here. Aug 3, 2018 at 21:27
  • 1
    @DanielGriscom not necessarily, it may be "how do I lay this out". Don't do the same thing he's doing of assuming "all solar systems are just like the system I'm thinking of right now". Right off the bat he's got batteries on there, which raises more questions than it answers. Aug 3, 2018 at 21:36
  • I also need you to disclaim that it's not a grid-tied system. Is it North American split-phase "110/220" or is it Euro style 220 single phase? How do you select which loads are solar/battery powered or do you try to power up the whole house? Are some of your loads DC or do they all need the inverter spun up? Do the loads need to run all the time (fridge, sump pump) or just during your desired use? Aug 3, 2018 at 21:37

2 Answers 2


There is more to it that you may not realize. By using manual switching, you inherently prevent even the remotest possibility of back-feeding the utility grid with your solar power. It is not physically capable of being connected to both systems simultaneously. As soon as you "automate" this, you introduce the possibility that something could fail in an unsafe state. The result could then be that your solar system is feeding the grid and a utility line worker is killed by it because he is working on the wires when your "transfer switch" screws up and connects. For that very reason, as soon as you go with anything other than a manual changeover switch, it must have certification that your power utility accepts regarding its safety.

You will need to start there before you buy anything.

And to answer your question about using solid state switching, absolutely not. Solid state switches "leak" when they are supposedly off. The leakage is minimal and for general purposes is often ignored, but for something like this it is potentially lethal.

  • I understand and thank you for answering.What do you think about two Mechanically interlocked Contactors like I've commented on another answer. This Youtube video (youtube.com/watch?v=gTiOJZalzhY ) shows a transfer switch implemented with them which can be controlled by an Arduino.But I don't like the idea of relying too much on the mechanical interlock like in the video.I was think of adding a 1-2 sec delay in the switching and the mechanical interlock as an extra layer of safety. not like in the video
    – ijk
    Apr 20, 2019 at 6:24

What you want is a premade automatic transfer switch, not some fabricobbled thingy

The device you are looking to replicate is something called an automatic transfer switch, or ATS for short. These are available premade from electrical mains equipment suppliers, and are not something that should be fabricobbled together, lest you violate the grid standards where you are at or inadvertently power a lineman who's trying to fix the grid.

One caveat with most smaller automatic transfer switches is that they are designed to prioritize their nominal grid input and cannot be changed from this. In your case, you want the inverter output to have priority over the grid, so it should go into the input on the ATS labeled "grid" or "I", while the input labeled "generator", "gen", or "II" on the ATS should be used for the grid connection.

  • As you said an ATS switches between two sources of different priority when the other is not a available.I don't want to completely deplete my Solar Battery packs before switching to the grid.I want to be able to monitor the sun and current usage and switch when necessary.For that I want a safe method to switch between sources triggered by an electronics signal (Example, a signal from a Raspberry Pi). An ATS , I believe ,is of no use in the scenario.
    – ijk
    Aug 9, 2018 at 4:58
  • @ijk -- you can still use the ATS -- simply have the inverter curtail its own output when it sees insufficient power coming in from the solar panels Aug 9, 2018 at 11:48
  • I don't want to modify or add anything to the installed solarpower system and risk voiding it's warranty.
    – ijk
    Aug 31, 2018 at 18:50
  • I also figured out why you guys couldn't really understand why I need a system like this.In India we have power outages,It's not that frequent at my place , But it's still there.So I want to maintain a reserve battery level in case of one.So I don't want an ATC which is designed to switch sources when on is not available.
    – ijk
    Aug 31, 2018 at 18:58
  • While looking up ATC's I think I've stumbled upon what I would've expected to get as an answer to my question. Contactors. Specifically , Two Mechanically interlocked Contactors This youtube video showing how to use contactors to implement an ATC caught my attention. youtube.com/watch?v=gTiOJZalzhY Even though I may not do it exactly the same way (I understand that switching between two unsynchronized sources with such low delay is not ideal, 1-2 second delay is fine with me) , I think this might fit my requirement. @Harper
    – ijk
    Aug 31, 2018 at 19:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.