Watts-on's DIY GTIL Controller

Announcement - Help us fight the BOTS! Please report all spam including stuff in your inbox!

watts-on

Member
Joined
May 27, 2017
Messages
181
With most Grid-Tie inverters, there is no way to regulate the amount of power they generate. They are designed to convert the maximum amount of power they receive at their input, into output power.

The Grid-Tie Inverter with Limiter (GTIL) units however, have the ability for the output power to be regulated.


image_vnzfgt.jpg


This is achieved via one of two methods. The analogue input using a current transformer (called internal), or the digital input, intended to be used by a separately available external control box (External Limiter)


image_jujpzc.jpg



image_lsnfoc.jpg


Unfortunately, what it doesnt have, is the ability to regulate the output under software control in real time. It does have a communication port, but as far as I can tell, there is only basic settings and statistical information available. No real-time control seems possible.

I wanted the ability to control the output myself under software control, so I set about designing my own DIY control unit.

After investigating how the digital control input works, (which I wrote about here) I created my design:

The principle is that I measure the mains voltage and current flowing through my board, and then control the digital input to the GTIL to either increase or decrease the power to reach that requested by the user.

I thought that generating the digital signal, which appeared to be some kind of weird PWM, was going to be hard. But it turns out it is way easier than I was expecting. It is nothing so grand as PWM, but simply a balance between what you want and what you are getting. To sum it up:

1. Approximately every few hundred milliseconds compare the measured power with the requested power.
2. If measure is too high, set signal high
3. Else set signal low.

So as the power hovers around the requested set point, that changing (PWM like) high/low signal is produced.

My test rig:


image_yftzxo.jpg


The following two scope traces show the control signal changing, as I request power from 100w to 200w, and vice versa. For example, on the left image at the point where I request the increase to 200w, the signal goes low and stays low, while the inverter slowly ramps up the power over several seconds. Once it reaches 200w it goes back to balancing it around that point.


image_kettcy.jpg


So although Im calling this real-time control, it is limited by the rate of change that the inverter itself achieves, plus the time for my whole house monitoring system to notice a change and update the requested power.

Also, I noticed that it isn't stable when outputting 40w or less. I also checked that with the commercial external limiter unit and it is the same, so that is a limitation of the inverter itself and not the control method.

I can't go much above 200w right now due to the limited wire gauge I used on my test battery bank, so will need to get my proper diy power wall up and running before I can test it at the full 2000W.

The image below shows the board running:


image_osifqg.jpg


The left column shows the measured data: Voltage, Current, Real Power, Apparent Power.

The right column shows the control registers I use, which I send to it over RS485 ModBus: The first 3 are calibration values required for accurate measurements (voltage, current and phase angle), and the final value is the user requested output power in watts.

Real Power shows as negative when power is flowing from the inverter to the grid.

To measure mains voltage, I am using a ZMPT101B module:


image_jdzeyw.jpg


eBay Examples

Initially I was just using the transformer, but in trying to get that part of the circuitry working, I realised I was just reinventing the wheel, so now I am using the complete module.

The current is measured be feeding the live wire through a 10A current transformer. 93 Ohms and a 1000:1 turns ratio:


image_mgexgr.jpg


From RS Components

The code is Arduino based, and Im utilising the EMonLibCM library to pull the readings from those components and give some numbers I can work with.

EmonLibCM

Ive also added an on-board relay in-line with the mains which will allow me to disconnect the mains supply when not in use to save power. I havent check yet, but I suspect it will still draw a small current from the battery in this state though.

A couple more pics:


image_delclm.jpg

image_naiinp.jpg
 

lepdiypowerwalls

New member
Joined
Nov 27, 2017
Messages
5
Impressive! :D

A vid showing how fast it ramps up/down to/from full power will be insightful.

Thanks for sharing!
 

nate

New member
Joined
Jun 27, 2021
Messages
5
With mos


View attachment 9688


So although Im calling this real-time control, it is limited by the rate of change that the inverter itself achieves, plus the time for my whole house monitoring system to notice a change and update the requested power.

