Watts-on's DIY GTIL Controller

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

luckyerik

New member
Joined
Sep 30, 2021
Messages
9
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.
Maybe a square wave signal. But I think I get what you mean. If the limiter signal is high, increase power and if it's low, decrease power.

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.
Thanks for your explanation. So the two pins actually connected to the inputs of optocoupler and the "polarity" of the 2 pins inside doesn't matter? isn't that will reverse bias the led?

Usually, I just connect gpio to one pin and ground to another pin of the optocoupler, with a current limiting resistor.

If you use the term "aviation connector" in your search, that is the magic word that should find plenty of them.
Thank you!
 
Last edited:

watts-on

Member
Joined
May 27, 2017
Messages
188
...and the "polarity" of the 2 pins inside doesn't matter?
It does matter about the polarity, although nothing bad will happen if you connect it in reverse, it just won't work.
 

Attachments

  • Limiter_Conn.JPG
    Limiter_Conn.JPG
    60.1 KB · Views: 27

luckyerik

New member
Joined
Sep 30, 2021
Messages
9
Thanks for all the help and info! I got it working.

The power (measured using circuitsetup ATM90E32) did fluctuate a bit +/- 15W (100ms interval). The power reading shown on the interver display stays pretty constant though, probably due to its slow sampling rate.
The power reading shown on the inverter display is also slightly off the setpoint but it should be due to sensor accuracy (inverter or ATM90). Desired power = 250W and inverter shows ~260W. ATM90 measured around 235~265W, keeps fluctuate. Makes sense coz the signal keeps changing up and down.
Maybe can change something like the interval. Currently using the same interval as watts-on, which is 100ms. Or halt the frequency of the "PWM" for few cycles before changing it.



Below is my "findings". Can ignore you are not interested or dont want to see my bad english 😅




I dont have the aviation plug yet, so I use a crocodile clip thingy for connection (image below).
1633092989591.png


Since i dont know the polarity of the optocoupler, I use multimeter "continuity test" to find it. From 'red' to 'black', it shows ~0.7 and from 'black' to 'red', it shows ~1.5. So I assume it means voltage drop and 0.7 shows reasonable to assume thats when the LED is forward biased (which is wrong 😅 wasted some time on checking whether i shorted the optocoupler).

I am using ESP32, which its gpio pins are 3.3V only. So, I reduce the 470ohms to 150ohms. I follow watts-on connection, 3.3V to 150ohms to 'red', then 'black' to a GPIO pin. No response, inverter shows 0W. I tried connect the black to 3.3V, no response too.
Thinking maybe wrong polarity for the optocoupler, swap the black and red connection, still nothing.

So I tried with an arduino that has 5V GPIOs. still nothing. Initially i tot i shorted the optocoupler...

Then, i tried a different connection that I previously used in my gate-drive circuit for DC-DC converter.
And it works! and I did get the polarity wrong. It is actually from 'black' to 'red'.
Below is my final connection:
1633093659892.png

Works with both 3.3V and 5V GPIO, with the same 470ohms resistor.

Also, a simple test to check whether the limiter works. Connect GPIO to 5V or 3.3V, inverter should ramps up. Connect GPIO to gnd, the inverter should ramp down. I did set the max output power to 500W so it wont burn the inverter. I read the forum and saw someone reporting this.

Interestingly, watts-on 's connection doesnt work for me. no idea why.


My next step is trying to reduce the power fluctuation around the setpoint. Not sure whether is it feasible or it is just a normal behaviour.

Again, thanks for all your helps!
 

watts-on

Member
Joined
May 27, 2017
Messages
188
Glad you got it working. Well Done!

It may be worth testing the inverter with a purely resistive load (incandescent lamps / fanless heater etc)
If you have access to an oscilloscope, you should see your GPIO pin generating a stable and mostly unchanging mark-space waveform.
Maybe send the 100ms sampled values from the circuitsetup out on the serial port and use the arduino's "Serial Plotter" view to see if they look stable.

Do you have one of those plug in energy monitor things?
similar to this:
Monitor.png


That may help narrow down the source of your power discrepancy.

Your signal is inverted compared to mine as I am sinking the LED current through my GPIO pin whereas you are sourcing from your GPIO pin.
 

luckyerik

New member
Joined
Sep 30, 2021
Messages
9
Glad you got it working. Well Done!

It may be worth testing the inverter with a purely resistive load (incandescent lamps / fanless heater etc)
If you have access to an oscilloscope, you should see your GPIO pin generating a stable and mostly unchanging mark-space waveform.
Maybe send the 100ms sampled values from the circuitsetup out on the serial port and use the arduino's "Serial Plotter" view to see if they look stable.

