Home made grid-tie inverter (not even all that sketchy)

Поділитися
Вставка
  • Опубліковано 25 гру 2024
  • A few years ago, I built a crude DIY grid-tie inverter. Its performance however, wasn't good enough, so I decided to have another go at it.
    Here's a link to the circuit diagram/code for this project: akiotv.nl/ware...
    (AKIO TV) MMXXIV
    / actual_akiotv

КОМЕНТАРІ • 46

  • @AKIOTV
    @AKIOTV  6 місяців тому +7

    Perhaps I'm stating the obvious, but of course this inverter is meant for demonstration/educational purposes. If you need to deploy an inverter for production use, just get an off the shelf unit that meets all the grid code requirements of your region. Hope you enjoy the video :)

  • @surgingcircuits6955
    @surgingcircuits6955 2 дні тому

    Very Interesting Video. Enjoyed it and looking for more. Cheers.

  • @HL65536
    @HL65536 6 днів тому

    For measuring current while isolated, hall effect current sensors can be used. They basically measure the magnetic field generated by the current flow (without the need to be connected electrically). I used them for my DIY solar MPPT, though for a different reason (lower losses than shunt resistors, especially at higher currents).

  • @erichertsens
    @erichertsens 2 місяці тому +1

    Thanks for this video, learned a lot, from Dominican Republic

  • @ademuyiwaolutayo2904
    @ademuyiwaolutayo2904 Місяць тому +1

    Thanks for this update

  • @nielsdaemen
    @nielsdaemen 6 місяців тому +1

    First of all, thanks for pointing out my comment on your previous grid-tie inverter video!
    I really love the improvements you made, I actually build something simular with the same H-bridge module a while back. I did manage to push 50W into the grid, but unfortunatly I eventually blew up the H-bridge (ordered new a few diffrent new one's with faster slew rates that I want to run at 30 kHz). I think My mistake was that I plugged in the grid before plugging in the DC side, causing the H-bridge to function as a rectifier and blowing the mosfets diodes because of the huge inrush current filling the capacitors. When I get mine working again, I will start experimenting with the possibilty for it to work as a charger too, pulling power from the grid and pushing into the battery, this should be possible without any aditional hardware.
    I will keep you updated.
    Btw, my question still remains: Did you check the output current waveform on a scope? Since you measured a power factor of 0.95, it should be pretty smooth, but i'm still curious!

    • @AKIOTV
      @AKIOTV  6 місяців тому +2

      Ah yes, I blew up one of these things too. The reason I blew up mine is that the BTS7960 chips that it uses have the low side switch on by default. So if both half bridge devices are enabled, and both PWM signals are low, the low sides are turned on, creating a short circuit through the ground rail. This happens all the time during PWM and is no problem then, but if it happens for a longer time you're done. My mistake was that I programmed the arduino to go into standby mode upon detecting a problem, but then I forgot to add some code to disable the EN signals to the bridge, leaving the bridge with both low sides on with the AC side hooked up.
      My thing seems to have no problem with the DC power being off, as long as the inverter is in standby mode and the H-bridge switches all disabled. Would it be possible that your microcontroller enabled the bridge (for instance because it was also powered from a laptop or something) without the DC connected? That could create essentially the same condition I had.
      I put the scope across the shunt resistor on the low voltage side on the transformer to see the current. Forgot to include it in the video, but it looks reasonably smooth, although less smooth than the voltage. I think I'm going to put a picture of it in the folder that has the schematics and stuff.
      BTW About the battery charging, if it's a simple lead acid battery you might be able to cheat your way into doing this by just using the diodes as a rectifier. You'd just hook up the H bridge to a tap on the transformer that has a slightly higher voltage than the battery and it'll charge passively with the bridge turned off. You could use a simple relay to select the right tap on the transformer, connecting a lower voltage one for sending power onto the grid, and selecting the higher voltage one for automatically charging the battery. It's pretty rough and you'll have no control over charging speed etc. but it'll work, my old school lead acid battery charger is also nothing more than a transformer and a rectifier. (which is in that thing actually a *single diode* haha)

    • @nielsdaemen
      @nielsdaemen 6 місяців тому

      @@AKIOTV I think you're right about the way I blew up my H-bridge. I had the enable pins driven high before the battery was connected and the correct pwm signals where applied. Won't make that mistake again.
      Yes please do put a picture of the current waveform in the zip. My current waveform looked very rough, I was expirimenting with many different inductor values and even wound my own on different core types, problem is finding one that has enough inductance, and doesn't saturate up to about 15A
      As for the charging part, I have to say I first though of doing it exactly the same way you described, but this would indeed require a perfectly matched transformer winding/tab + the power factor and efficiency would be horrible as a rectifier only draws current at the peaks of the sine wave. Then I found out how victron inverter/chargers work!
      It's nicely explained in this video: ua-cam.com/video/UPfUn5ki7OM/v-deo.html
      Basically it's working like a buck converter in inverter mode, and like a boost converter in charging mode. The pwm duty cycle is always following the grid waveform, but is controlled in such a way that it aims just over the grid voltage in inverter mode, and just under in charging mode, causing the current to flow the other way.
      In this simple simulation you can see how this works with a simplified half bridge version:
      www.falstad.com/circuit/circuitjs.html?ctz=CQAgjCAMB0l3BWK0BsB2AnADgEwI5gMw6SFZYSGEhIAs1CApgLRhgBQAZiISliDhy0Q9HAKE9qYaEhgduvfoQRjRPFTzHTZ0DgHcRxAeUNihkKOwDmpkWBS3atfhcjsANrZwn8Zk69hICGlCSBJiQgxIBDgUFAQ0SwM1b341Kgc3G18eLGEcpxcknj5xYUVjF3YAJR5IYVSBND8isRi4Gk6AtBR2ACcQHv5GrBQG-2QOAGMaDDEyfLnKqGR4OAwNza3tjBBmFF0cTebCWjQ4c8zAjgrz8f47spW3MGaQUfuQDDAWlcSHIoBJAANQA9u4AC4AQysjHYADcBJA0vYkcMJK4RBYwJigewDCQUQ41LRUW5kkYKiSyfjJA4fmkjAzimpmSlkcUKo0KsoxG4qUzvLYsLj2ABJOqfLkTYL886zX6PRoQbHsAAeXzOAiWbDi2ro4H4AHE+gBLAAmAB0AM5TUEAO3tjCmEMYVutEL6UPt1s4oL6AFtGH11YMwLtThAohGnCJDSAAOqm+3m5NWAD0elNfUYNpz1tNHu9UzhBiGyyV-lD4f4rDEGAQEGYu2EYH4AAVQXpgzbOO4u9be31QQGbQAjKEQ119ACeNohoJtVjN7r0AAtGPabQAKCdT4Nz63w8HQ2E2gBUNvNAFcITOpvf3IwAJQ2gB8S5XNuPkJhucH1rbgAQteUwANY2gGoLmi+1YEAIwgNg4OCJK2HZdj2vr9noAGcMOo7WsuFrzou1p7tOh7rpuO7kQe34nn+F5Xre96Pi+NoADyfsRR4MWeAHAaCoIejaACy0GwQMhJPNJzIBNMdLgEKGTgCguKwFG0DfGAtD4DiaBoMoGC8KsQTWIp9gWCpryZJYGo4mh2LGYa1CthAYr2tO9pQu4eaMAWRb2iWtKycpJlyaGpLCKwYDUHw0VsBYDTCB58LBtONoAMJrlCfSwn0NoAA5mkFpqFU+7Cggh4ArLQkAbOAFgHMIFhmOU7BkO8IAAGIQLIjUWKwIAACIsVlbHsEAA

    • @AKIOTV
      @AKIOTV  6 місяців тому +1

      @@nielsdaemen That is a much more proper way of doing the charging thing. It would be quite elegant if you could implement that with merely a software change.
      I've added the image to the folder. It's not a perfect waveform, but I'd say it's all right. I suspect the current waveform is more dependent on accurate synchronization than on the filter itself.

    • @nielsdaemen
      @nielsdaemen 6 місяців тому

      @@AKIOTV That current waveform looks quite alright indeed!
      Another thing that infuences the current waveform is if the grid waveform isn't actually a nice sine wave. Where I live, the grid waveform always has a huge flat top, so when the inverter tries to output a nice sine wave, it will deliver a bug current spike at the peaks because the difference between the inverter output and the grid is larger.

    • @AKIOTV
      @AKIOTV  6 місяців тому

      @@nielsdaemen True

  • @EvgeniShatohhin
    @EvgeniShatohhin Місяць тому

    Amazing! Thank you!

  • @jensschroder8214
    @jensschroder8214 5 місяців тому +1

    I have to object. In Germany, grid tide inverters must have a double shutdown in the event of a fault. On the one hand, the mains voltage is monitored and the H bridge is switched off via software. On the other hand, a relay must be added that separates the inverter from the mains voltage.
    A large Chinese manufacturer ran into problems because he replaced the relay with a wire bridge. The Chinese decided to provide customers with an additional relay free of charge. This saved the manufacturer's reputation.

    • @AKIOTV
      @AKIOTV  5 місяців тому

      @@jensschroder8214 Quite possibly the relay is required here in holland too, but I'm not sure. It's also possible it's required starting at a certain power level, maybe micro inverters are excluded. I'll look it up and maybe add one on.

    • @cyber5515
      @cyber5515 2 місяці тому +2

      The relay is only about isolating the inverter output from the grid when it is inactive. This is a separate device with microinverters. The deliberate frequency drift (explained at 6:25) and the freq test (explained at 15:10) actually implements a slip mode frequency shift anti-islanding algorithm and is a very good idea. If a relay is put in the circuit and is cut under inductive load, it could break the mosfets in the H-bridge. The regs require the anti-islanding alg to shut down the inverter within 5 seconds after AC power shut-off. So, plenty of time to detect no power, shutdown the mosfets and switch off the AC relay (and then back on again a few secs after the AC power is back on).

  • @electroumit
    @electroumit 2 місяці тому

    Thank you. Good work.

  • @HIBAW
    @HIBAW 6 днів тому

    Totally awesome man. ty.

  • @terryuland6502
    @terryuland6502 6 місяців тому

    Regarding your high side voltage and current, you can use a current transformer to get the current and a small rectifier with a voltage divider for the voltage. I've implemented the CTs myself in an ESP32 project but have yet to tackle the high side voltage sensing.

  • @turkialshehri9762
    @turkialshehri9762 6 місяців тому

    great video and hard work .if u add dc to dc converter as boost one to 320v dc so u can regulate pwm to control the power by measuring the output power that deliveried to grid .the dc to dc input can vary as solar or wind input change so pwm can comensatet that to what the adjusted max power.
    u can buy one for example input rate 12v, to 35v after that thake the important components like ferrite trans and mosfet but before check its frequency then reprogram arduino to deliver the sam freq to guarantee the core not saturate.by adding some probe current and volte of output u can produce your pwm duty cycle .

  • @Asdayasman
    @Asdayasman 6 місяців тому +3

    It would be nice to see the arduino replaced with discrete circuitry instead. You don't need to generate your own sine wave when the grid is providing one to you - I _believe_ a phase-locked loop is the correct tool for this job.

    • @AKIOTV
      @AKIOTV  6 місяців тому +3

      You could make it fully analog, but that eliminates a lot of flexibility in the design. Pretty much all grid-tie inverters on the market also use microcontrollers to do the job. The PLL can be implemented in the firmware of the controller. In fact, the method I use could be seen as a basic variant of PLL.
      I do like the idea though, there's a certain elegance to a fully analog design so I might just try it in the future.

    • @Asdayasman
      @Asdayasman 6 місяців тому +1

      @@AKIOTV It's the elegance you mentioned that gets me. I'm a programmer by trade, so seeing something solved in code almost always leaves a "so what?" Impression in my mind, but a circuit crafted to achieve the same job is mondo cool. One might even describe it as "rad".

  • @turkialshehri9762
    @turkialshehri9762 4 місяці тому

    great work bro.could u please share the output sinewave snap ,how is it clean !

  • @MiniLuv-1984
    @MiniLuv-1984 6 місяців тому +1

    Nice work, good design and great future improvements.
    I wonder if a toroidal transformer would improve efficiency? You can get sensors that plug into the main switchboard that measure these things - I guess the time they take to detect and report power, direction, voltage is pretty important?

    • @AKIOTV
      @AKIOTV  6 місяців тому +1

      A toroidal transformer may help. Not entirely sure, perhaps I'll give it a go. The most ideal solution for mains voltage/current monitoring would be a similar device to the cheap power meter I use now, except one that has some interface to connect to the arduino.

    • @MiniLuv-1984
      @MiniLuv-1984 6 місяців тому

      @@AKIOTV Yes, thought and inquired about this a lot - I want to measure power and direction so I can control both charging and the a grid tie inverter to minimise the power drawn frin or sent to the grid. I've been told I need a quadrature detector.I'll see what I can find on aliexpress. I'll post back when I find something suitable.

  • @sultanast
    @sultanast 2 місяці тому

    Hi AKIO TV. Thanks a lot for this detailed educational video. Just a question: How to run grid tie microinverter off grid? Can another battery powered inverter be used as grid source? As microinverter has slightly higher voltage output, should I use transformer. Or it may cause power go out of phase? Thanks.

    • @AKIOTV
      @AKIOTV  2 місяці тому

      @@sultanast You could try to synchronize it to a battery powered inverter, but I have never tried it. Not sure it works for every combination of inverters. The best way would be to have an inverter that can operate in both isolated and grid tied mode.

  • @SuvamSeth
    @SuvamSeth 3 місяці тому

    Hey can you give me some insights on how to create a feedback mech on controlling the phase angle between the inverter voltage and grid voltage to adjust active power output
    (Btw great video!!)

  • @mumbaiverve2307
    @mumbaiverve2307 2 місяці тому

    Nicely thought out implementation. A few queries though :
    A)I am curious though, an inverter is supposed to deliver power off grid usually. So how would it help if it shut itself off when the grid is down ?
    B) Wouldn't it be better to put the filter on the output side , since it would reduce the inductor size due to less current ? Also most inverters seem to have only a capacitor to do the filtering.
    C) Please make a follow up video, explaining the code ?
    Cheers !!

    • @AKIOTV
      @AKIOTV  2 місяці тому +1

      @@mumbaiverve2307 A) Have you finished the video yet? Edit: I misunderstood the question, the reason it needs to turn off is to prevent back-feeding into a dead grid segment. You don't want to zap the lineman who's going to repair the power line. You could have an inverter that continues to operate when the grid goes offline, but then you need to disconnect your house from the grid first.
      B) the filter is before the transformer because you don't want to send high frequency pwm pulses into an iron core transformer. I'm also not aware of an inductor-less filter design for this application.
      C) I'm working on an updated version of the inverter.

    • @mumbaiverve2307
      @mumbaiverve2307 2 місяці тому

      @@AKIOTV B) There is an inverter IC called the EG8010. You may have seen it around. As per the appnote for this the capacitive filtering is on the secondary. Some do wind the input side wire of the transformer a couple of times around a ferrite, to give a few uH of inductance. But its not mentioned on the datasheet.I did build a 500VA inverter using this chip, but it was a bit flaky. It does not have a reset pin so startups are sometimes erratic and blows up the H bridge FETs.
      C) Would love to see more. I was planning to get make a version using the STM32F103 and your insights would be super useful.
      Cheers !

  • @daliasprints9798
    @daliasprints9798 6 місяців тому

    Have you given any thought to isolating the grid side with a relay/breaker to let the inverter run unsynchronized on outage with the ability to continue monitoring the grid side, resynchronize to its phase when it's restored, and re-couple only once phases are in sync?

    • @AKIOTV
      @AKIOTV  6 місяців тому +2

      This is possible, and in some cases it's done, but I don't intend to use this as a backup power system. I have another non grid-tie inverter (which is significantly more powerful) that can power my stuff during an outage.

  • @cyril2586
    @cyril2586 2 дні тому

    Hello, where can we see source code? And schematic?

    • @AKIOTV
      @AKIOTV  2 дні тому

      @@cyril2586 as mentioned there is a link in the description.

    • @cyril2586
      @cyril2586 День тому

      @AKIOTV ok, thinks

  • @turkialshehri9762
    @turkialshehri9762 4 місяці тому

    Thanks alot for this efforts .I built the same project and thanks again what i add to your code a stabd by mode to work autumatically also i modifyet to mert 60Hz and soft start as well as another two output that stay high to drive my H bridge can handle much more power .Actually ChatGpt help alots.
    What is confusing for me how can real inverter injuct power to the grid because what i know the voltage must be higher than grid to injuct power to so could help the technique to do that .I am planing to add current hall sensor to output then i can change A4 instead of potentiometer also to shout down for over current but i am not sure what the best technique to be real one .

  • @fablearchitect7645
    @fablearchitect7645 3 місяці тому +1

    Wouldn’t it make more sense to manipulate the inverter power angle as opposed to voltage to control the output power? My understanding is that in an AC transmission system, power angle determines active power while voltage determines reactive power. This is known as scalar control. However for a grid tied inverter I recommend field oriented control because it is easier to tune and has better dynamics. For a single phase inverter i highly recommend using a PR controller over PI because PR tracks sinusoidal set points with less steady state error. You can use PI in what is known as the DQ synchronous rotating frame (SRF) frame but this is more complex as it involves using the Clarke and park transform.

    • @AKIOTV
      @AKIOTV  3 місяці тому +1

      A regular grid tie inverter, regardless of its control system (simple "V/I" or FOC etc.) attempts to be a source with a power factor of 1, aka 0 degree lag/lead in current. Output power is controlled by small changes in amplitude. Larger, more advanced GTIs (the kind in a large solar farm or wind turbine) are usually able to change the phase between their voltage/current, so they can indeed supply or absorb reactive power to assist improving power factor on the grid.

    • @fablearchitect7645
      @fablearchitect7645 3 місяці тому +1

      @@AKIOTV when I mean power angle I mean the phase angle between the grid and inverter voltage, not power factor angle which is the angle between inverter voltage and current. Power angle is also referred to as torque angle or load angle and has symbol δ as opposed to θ for pf. In an inductive line; P=(VS*VR)*sin(δ)/X and Q=(VS*VR*cos(δ)-VR^2)/X where VS is the inverter sending voltage, VR is the receiving grid voltage and X is the line reactance. Thus scalar control uses V/δ not V/I. I am surprised that increasing your inverter voltage increases the power. I suspect this is because your reference is on the on the input as opposed to the mains side of the transformer which causes a small vector angle between the 2 voltages due to the transformers leakage inductance.

    • @AKIOTV
      @AKIOTV  3 місяці тому +1

      @@fablearchitect7645 In a synchronous generator, the more power (torque) the prime mover (steam turbine, diesel engine, whatever) produces, the higher the load angle, and the greater the generator's output current.
      Increasing the output voltage of an inverter has the same effect. If your inverter is a sine wave source that is perfectly in phase with the grid, and has a slightly larger amplitude, then you push current back against the grid voltage, much like a synchronous generator with a positive load angle. (or negative depending on convention I guess.)
      And since the amplitude of the inverter is proportional to pwm duty cycle, simply increasing the duty cycle increases the current/power.
      You could have a control system that simulates a synchronous machine mathematically, including load angle etc, but in the end when that gets translated to the hardware of the inverter, an increase in power would still end up being achieved by increasing the duty cycle.

    • @fablearchitect7645
      @fablearchitect7645 3 місяці тому

      @@AKIOTV The equivalent circuit of a synchronous generator is a voltage source which represents the field excitation with series inductance of the stator winding. An inverter has the same equivalent circuit except the voltage source is the PWM and inductor is the filter.
      Therefore as described by the equations in my previous comment, increasing the inverter voltage magnitude while in phase with the grid will just increase the reactive power generated with no active power. If you simulate the equivalent circuit in spice or any other software or google "power line phasor diagram" you will get this result.
      Active power will only begin to flow if you vary the inverter voltage phase angle. In a generator this is done automatically by the prime mover where the field exited rotor angle leads the stators rotating magnetic field. In an inverter however, the power angle of the SPWM not amplitude must be varied to transfer power.
      Hence, why I am skeptical that increasing the duty cycle and thus voltage will increase the active power.

    • @AKIOTV
      @AKIOTV  3 місяці тому +1

      @@fablearchitect7645 Interesting. In my mind, I have been looking at the inverter as a whole (including filter) as a sine-wave source. (or at least close enough to one). After running a quick simulation, I can see how that view may go wrong; it doesn't include the effect of the grid connection on the filter. Perhaps it is indeed better to see the filter as a separate thing and the H-bridge as the voltage source.
      But although I think the filter inductor could have the effect you describe, I'm not entirely sure it is entirely analogous to the inductance in a synchronous generator equivalent circuit. Why? Because the filter inductance is sort of an arbitrary choice of the inverter designer mainly based on PWM carrier frequency. If you have a particularly small inductance here, that makes the inverter behave more in the way I described before.
      I'll link to a simulation that shows what I'm talking about. The grid is on the left side, the inverter on the right side. The phase and voltage of the inverter can be controlled using the sliders on the right side of the screen. You can adjust those to see the effect it has. There are two cases: one with the filter specs I used (100uH/35uF) and one with a tiny filter (10uH/3.5uF).
      falstad.com/circuit/circuitjs.html?ctz=CQAgjCAMB0l3BWEB2aA2MBOZAOBaFkAmbSQkAZgiQBYKQEBTAWjDACgA3cGmnvsLxA0cUcA0jhJ0qNATsA7v2GiiRPiPDsATiDUbVOUZumwO3XqMEbNJ8QklgZp+QHNl1j2mfsakesyaaHw4jkSi0gD6wZGQkX6YmJFEcTA0kazJsZEU7AA2ekYqlGjGEbLwkInVNbWJFURgKThguDTBmP4tSJDsAMaFZYPKppUUSMyY0MiYCDgU7cj+gv5oFZAcuhSlxZbFoxxK4VZCe569R0We10IXwxTbyg9rd8eUj3vPUDolqn7CmnUzjM-WGQPuj1GYwmUxmCBoKUweAQajQmHWHAKb3B2z+wMqVTqRPqzBg8CI8KwOFwpScVTR33cni+zJRYl6Fk0Xz24McEik7Nk8l0+j0-2x-wOimU4NF4PMT0enl59kcziFvn8IECqnwIFClBSYhS0XScQSSScsWgYAytqIyTiuT8AWaIGC2oNTXKcRiyHihMiCGttsytrA0ApmtdkF1a2YBooRskJr9AcSQZDdsitrJuCa8goonoADEIJIrERtRAALIAQwAHgAdADOADUAPZ5AAuddcjHYRcoIDLwm1FEkE+rIAACgALOstxitgDyADM10vu4OrMgR+X9eAq6wQPXm+2u73+zvwHvR3xmFOpyf54vly315vGNugA
      What can be seen, is that indeed with the filter size I use, you may be right. Again, I'm not sure your comment applies to GTI's in general, because it doesn't seem to work this way for any filter size. The case with the small filter does not show the same behavior. Still, I think it's worth a shot to reprogram the pot to adjust phase rather than voltage, and see what happens. Would be cool if I could get much more power this way.
      I also have a potential explanation for why it does produce power when increasing the voltage. It's possible that there is actually already a small (unintentional) phase shift of the output, due to a software processing delay etc. It's fairly well synced, but a 1 degree offset wouldn't surprise me given the processing speed of the arduino and my generally poor code. This would then cause active power to be supplied. Then when you increase the duty cycle, it would increase both the real and reactive power. (you can try this for yourself in the simulation, start with a small phase shift, then start increasing the voltage.)
      I think I'm going to put this to the test, to be continued.