Also, I noticed that it isn't stable when outputting 40w or less. I also checked that with the commercial external limiter unit and it is the same, so that is a limitation of the inverter itself and not the control method.

I can't go much above 200w right now due to the limited wire gauge I used on my test battery bank, so will need to get my proper diy power wall up and running before I can test it at the full 2000W.
SUPERB Work!!! This is exactly what i'm looking for :) Thankyou so much for your effort.

I'll be doing a slightly different version, i'll have an ESP8266 with a web page - which has 4 buttons, Min - Lower - Higher - Max
Min - hold the signal high
Max - hold the signal low
Lower/Higher - hold the signal high/low for ??? seconds, to go up/down in 50/100W increments

I'm still not 100% good at reading scopes & divisions etc... what are the requirements of the frequency?
Whats the voltage?
Whats the PWM frequency? Will a 50% duty cycle hold it steady?

*i think*...
It looks like its 2v per division on the vertical scale, so its a 5v signal is that correct?
Time.. it looks like you hold high/low for 0.45sec? when you transition up/down in power level?
Is it transitioning high/low 4 times per 0.2sec?
 

Cheap 4-life

Member
Joined
Aug 3, 2020
Messages
372
Please help me understand why the way the GTIL2 limits isn’t good enough. I’ve been limiting via the CTs and internal port for years with no complaints. The inverters match my loads in real time very accurately
 

nate

New member
Joined
Jun 27, 2021
Messages
5
Please help me understand why the way the GTIL2 limits isn’t good enough. I’ve been limiting via the CTs and internal port for years with no complaints. The inverters match my loads in real time very accurately

My application is to use my batteries - i want to drain them as much as needed, but not too much, i can feed extra in with no issue/penalty & near enough is good enough. I know my usage really well and know how much power i have/need.
The effort involved in using internal/external CT's due to distance and construction is a real PITA. I'd have to drill through multiple brick walls, into a very crowded circuit box, run conduit, render & paint walls.... its probably a solid days worth of work, would have to kill the houses power etc.

Alternatively i can just connect a small ESP8266 module, open up a web page on my phone & say give me 200W more, or voice control with my houses assistant (Alexa/echo). I'll mostly use it to provide 250W over night to cover my house usage & boost a bit during the day.
I dont need exact & i dont need timely - hence CT isnt worth the time/effort.
Hope that clarifies?

The other benefit is that i have 3 phase power, so would have to tap & add up power on 3 separate phases to output (output it all on 1 phase is OK though). I've already got 16 CT's in my box monitoring circuits with an Emporia monitor - dont need more. I can use the emporia, get the consumed info already, then modify it too - there's a 4sec delay, all possible with my ESP setup.
 

Roland W

Member
Joined
Oct 9, 2017
Messages
136
My application is to use my batteries - i want to drain them as much as needed, but not too much, i can feed extra in with no issue/penalty & near enough is good enough. I know my usage really well and know how much power i have/need.
The effort involved in using internal/external CT's due to distance and construction is a real PITA. I'd have to drill through multiple brick walls, into a very crowded circuit box, run conduit, render & paint walls.... its probably a solid days worth of work, would have to kill the houses power etc.

Alternatively i can just connect a small ESP8266 module, open up a web page on my phone & say give me 200W more, or voice control with my houses assistant (Alexa/echo). I'll mostly use it to provide 250W over night to cover my house usage & boost a bit during the day.
I dont need exact & i dont need timely - hence CT isnt worth the time/effort.
Hope that clarifies?

The other benefit is that i have 3 phase power, so would have to tap & add up power on 3 separate phases to output (output it all on 1 phase is OK though). I've already got 16 CT's in my box monitoring circuits with an Emporia monitor - dont need more. I can use the emporia, get the consumed info already, then modify it too - there's a 4sec delay, all possible with my ESP setup.
Long distance transmission is probably the main reason, why I would see this a good thing.

