Build Your Own Grid Tie Inverter

Inverters that convert DC into AC are pretty commonplace, some cars even have standard AC receptacles in them for you to plug in your favorite appliance. However, there’s a particular type of inverter called a grid tie inverter that allows you not only to make AC, but also inject it back through an AC outlet to power other devices in conjunction with the normal AC service. Why? Maybe you want to use your own generator or solar power. In some cases, the power company will pay you if you produce more power than you consume. Maybe you just want to know you can do it. That seems to be the motivation behind [fotherby’s] build, which is quite substantial.

The setup only handles about 60 watts, but it does all the functions you need: DC to AC conversion as well as phase and voltage matching. Actually, just converting DC to AC is almost trivial if you don’t care about the waveform. But in this case, you do care that you can create an AC signal to match the one already on the line.

The project is simplified by the use of a STM32F407 board which has some nice high-speed A/D as well as a TI H-bridge board. Another simplification was the use of a transformer, so the inverter only has to create 40V. This is a non-trivial and somewhat dangerous project. However, [fotherby] provides a lot of detail and theory, so even if you don’t want to build it, you might enjoy looking over the work.

Speaking of safety, the system detects if the utility voltage looks bad and if it is, the system shuts down the inverter. This helps prevent islanding — where a utility or electrician thinks a circuit is not live, but voltage is coming from another source.

Overall, this was a very interesting project, especially if you aren’t usually dealing with the power line. Obviously, if you wanted to do this in North America, you’d need some modifications. No matter where you are if you attempt this we suggest you review some safety guidelines.

 