Do you have one of those plug in energy monitor things?
similar to this:
View attachment 26158

That may help narrow down the source of your power discrepancy.

Your signal is inverted compared to mine as I am sinking the LED current through my GPIO pin whereas you are sourcing from your GPIO pin.
I just println the output from circuitsetup to serial monitor. Will try the serial plotter method.

I didnt have the plug in energy monitor but I do have access to a programmable ac load so I think I can calibrate using that.
Actually, I havent calibrate my circuitsetup...

Does your inverter has huge difference between actual and the value shown on the display? I know each unit will be different but I should be expecting similar outcomes.
 

watts-on

Member
Joined
May 27, 2017
Messages
188
Does your inverter has huge difference between actual and the value shown on the display? I know each unit will be different but I should be expecting similar outcomes.
I was pretty pleased with the accuracy and stability of my setup. If you look at the pic in the top post, you can see the inverter, plugin monitor and my text display all agree within a couple of watts of 207W.
Having said that, it didn't "just work". I did have to spent quite some time calibrating everything beforehand.
 

Klommer

Member
Joined
Nov 16, 2017
Messages
33
Hello @watts-on, hello @luckyerik,

first of all thx for sharing your code. Meanwile i got the solution working without direct measuring the power of the GTIL. Also because the PZEM i wanted to run on software-serial what my Power-Toggling-Signal disturbed.

Basically what i do now:
I get input of my household demand that will be positive or negative (or best case 0 :D) . I take the demand and and generate a certain ammount of ticks into the direction that i need.

Example:
House pulls 200W from grid. GTIL-Power-Toggling for 200W x 2ms/W into increase direction. After that i wait for 750ms onto new values that i receive from my house measure point. I achieve arround +-20W delta to the values. Sometimes it also stable but to be honest, how accurate is my house energy meter? It can run up to 63A on the phases, so 20W/(63A*230V*3) is really really small ammount. So i can say i close my control loop over a bigger way. The dynamical behaviour onto power jumps aint as good as your solution im really sure.

I also see that the power toggling singal isnt working on the GTIL if the fans spinns up. Maybe my connection cables generates some EMC or i need to increase the current a bit. Have you seen this as well? Sometimes they spin also under low load, like 200-300W. I didnt expect something to be warm there.
 

watts-on

Member
Joined
May 27, 2017
Messages
188
That's an interesting alternate method you are using there. I think though, it will only work if you have only one inverter?
Regarding the fans, I haven't stressed my setup yet, to the point where the fans kick in, but I would not expect that to effect anything.
 

luckyerik

New member
Joined
Sep 30, 2021
Messages
9
Example:
House pulls 200W from grid. GTIL-Power-Toggling for 200W x 2ms/W into increase direction. After that i wait for 750ms onto new values that i receive from my house measure point.
May I know what does the 2ms/W means? every 2ms of "HIGH" signal will increase the inverter's output power by 1W?

If its true, so if we can make a PWM with period of 4ms with 50% duty cycle, does that means we can achieve a pretty stable (small delta) power control? ("theoretically")
 

Klommer

Member
Joined
Nov 16, 2017
Messages
33
@luckyerik
What i mean is that i need to keep up for each watt 2ms. So in 200W demand i let the Power-Toggle-Signal for 400ms up and return then back to "true" PWM mode with 50% Duty (on/off same time). I did not get with a fast "stable power toggle" at 10ms a stable situation. I guess that might be caused by the way the inverter reads the signal and also because of code runtime in the µC. With quick peridos a small jitter on the signal generates bigger faults. Using a hardware PWM-Module would be better, but then you are limited to the maximum timer period.

Further investigations about what a ms-high-level means to the GTIL would be helpfull. But it must be something like 1msHigh = 1W. I would expect a linear gain with constant factors. But i dont have equipment to measure this.

@watts-on
Mhh i guess it would work with more inverters if i run them in a cascade setup where the second inverter fires only up if the first is on 100% power.
Lets say 2500W is needed, so the first will stay on 1600W and the second will be used to regulate the difference to meet the 0W on the grid connection point.
Running them parallel 1250W each might be unstable.

As a conclusion Watts-Ons solution is more stable with better dynamic behaviour and lower error. My aproach does not need the more complex hardware. If you want to make more boards of your solution i might would buy one if possible :D
 

luckyerik