If someone wants to discharge small wattages, that can be set in the UI. The problem is only, that the GTIL is getting extremely inefficient when only discharging small amount of power, due to the high base consumption of 70+ Watts. So setting lets say 200W only, would actually only give you around 60% efficiency if you as well add inverting efficiency of 95% to the base consumption of 70+ W.

Good Job!
 

watts-on

Member
Joined
May 27, 2017
Messages
181
SUPERB Work!!! This is exactly what i'm looking for :) Thankyou so much for your effort.
Thanks! Your welcome. It was a lot of work but I very much enjoyed the learning process.
Whats the voltage?
There is no specific voltage. That signal is just driving an opto-coupler inside the inverter, so provided the signal from your cpu can drive an LED it should be fine.
Whats the PWM frequency? Will a 50% duty cycle hold it steady?
As I explained in the first post, it is not a PWM signal. You need to measure the output power from the inverter approximately every 100mS and compare it against your required power. You then just set the signal high or low based on that. You will then get a signal similar to the one on my scope trace.

Please help me understand why the way the GTIL2 limits isn’t good enough. I’ve been limiting via the CTs and internal port for years with no complaints. The inverters match my loads in real time very accurately
I created this design for several reasons:
  • I wanted the flexibility to decide myself how much of my battery power is used at any one time.
  • I want to sign up with an energy provider with an agile tariff, where I can buy off peak power at low or even negative cost. These rates from such a provider can change every 30 mins, so I want to automatically grab power at those times instead of loading my batteries.
  • I have more than one inverter, so can decide how best to distribute the load between them, even powering them down if required.
  • I don't have to figure out how to get multiple inverters to share a single CT clamp (although I believe it can be done).
  • It is not convenient for me to run a conventional CT clamp cable between my consumer unit and where I will be locating the inverters.
  • But mainly, it was fun figuring out how to do it and come up with a solution :)

The problem is only, that the GTIL is getting extremely inefficient when only discharging small amount of power, due to the high base consumption of 70+ Watts.
Yes, I added the relay for exactly that reason, to take it out of circuit when the load is too low to be useful of efficient.
 

nate

New member
Joined
Jun 27, 2021
Messages
5
Thanks! Your welcome. It was a lot of work but I very much enjoyed the learning process.

There is no specific voltage. That signal is just driving an opto-coupler inside the inverter, so provided the signal from your cpu can drive an LED it should be fine.

As I explained in the first post, it is not a PWM signal. You need to measure the output power from the inverter approximately every 100mS and compare it against your required power. You then just set the signal high or low based on that. You will then get a signal similar to the one on my scope trace.

Yes, I added the relay for exactly that reason, to take it out of circuit when the load is too low to be useful of efficient.

Gotcha - i'm trying to emulate the original unit signal as much as possible, voltage, frequency etc... Trying to avoid anything that may be hidden in software or cause unexpected grief down the track.

Voltage - even opto's have voltage ranges?, what was the voltage you measured? I dont want to throw 5v & fry a 3v circuit, or use 3v & have intermittent issues if it isnt driving the LED hard enough.

PWM - bad choice of words, I'm trying to emulate the signal the original box was putting out when it was in a steady state. Given my 4sec delay between monitoring & output, it'll continually overshoot/undershoot. There'd also be something in software i'm guessing around this signal - so want to avoid an unexpected issue there.
Measure every 100ms, so 10x a second = perfect!

My unit arrives in a week, i'll report back once setup with code & details on my setup.
Again - huge thanks Watts-on!
 

watts-on

Member
Joined
May 27, 2017
Messages
181
what was the voltage you measured?
I don't know what the original voltage was because as I explained at the end of this post, that signal is directly connect to mains voltage inside the external limiter unit and I wasn't going anywhere near it with my test gear. :eek:
But in any case, LEDs are really current devices. They don't care much about voltage provided you reach the minimum forward voltage requirement. If you are concerned, you could add a transistor to drive it.
On my design I have a 470R (which I probably just guessed would be a good value) resistor pulled up to+5v going to the anode, and the cathode sinks directly through a GPIO pin on my Atmega328 processor.
 

