Tracking separate solar Feed In Tariff


Hello. My iotawatt arrived today. Tomorrow I hunt for a locally useful 9-12VAC VT and a 5VDC 1.2A power supply, and then pay my pet sparky to play behind the distribution board, because NZ law specifically states I can’t do that. (Sensible, really)

To my situation: When I draw current from the grid, my revenue meter spins forwards and I get charged $0.30/kWh. When my solar panels exceed my local demand, my revenue meter does not spin backwards. Rather it tracks the reverse current separately and I am paid $0.08/kWh (I.e. my FIT is appalling).

Looking over the iotawatt code on github, it seems to me that when negative values are enabled, the sample averaging code for each CT will count the positive events up (“spin the meter forwards”), but count the negative events down (“spin the meter backwards”). Which means the iotawatt will not track my feed-in correctly and be at variance with the revenue meter.

  • have I understood the code correctly? Or is it possible to set the code to accumulate positive values in one variable and accumulate negative values in another?

  • if my understanding is right, my next question is, how ‘tight’ is the sample acquiring loop? If I add a new variable and a new config value and on every iteration of each of the 14 sensors, use an if statement to add the accumulated value the ‘right’ variable, will that one ‘if’ be the straw that breaks the camel in half and drop the sampling rate to nothing exciting?

I can, and probably will, start playing in a few days, but I figured it would be more efficient to ask first. (I can’t be the first PV house without nett metering!)

Thanks in advance.


You may be overthinking this problem. It’s true that the CT on your mains will accumulate the net power, while your meter as you say will only ratchet the import. So the question is what granularity of filtered sampling the net usage will reasonably represent your import?

Most solar installations flip between import and export very infrequently. They import Most of the time and export when the sun is bright. When you send the data to a service like PVoutput, the granularity is 5 minutes. So there may be some small inaccuracy in the 5 minute intervals where there was bothimport and export. If you upload to something like Emoncms or influxDB, you can get 5 second resolution.

If you want to directly measure the import at IoTaWatt’s sub-second resolution, there is a way that I think will work. If you put two CTs on the main and configure one to “allow negative values”, then one will measure (import - export) and the other will measure (import + export). Adding these together algebraicly we get:

Import - export + import + export = 2 x import.

Now if you divide that by 2 the result is import.

In IoTaWatt terms, let’s say those 2 CTs are named netmain and absmain. The output to get import would then be;

(netmain + absmain) / 2

If you are three-phase, you would need to do this only on the main with the solar feed if you have a single phase inverter (and add the other two mains for total import). If you have a three-phase inverter, you would need to do it for all three.

EDIT: btw/ even if there were a way to get just the import from a single CT, you would not be able to compute your usage from that. You would still need a “net” mains number to determine usage.


So I’ve got my iotawatt powered and on the wifi. I will have to find a more accurate RMS meter that I am comfortable feeding 240VAC, to calibrate it closer, and arrange install with the pet sparky. Which means I am now in hurry-up-and-wait mode.

On previous days, staring at the revenue meter, when local consumption is low, I have seen it switching between import and export on a 5-10s basis. What I don’t know is how often it internally accumulates the “load” value and assigns it to the “import” and “export” registers. So I will get to guess and experiment :slight_smile:

One of my goals is to try to “match” the values reported by the revenue meter - within the limits of accuracy - but using a device I control.
The other goal is to put instrumentation on a half-dozen circuits and the solar, so I can have some sort of idea where all my kWh are going, and maybe use that to reduce the power bill :slight_smile:

I hadn’t thought of using two CTs and math outside the loop. But that should work and not require rebuilding the firmware either. It also stands to reason if import = (absmain+netmain)/2, then export = (absmain-netmain)/2 from a similar canceling of terms.

Thank you for the prompt reply. I expect I can manage from here, but if I do have any more questions, I am sure I will wander back past.


@ sitting.duc please report back when you find your solution. There are probably lots of other people interested in your journey. Best of luck from “across the ditch” in Tassie.


The “Sparky” should have a meter. If not, I have found that the Kill-a-Watt is pretty accurate and cost around $20 US. Handy device to have around anyway. You can plug your VT through it and calibrate to the voltage it shows.

The technique with two CTs will sample each channel at about 500ms in a fully loaded IoTaWatt. The values are accumulated immediately using ms weighting, so no loss of accuracy. Even with one of the so-called “solar diverters” that strive to use excess solar power to heat or charge an EV, I think the result will be very accurate.

That looks right.

Good luck with your install.


Hello again,

The sparky has been and my IotaWatt is installed. Despite having every (echun ESC1050) CT wired K towards grid and L towards load, they all flag “reversed”. Oh well, fixed in the GUI. The sparky’s voltmeter and mine are within 1-2V of each other, most of the time (but his has more decimals), and my raw “grid” value is currently within 3% of the instantaneous value displayed on the revenue meter. So with a bit more tuning I hope to get within 1%. :+1:

It is dark outside, so no solar generation right this minute. I will have to get emoncms running somewhere and see what is logged during the day.
My outputs math are: Import Watts = (Grid_1+Grid_2)/2; Export Watts = (Grid_1-Grid_2)/2; Loads = garage+RCD1+RCD2+RCD3+Aircon. Grid_2 is Allow Negative, Grid_1 is not.
As shown on the screenshot, the Export value can go negative! It is bouncing around every interval (because the two clamps don’t read the same value instantaneously), between +2W and -2W export. So some form of smoothing function is going to be needed longer term.

:+1: So I am overall happy with where I am at. I will see what is logged during daylight and I will calibrate my VT some more (volts and phase using a purely resistive load like the oven) and then with more history to build from I should be able to work out what smoothing is useful / necessary.
Depending on work, that might not be until May.

Thanks for your help so far, and I will be in touch when I have more data.


By the status display it looks as if you Resolved this somehow, but just wanted to say that the simple solution was to reverse the VT using the “reverse” checkbox in the setup menu.