New member
Joined
Sep 30, 2021
Messages
9
An update: Previously, I mentioned using 470ohms with 3.3V. However, it doesnt work after I changed to the proper aviation plug and a longer cable. Reduced it to 150ohms and works again.

@Klommer
I tried your control method. I set the signal to be HIGH for 3s (will ramp up to around 200~300W), then output a PWM with 50% duty cycle. However, it doesnt work.
When it is outputting 50% PWM, the inverter will randomly ramp up or down. Ultimately, it will just settle at around 70W. I tried different frequency for the PWM, doesn't work.

I also tried to investigate the W/ms relationship. Its not constant or the relationship changes every time. Like this time I set HIGH for 3s, it will be 250W, the next time it will be 300W. Its roughly 100W/s. If accuracy is not a concern, then it is probably usable.

@watts-on
May I know your inverter's output power delta around the setpoint?
From your first post, you mentioned you are checking the power every ~100ms.

I tried mine but there are some spikes. Also, I realized the interval affects the power delta.

Below are some graphs. FYI, my setpoint is 250W.

With 200ms, there are many spikes. which I would consider unstable.
200ms.png


Below are the graphs for 3 different intervals
1. 100ms
2. 25ms
3. Dont check interval. Just compare at each iteration in loop()
1633669567355.png

With 100ms, no more 200W spikes. Power delta is around +/-5W.
With 25ms, the power delta to reduced to around +/-3W with occasional spikes to +/- 5W.
With no loop, the power delta is smaller +/-2W with some spikes +/-4W.

It seems like the smaller the interval, the smaller the power delta is.

I don't own an external limiter so I cant verify how accurate it can be. But i think the external limiter is just using an analog comparator to generate the pulse signal. With analog, there is no "interval" so I believe it would be pretty quick.

Interestingly, the period of the pulse signal is relatively high at ~200ms, with the shortest HIGH period to be 90ms observed on my oscilloscope. However, it seems like it is more concern on when the signal is switching. The faster it can check, the faster it can switch. So it can has smaller power delta.


I also tried at 500W. The power delta did increase. But the relationship (higher interval lower power delta) still holds true. Its mostly within the +/-10W range. So i think its acceptable. Just not sure whether this is the limit of the inverter or I can actually improve it.
1633669863549.png
 
Last edited:

luckyerik

New member
Joined
Sep 30, 2021
Messages
9
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.
My unit (2kW) starts unstable when the setpoint is below 80W. It keeps fluctuate between 72W and 0W (as shown on the inverter display)
 

watts-on

Member
Joined
May 27, 2017
Messages
188
If you want to make more boards of your solution i might would buy one if possible :D

I've now created a rev 2 board, so I have 4 rev 1 boards (the one on the left, and what I used in the top post) up for grabs if anyone wants any for the cost of postage.

IMG_1923.JPG


The schematic I showed before is actually for the rev 2 board.

I've attached the rev 1 schematic below.

It is essentially the same except you would need to figure out how to bodge on the ZMPT101B voltage sensing module (or some other equivalent), and I simplified some of the comms stuff as I could not make up my mind before, what comms interface I wanted to use.


May I know your inverter's output power delta around the setpoint?
From your first post, you mentioned you are checking the power every ~100ms.

No, my code is checking each time arduino calls the loop() function. I don't know what timing that is but it will be way faster than 100mS.
That said, I'm sure it would work fine if I limited the checking interval to 100mS.

I can't remember how much fluctuation there was around the set point during my testing, but due to the way the limiter signal works, it is impossible to eliminate it.
There has to be some deviation in order to know which way to set the control signal. The inverter is always either ramping up or down, never static, so the sooner you can detect the deviation from your set point and write the control signal, the more stable it will be.
That said, we are sampling AC voltage at 50 (or 60) Hz. So sampling faster than a half wave i think will not really gain any advantage.

I don't own an external limiter so I cant verify how accurate it can be. But i think the external limiter is just using an analog comparator to generate the pulse signal. With analog, there is no "interval" so I believe it would be pretty quick.

I don't think that's right. It looks to me like it works pretty much the same as my design, using a current transformer and presumably voltage sensing too.
There's two ADE7755 chips (dedicate energy monitoring ic's) and a STM8S207 microprocessor:

IMG_1922.JPG

My unit (2kW) starts unstable when the setpoint is below 80W. It keeps fluctuate between 72W and 0W (as shown on the inverter display)

It's hard to remember exactly, but mine was unstable to the point of being unusable below 40W. Above that and it stated to settle down.
 