Wleinert

New member
Joined
Sep 11, 2021
Messages
6
@watts-on A few month ago I built a limiter solution for a SUN1000-GTIL2 based on a digital potentiometer and raspberry pi which worked until the dPot died a few days ago. Now I am looking for a more stable solution. What is your solution and is it working as expected and how long?
 

watts-on

Member
Joined
May 27, 2017
Messages
181
The board has not yet been put into service, as I am still designing my battery packs, so I don't know about reliability etc yet.
It did work as expected in my lab though. What else did you want to know?
 

Wleinert

New member
Joined
Sep 11, 2021
Messages
6
The board has not yet been put into service, as I am still designing my battery packs, so I don't know about reliability etc yet.
It did work as expected in my lab though. What else did you want to know?
Thank you for your quick answer. Is it necessary to measure/control (voltage, current, power) many times per second if the ajustment of the output power takes seconds for example as I see when ajusting by potentiometer? Do you have a circuit diagram of your solution for me?
Regards
 

watts-on

Member
Joined
May 27, 2017
Messages
181
Is it necessary to measure/control (voltage, current, power) many times per second if the ajustment of the output power takes seconds for example as I see when ajusting by potentiometer?

Well, I don't know about the potentiometer method, but when using the external limiter input on the inverter, yes, it is necessary to measure the output from the inverter.

You could do it with only a current transformer as the sensor and control only the output current, but fluctuations in line voltage would cause inaccuracies, so I chose to also add voltage sensing as well, so I can specify the output by wattage, since that is how all my whole house monitoring does its measurements .

It may be possible the reduce the sample rate, but I don't know by how much, and I think it would become more unstable as the rate is reduced.

Think of it like having a toggle switch to control it. Switch one way to increase, the other way to decrease, with no centre off position. So you must constantly switch it back and forth to get the desired output. But you need to measure the output to know which way to switch to reach the required level.

Do you have a circuit diagram of your solution for me?

Sure, see attached pdf.

I intend to publish all the file on github, at some point, but am reluctant to do it until I have used it in service for a while as I wouldn't want anyone spending their hard earned cash on producing one if there turned out to be a problem with it.
 

Attachments

  • GTIL_DIY_Limiter_Controller_MK2_B.pdf
    87 KB · Views: 9

Wleinert

New member
Joined
Sep 11, 2021
Messages
6
Well, I don't know about the potentiometer method, but when using the external limiter input on the inverter, yes, it is necessary to measure the output from the inverter.

You could do it with only a current transformer as the sensor and control only the output current, but fluctuations in line voltage would cause inaccuracies, so I chose to also add voltage sensing as well, so I can specify the output by wattage, since that is how all my whole house monitoring does its measurements .

It may be possible the reduce the sample rate, but I don't know by how much, and I think it would become more unstable as the rate is reduced.

Think of it like having a toggle switch to control it. Switch one way to increase, the other way to decrease, with no centre off position. So you must constantly switch it back and forth to get the desired output. But you need to measure the output to know which way to switch to reach the required level.
I'm measuring the output by a smart plug connected to my DSL router (AVM, Germany) and querying the wattage from the router by a web api every 10 secs currently. But your solution is much faster as implemented mostly in hardware.
The potentiometer method is using the rightmost (unused) white 2-pin connector and connecting an 10k potentiometer or a dPot to control output power (normally the internal limiter is connected to the yellow connector). The dPot version worked for month as I said but now the dPot seems damaged and I have to look for the reason (may be max. current).
Sure, see attached pdf.

I intend to publish all the file on github, at some point, but am reluctant to do it until I have used it in service for a while as I wouldn't want anyone spending their hard earned cash on producing one if there turned out to be a problem with it.
Thank you. I will have a look at it ; currently I'm using only to raspberry pi for my smart meter and power control. I guess it should easily be possible to move from aduino to raspberry pi?
 

Attachments

  • 20210414_170916.jpg
    20210414_170916.jpg
    2.4 MB · Views: 7
Top