38 thoughts on “Build Your Own Grid Tie Inverter

      1. Look, this “you’ll kill line workers” stuff is nonsense. It’s one thing on a general site like reddit, but it’s inexcusable here on a site like HaD because you have to be incredibly ignorant of basic electronics to think this is a danger.

        First off: if your neighborhood becomes islanded, your inverter will be trying to power the entire neighborhood, which means it will effectively be shorted out.

        Second: line workers don’t touch *nothin* unless they’ve tested it first.

        Third: line workers don’t touch *nothin* except through insulated tools and gloves, even if they’ve tested it.

        Every time this comes up on reddit, actual line workers chime in and say “yeah, this really isn’t a problem.” Power companies cannot provide a single case of a line worker being killed by a home generation/inverter setup. Yet a *lot* of lineworkers are killed in the matter of normal operations, almost always because of lax safety precautions.

        All the hooplah around grid-tie inverters and islanding and such serves two purposes: discouraging home generation by making it more costly, and making it impossible for the homeowner to go off-grid completely with the equipment they’ve installed, because that’s what power companies *really* fear. As more and more people NOPE out of the grid, the cost of the grid per customer goes up. And that means more people NOPE out.

        The only service a utility provides to someone with a couple of kW of solar panels on their roof, or a wind turbine: night-time/low wind power and satisfying peak demand with high inrush current. Particularly in an age of supercapacitors, cheap lithium ion batteries, and very low resistance MOSFETs that have better surge current handling…utilities are going to quickly become irrelevant there as well.

        Basically power companies want to knee-cap your home inverter, not for lineman safety, but because it’s a huge threat to their business model.

        1. I don’t think its anywhere near the ‘huge threat’ you are talking about, though it may be why most this type is the most common install (if it even is).

          I’ve got enough solar here to probably go off-grid and make it work even through the winter if I invested in some more energy storage. BUT it would be very much managing my lifestyle to the load, can’t turn on the next device without checking the powerbank is full enough/the sun is really out. That is damn inconvenient – Do I really want to worry about the freezer/fridge being off for hours and no morning cuppa tomorrow because I ran a load through the washing machine and the dishwasher today on the third winter day in a row of terrible weather.

          Also to be able to have a hope of being off-grid you need to way overspec for your draw – so at peak you are going to be able to generate so much more than you can ever store => Even if you only get paid a token amount for the power you give back it helps keep the gas and coal power stations off (which is good the planet) and doesn’t cost you extra to get this little payout.

        2. I’m surprise to read that line workers are isolated from the network.

          All the people I’ve seen working on trams/railways (600V-1.5kV DC or 16.7-25kV AC) test the line voltage, and then short it to the ground before they work on it.
          On 400V AC power lines, a lot of rules mention to switch off the power, test if everything has been properly shut-down, short all the phases to the earth, and put a lock with a note on the cabinet so no one can switch it on while you are working on it, and measure again at the point you’ll be working.
          I’ve never seen operators working on >110kV lines while it’s powered-on, but I’ve heard they charge themselves with a stick in order to have their body at the line voltage.

  1. Wouldn’t it be easier to do in analog by using the mains voltage itself as the reference waveform for an analog current mode PWM? Basically an active PFC in reverse.

    If the purpose is purely for education, AC wall warts can be used to eliminate the need to wire up any mains – just plug it in.

    If the purpose is to get around laws regarding connecting homemade circuits to the mains, there might be some commercially available (and not too expensive) box that’s already approved to plug into the mains and gives a connection to the secondary of a large high current transformer. Landscape lighting transformers used to be one source but the bigger ones are far less common with LEDs replacing halogens and the newer ones are likely to be switchers. Welders (at least the cheaper ones for home use) aren’t designed for continuous duty and the newer ones also tend to be switchers.

    1. Welders aren’t rated for continuous at maximum output, but could be used at 25% or so.

      Probably why it’s good to have 24V inverter/solar/batt setup then you can go 2:1 2:1 or one of those rural 480:120 pole transformers.

  2. I don’t understand why grid-tie inverters shut down when the mains does. Surely this is exactly when you’d most want to use your solar/battery source. What should happen is the mains is disconnected, to avoid islanding, but the inveerter continues to supply the local wiring.

    Or even, why export power at all? The most obvious use of solar is for the solar power to supplement the mains, so you use your solar power, but the mains ‘tops it up’ when demand exceeds your setup. is there a ‘one-way’ grid-tie inverter?

        1. There are hybrid systems that can work like this, but require batteries as sort of an anchor for the system. Straight solar generation is too unpredictable to be able to generate a clean AC power signal with.

    1. there are different setups. grid tied inverters are not meant for backup use, they are meant to offset the cost of the power you use while maintaining the reliability of the grid power as well as not requiring batteries. with grid tied, any excess power is credited to you, usually at the same rate that you pay, in the summer you over produce to build your credit, then in winter when you generally produce less, you use up that credit. home systems with batteries for backup use a completely different inverter along with batteries, a charger and an automatic transfer switch to do what you are mentioning. transfer switch systems and inverters don’t require synchronizing either.

      1. Yes, a ‘hybrid’ system is what I have in mind. It seems like a completely obvious use-case to me, yet it seems hardly discussed, system always seem to be either grid-tied with export back to the utility, or stand-alone/backup systems, completely separate from the utility.

          1. Look at it another way: the places where electricity is most reliable are the same places with a lot of solar power potential. At least in the U.S., weather that makes the grid less reliable also makes solar less viable.

            Now *wind* power is a different story…

        1. what people don’t realize about the cost of hybrid systems, the batteries are about 30% of the cost, and will only last, if lucky, 10 years, then another 10-20 grand on replacements.

          as inside note, I install solar for a living.

          1. @Mike Grimes, as a professional in the field, I’d love to know your opinion about lead acid batteries vs Li ion – which are more reliable, which last longer? Which have the lowest *long-term* cost?

          2. Mike, do LFP batteries still have trouble charging below 0 C or is that solved already?

            The main reason why they aren’t put in cars is because they couldn’t tolerate the cold. You start the car, and the battery won’t take a charge, so you start to run out.

    1. I built my own two-headed EVSE. It’s the sort of project that, like this, would be hazardous if it were done badly. But just because it can be done badly, doesn’t imply that it’s impossible to NOT do it badly.

      But projects like this should not be improvised. You should know what safety systems are present in reference designs and what they’re for and how to insure that they work properly.

      My Hydra has been charging cars for us since 2013 (though the design has been refined over the years).

  3. Interesting excersize in reinventing the wheel, and with no practical value other than that.

    Actually hooking this up to the grid would be illegal AF, dangerous, and supremely irresponsible.

    1. Legality of homebrew/homefitted electrics is unlikely to be consistent globally, so make sure to know the rules that apply to you!
      Something like this with the proper care can be made and fitted perfectly safely, but I know here you technically aren’t allowed to do anything at all to your home electric circuits without then getting it signed off. Though I highly doubt that is ever done on home jobs – some of the wiring I’ve worked round in various friends houses clearly never was – perfectly safe in general but with the wires running in illogical ways and frequently sockets far to close (at least legally) to water.

  4. Some type of electricity meters increase the reading regardless the direction of the flow of energy. This means that the surplus that is given as a gift to the utility when the sun is high and load is low is metered and billed.
    No big deal for 60 W, for bigger setups it is needed a feature called “limiter”, can be integrated into the inverter or needs a device like this. Don’t know if it works, it’s the first i found. https://www.aliexpress.com/item/4000097503320.html?spm=a2g0o.productlist.0.0.7a18b6616AtiIH&algo_pvid=4bb00295-64d0-4331-900b-c20f845df6eb&algo_expid=4bb00295-64d0-4331-900b-c20f845df6eb-12&btsid=0ab6f82c15908221898905639eec61&ws_ab_test=searchweb0_0,searchweb201602_,searchweb201603_

    1. Correct. This is a potential result from anti-tampering systems. Olden days, when a meter can was inserted incorrectly, typically after it had been cutoff for various reasons by the utility company, the design would allow power back in to the service location. As such, newer meters have anti-tampering that can still allow power through, but count that power as delivered regardless of the direction. This is becoming more common on AMI/AMR systems, which have a different rate program installed in the meter for users of grid-tied solar. Good way to find who hasn’t registered their grid-tied solar with the Utility, as is required in our service area. They call and complain that their system

      Source: Am implementing AMI/AMR for our Utility

  5. Modern class D amplifiers are super cheap on Aliexpress. Piar it up with a sizable transforment, or a small mountain of repurposed old school halogen transformers and you’re half way there.

  6. I’ve often pondered charging up batteries in offpeak times and them dumping them back into the grid during peak times (pay 20cents over night to charge, get paid 54 cents in the day to discharge) but I don’t honestly think I’d get sufficient effiicency.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.