Attachments

  • GITL_Limiter_Controller_E.pdf
    89.7 KB · Views: 22

luckyerik

New member
Joined
Sep 30, 2021
Messages
9
It's hard to remember exactly, but mine was unstable to the point of being unusable below 40W. Above that and it stated to settle down.
Probably just difference per unit. That said. Although my device did switching OFF and 75W for set power of <75W, it is actually quite close if you average it. For example, you average the powers for one minute.

I have another question today regarding the inverter fan and temperature behaviour. Today, I set the inverter (max power 2kW) to output 1kW continously. It runs fine but the fan behaviour is weird. It turns on for 1~2s then off, and repeats every ~1minute. The temperature shown on the display is 54~56C. Is this normal? or my fan is malfunctioning?

It actually has a scary moment. I let the inverter outputs 1kW for some times. Then, the inverter just turns off itself suddenly and I heard the AC plug got some weird sparking sound.
Initially I tot the inverter is dead, since the inverter doesnt turn on even I switch off and on again (inverter display shows black screen).
After turned off and waited for 1~ 2 minutes, the inverter is able to switch ON and works again. Outputting 1kW for probably 1hour+.

This makes me wonder is it because of the weird fan behaviour caused the inverter to overheat and shut itself down...
 

Klommer

Member
Joined
Nov 16, 2017
Messages
33
Hallo @luckyerik,

i also played arround with my settings for ctrl loop. Overall im not happy with it but it works more or less.
Right now im
ramping 1,7ms/Watt up, limited at 250ms max.
ramping 2,7ms/Watt down, limited at 200ms max.
Adjusting Outputpower if delta is >15W.

I get like this behaviour (household power changes included, this is on 300-400W measured)
20:18:53.043 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung -93.90 [W]
20:18:53.287 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung -93.90 [W]
20:18:55.010 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung 2.50 [W]
20:18:56.746 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung 25.80 [W]
20:19:00.225 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung 7.50 [W]
20:19:00.231 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung -70.50 [W]
20:19:03.942 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung -93.80 [W]
20:19:06.493 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung -59.60 [W]
20:19:06.989 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung -78.60 [W]
20:19:08.751 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung 20.80 [W]
20:19:10.226 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung 60.10 [W]
20:19:11.757 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung 20.20 [W]
20:19:14.528 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung -2.10 [W]
20:19:16.321 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung -87.50 [W]
20:19:17.237 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung -70.40 [W]
20:19:18.020 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung 29.20 [W]
20:19:19.863 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung 55.10 [W]
20:19:22.595 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung 40.30 [W]
20:19:22.795 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung 3.40 [W]
20:19:24.275 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung -23.20 [W]
20:19:25.769 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung -64.10 [W]
20:19:27.239 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung -10.30 [W]
20:19:28.721 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung 31.60 [W]
20:19:30.192 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung 45.00 [W]
20:19:31.686 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung -23.90 [W]
20:19:33.393 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung -25.70 [W]
20:19:34.642 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung -25.70 [W]
20:19:36.924 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung -40.80 [W]
20:19:37.827 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung -40.80 [W]


Sometimes its like the demand settels and get lower error:
20:21:07.385 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung 39.60 [W]
20:21:07.392 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung 38.30 [W]
20:21:07.882 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung 12.00 [W]
20:21:10.060 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung 16.70 [W]
20:21:10.804 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung 1.10 [W]
20:21:12.303 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung -7.10 [W]
20:21:13.752 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung 9.40 [W]
20:21:15.501 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung 12.50 [W]
20:21:16.458 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung 9.70 [W]
20:21:17.934 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung 19.30 [W]
20:21:19.406 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung 13.00 [W]
20:21:20.884 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung 31.10 [W]
20:21:22.367 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung 14.20 [W]
20:21:23.588 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung -28.90 [W]
20:21:25.075 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung -8.20 [W]
20:21:26.305 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung 2.70 [W]
20:21:28.917 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung -19.10 [W]
20:21:29.261 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung -19.10 [W]
20:21:30.741 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung -23.00 [W]
20:21:32.504 -> Message arrived [Haus/Anschlussleistung] Hausanschlussleistung 15.70 [W]


On my side the solution does also not react below 65W. Also its just like i need to "kick" up the inverter away from this low power ammount, so its more stable > 125W.

I would say your solution not bad at all. Unfortunally i dont have that much time to optimise it more.
 
Top