Watts-on's DIY GTIL Controller

watts-on

Member
Joined
May 27, 2017
Messages
198
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
 
Impressive! :D

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

Thanks for sharing!
 
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?
 
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
 
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.
 
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!
 
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.
 
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!
 
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.
 
@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?
 
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?
 
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
 
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: 328
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: 206
Hello @watts-on ,

i was reading your posts and decided to rebuild your solution. I heard about the poti-solution but i guess they die because the poti cant handle the full power when on low resistance.

Could you share some ideas about your sample-rate, contro-loop timing etc.? I tried to generate the power information with a PZEM 004T because it measures the power really accuarte. But what i see now it measures it quite slow. (1Hz). So i dont get my ctrl-loop stable, the GTIL ramps up, overshoots, and then lowers to much etc etc etc :unsure:

Im also trying to use some of current sensors like allegro ACS758 or ACS721 but the ESP8266 might not have a powerfull enough ADC and the available ampere ranges are quite big. Im also handling with a ADC1115 (I2C-ADC) but this also only reaches 860 SPS maximum...

ESP8266 shall be my core µC due to Wifi & MQTT connection for my house power information, connection into Openhab etc.

Thanks!

Kind regards

Carsten
 
Could you share some ideas about your sample-rate, contro-loop timing etc.?...
I've attached the code that I used in the setup shown in the first post. Please bear in mind that it is really just test code and there are probably many errors and/or commissions and random debugging stuff in there, but hopefully should help you see how it works.
 

Attachments

  • DIY_GTIL_Controller_D.zip
    28.5 KB · Views: 185
Hello @watts-on ,

I am just starting to duplicate your solution. I have completed setting up the monitoring system using PZEM-004T & opencircuit ATM90E32, so I can generate the PWM signal. But I have no idea how the external limiter works. According to your post, it should be a simple PWM signal but i am already stuck at identifying the connection...

Could you help me on the connection to the external limiter plug/input? I saw there are two pins inside the plug/input.
Initially i tot one pin is the PWM input and one pin is ground. But after trying to trace the connection with a multimeter, it seems like its not as simple as that.

1633017480227.png
According to your schematic (image above), I think you are using a pull-up configuration (PWM is HIGH when CTRL_PWM is LOW?). But I am wondering about the grounding. I dont see the external controller and the inverter are having a common ground. Will this causes issue? Or my understanding is wrong?

Btw, can anyone please tell the name of the plug? So I can get one instead of sacrificing my CT that comes with the unit... 😐
 
I am just starting to duplicate your solution. I have completed setting up the monitoring system using PZEM-004T & opencircuit ATM90E32, so I can generate the PWM signal. But I have no idea how the external limiter works. According to your post, it should be a simple PWM signal but i am already stuck at identifying the connection...

I should not have used the word PWM on my circuit, as that implies something different, but I drew up that circuit before figuring out how the signal works. I should perhaps have called it Ramp Up/Ramp Down, where one state causes the inverter to ramp up its power output, and the other state ramps down. This is why you must monitor the actual power output continuously in order to determine what state to set the signal at any given moment.

Could you help me on the connection to the external limiter plug/input? I saw there are two pins inside the plug/input.
Initially i tot one pin is the PWM input and one pin is ground. But after trying to trace the connection with a multimeter, it seems like its not as simple as that.
View attachment 26146
According to your schematic (image above), I think you are using a pull-up configuration (PWM is HIGH when CTRL_PWM is LOW?). But I am wondering about the grounding. I dont see the external controller and the inverter are having a common ground. Will this causes issue? Or my understanding is wrong?

The external limiter connections just go to an opto-coupler inside the inverter, so there is no common ground, by design. And that is a good thing since the control circuit is then totally isolated from anything inside the inverter. So your signal only needs to be capable of driving an LED (which is inside the inverters opto-coupler). The 470R resistor is just for current limiting as you would need driving any LED.

Btw, can anyone please tell the name of the plug? So I can get one instead of sacrificing my CT that comes with the unit... 😐
If you use the term "aviation connector" in your search, that is the magic word that should find plenty of them.
 
Back
Top