EmonGLCD 3-phase: Power Now only showing CT1

Hi there,

I managed to built my emonglcd yesterday, tested it successfully and even managed to get the Home Energy Monitoring sketch to run.

First problem was the time zone issue, which I managed to sort out with the help of the forum.

Now my problem is the following:

I have a domestic 3 phase system here (South Africa). It seems the sketch is only fetching the POWER NOW value of CT1.

I would require to display the total watts as sum of CT1, CT2 and CT3 on the emonGLCD but I don't have a clue how to get started and where to find the correct place to implement this. 

The second thing I realized is that the backlight is constantly on during day time. Is that normal?

And the third but obviously not the last question; even though I tested the buttons successfully they don't do anything with this example sketch. Is that supposed to be like that?

Is there any place I can learn how to customize the data displayed on the emonglcd and use its full potential. I have CT4 connected to my Geyser, which I would like to be displayed on another page using the up/down buttons on the emonGLCD. Possible?

Thanks a lot for your time spent to answer this kind of nooby questions.........

 

Cheers,

Antonius

Robert Wall's picture

Re: EmonGLCD 3-phase: Power Now only showing CT1

I think you need to look at the sketches that you have running - both in your emonTx and your GLCD, take a look at the Building Blocks article on how the data is transferred (RFM12B - Part 2) because you'll need to modify one or both sketches. Which one(s) depends also on what you want to send to emonCMS (assuming you will at some point in the future, though you don't mention it now).

Your problem is that there's very little spare memory for additional code in the emonGLCD, so the less you add in there, the better.

First, the total power. If you don't want the individual power on each phase displayed, the sensible place to add them is in the emonTx. If you look at that sketch, you'll find the 3 powers are assigned to 3 variables in the emontx struct, like this: "emontx.power1=ct1.realPower;"
You simply need to remove the 3 individual variables from that struct and replace them with totalPower (say) then, at the end of the loop when you've calculated the 3rd power, add all 3 and assign the total: "totalPower = ct1.realPower + ct2.realPower + ct3.realPower;"
Then in the GLCD, you need to make the emontx struct exactly the same as in the emonTx, and then you'll need to write totalPower to the display somehow.

If you want the 3 individual powers, then instead you add them in the GLCD, then use the total and write it to the display.

The backlight: It turns off overnight, according to the internal clock that's set by a message from the emonCMS server. In daytime, the brightness varies according to the ambient light.

You can find an explanation of the SolarPV sketch here [and it took me a while to find that! ! !]
That sketch uses the buttons to change pages. They're not used in your sketch.
That article should show you how to write different data to and edit the display. As always, ask again if you're stuck.

JD's picture

Re: EmonGLCD 3-phase: Power Now only showing CT1

I made that change to my GLCD.  In fact, I needed to add all 4 CT's together to get total power in my case.  I had to change 3 lines in the "emon_GLCD_HomeEnergyMonitor" sketch:

 

Payload line change:

from 

typedef struct { int power1, power2, power3, Vrms; } PayloadTX;         // neat way of packaging data for RF comms

​to

typedef struct { int power1, power2, power3, power4, Vrms, temp; } PayloadTX;        

 

and to do the calculation adding all 4 CT's:

from:

    usekwh += (emontx.power1 * 0.2) / 3600000;

    cval_use = cval_use + (emontx.power1 - cval_use)*0.50;        //smooth transitions

to:

 usekwh += (((emontx.power1 + emontx.power2 + emontx.power3 + emontx.power4)*.5) * 0.2) / 3600000;                    

    cval_use = cval_use + (((emontx.power1 + emontx.power2 + emontx.power3 + emontx.power4)*.5) - cval_use)*0.50;        // sum all sensors smooth transitions

I'm pretty new to this, so my code may be crude!  But it does get the correct results on the LCD.

Robert Wall's picture

Re: EmonGLCD 3-phase: Power Now only showing CT1

Yes, that's because the sketch was written when the emonTx V3 did not exist, and the V2 has only 3 current inputs!

Rather than repeated adding of all 4 powers, you could invent a variable for total power as I suggested - it can be local to the GLCD and not shared with the emonTx via the struct.

JD's picture

Re: EmonGLCD 3-phase: Power Now only showing CT1

I always appreciate learning from you Robert, thank you.

calypso_rae's picture

Re: EmonGLCD 3-phase: Power Now only showing CT1

I have developed a 3-phase PCB which has three voltage sensors and can monitor real power on each of the phases.  Data transmissions are similar to those from an emonTx.  The software is very similar to the "CM" code for emonTx - because I wrote them both!

This board is intended to divert surplus power using "Mk2 Router" principles in a 3-phase setting, but it can also be used for monitoring too.  More details at http://mk2pvrouter.co.uk/61101.html

 

ajscheid's picture

Re: EmonGLCD 3-phase: Power Now only showing CT1

Thanks Robert,

 

that is exactly the information I needed. Being new to that whole stuff it can become quite overwhelming with all these different sketches, structs, variables and you name it. Clearly I have to up my basics to understand this whole topic.

I actually didn't know that I have a sophisticated 4-wire 3-phase system when I ordered the components.

I will give it a try later today.

Playing around with the equipment yesterday I discovered various things which seems to make my home grid look a bit faulty wired up:

I installed the 3 way sketch on the emontx measuring the voltage on phase 1 (CT1). On that phase I get proper readings using my toaster as purely resistive load. I verified the data from the emontx against my efergy appliance meter.

The second phase also behaves mor or less correct attaching the same resistive load.

But the third one behaves strange; the emontx delivers negative values, around -15 Watts with no load. If I switch on the lights (LED) emontx delivers the correct difference (like 60 Watt bulb - 15 Watts = 45 Watts). But if I use a wall plug which is on the phase 3 and connect my resistive load I receive negative values which dont correspond to my resistive load, i. e. erfergy meter. In addition it seems like the data from the other 2 phases get influenced by the load on the phase 3..... Could it be that the wall plug is wired up the wrong way?

I will give more details later whenn I checked carefully.

 

My first question now (I know, I am jumping all over the place here): 

How do I calibrate the phase 3 so it doesn't show the negative value; assuming that single wall plug I used is the only one behaving funny (didn't test the others). I tried to understand the calibration method but wasn't able to follow. What I assume I understood correctly is that all the correction factors relate only to the CT's and AC-AC adaptor used for the system. Is that correct? If so, how do I change the sketch to get zero reading on my 3rd phase with no load?

Back to topic: The back light of the emonGLCD doesn't turn off during night with the example sketch. Settings on the emoncms server are correct and the time in the display is also correct. Still have to look into that also.....   

Robert Wall's picture

Re: EmonGLCD 3-phase: Power Now only showing CT1

When you write "I installed the 3 way sketch...", do you in fact mean the EmonTx V3 3-phase sketch from GitHub? (Just to be sure we're talking about the same thing.)

If you connect your ac adapter to the socket on phase 3, and plug the CT into CT1, does it read correctly? If it gives negative power then, reverse the CT on its cable. (Do the same with Phase 2). Then, if you cannot calibrate phases 2 & 3, it may mean that they are swapped over.

The sketch also assumes you are measuring voltage line - neutral, and that the voltages remain symmetrical (the same amplitude) so the voltages and currents in the 2nd & 3rd lines (with a resistive load of course) are 120° approx displaced from line 1. As you say you have a 4-wire system (the 4th wire being neutral, not earth!) then that should be OK. The only way that I can think of, for the data to interact, is if your neutral is not solid and the line-neutral voltages are not symmetrical and change dramatically with load changes. If that's the case, I'm afraid there is no solution other than 2 more emonTx's, one per phase.

What country are you in?

ajscheid's picture

Re: EmonGLCD 3-phase: Power Now only showing CT1

Hi Robert,

first of all thank you so much for your response!

I am in South Africa. And yes, that's the sketch I installed but will verify that again tomorrow. I played around with the system tonight. It seems at least 2 out of three phases are calculated more or less correctly. 

in South Africa the phases are color coded as red, blue, white and black (neutral). I assume it is the same as in the UK?

i call the red phase my phase 1 where I red the voltage on. All the measurements are accurate on this phase.

Phase 2  (blue) is the phase showing a negative value of -15 without load. For testing purposes I added a constant of +15 int the emoncms and log the corrected value to a feed. I found out that the ground floor lights are connected to this phase and the values under load seem are corresponding.

i couldn't test phase 3 (white) as the wife is home and I would have to kill everything to find out what appliances are actually running of that phase.

my plan is, once wifey and kids are out of the house to draw up table of all plugs in the house and then switch off all the circuit brakers except for one to find out which plugs are on which phase. At the moment it is more or less unclear as there are more than 40 outlets, around 50 light outlets, pool pump, geyser, electric gate, electric garage door, cctv and you name it.

The initial purpose of the whole exercise was to reduce our consumption as I am sitting on an average of 28 kWh/d.

Let's see if I can get there.

I already thought about the alternative of 2 more emontx and maybe some DIN rail outlets so I can hook up the AC adaptors directly at the switch board. Haven't found anything adequate though up to now.

will make some pictures of my setup which I will post for clarification.

 

Cheers,

Antonius

Robert Wall's picture

Re: EmonGLCD 3-phase: Power Now only showing CT1

You might like to look at a little DIN-rail meter that Jörg Becker posted about a couple of months ago: http://openenergymonitor.org/emon/node/5743
Obviously you've got to break into the circuit to fit it, which might have regulatory issues apart from the safety aspect (which is why we always use CTs), so it might be a non-starter for you.

And yes, I understand Red, Yellow/White and Blue as phase colours although the UK has now "harmonized" with Europe with Brown, Black and Grey and a Blue neutral. So everyone with an older house now has a sticker that warns that there are two different standards in use. Or as I've seen written: "That's the beauty of standards, there are so many to choose from!"

Note the White phase is the second phase so that should be on CT2 input, and blue on CT3. If you have 2 & 3 crossed over, that's the source of wrong readings.

ajscheid's picture

Re: EmonGLCD 3-phase: Power Now only showing CT1

That's great info; the whole time I had the question of which is phase one, two and three! Just forgot to ask...;-)

Just for my understanding:

Red = Phase 1

White = Phase 2

Blue = Phase 3

Correct?

 

Next question is related to the calibration of the system; The calibration values of the sketch are as follows:

 

78 #define PHASE2 8                                 //  Number of samples delay for L2
79 #define PHASE3 18                               //  Number  of samples delay for L3, also size of array
80                                                               //  These can be adjusted if the phase correction is not adequate
81                                                               //  Suggested starting values for 4 ct's:
82                                                              //    PHASE2  6
83                                                             //    PHASE3 15
84                                                             //    Phasecal2 = 0.57
85                                                            //    Phasecal3 = 0.97
86

I will use CT4 on my Geyser. So according to above I should set the sample delay at #define PHASE2 to 6 and PHASE 3 to 18 for a starting point. The phasecal2 and 3 values are then to be changed to 0.57 and 0.97. What exactly does the sample delay?
 

108 //Calibration coefficients
109 //These need to be set in order to obtain accurate results
110 double Vcal = 276.9;                            // Calibration constant for voltage input
111 double Ical1 = 90.9;                            // Calibration constant for current transformer 1
112 double Ical2 = 90.9;                            // Calibration constant for current transformer 2
113 double Ical3 = 90.9;                            // Calibration constant for current transformer 3
114 double Ical4 = 16.6;                            // Calibration constant for current transformer 4

Question: Do I have to change the Vcal value in that way that emoncms reads exactly the voltage which I measure on my Phase 1. In my case the Vcal value would then be set to 243.6 to get a reading of 239 as shown on my multimeter. Or am I on the wrong path? I believe the Ical values I don't have to touch as I am using the CT's which I purchased together with the emontx?
 
116 double Phasecal1 = 1.00;                         // Calibration constant for phase shift L1
117 double Phasecal2 = 1.35;                         // Calibration constant for phase shift L2
118 double Phasecal3 = 1.37;                         // Calibration constant for phase shift L3
119 double Phasecal4 = 1.00;                         // Calibration constant for phase shift CT 4

Question: In case I use CT4 I have to change the Phasecal as per information further up. In case I don't use CT4 I leave them as is? Is this the place where I adjust the final readings if they are completely off?

Sorry for this real beginner questions but up to know I didn't get my head around that stuf...;-)

Robert Wall's picture

Re: EmonGLCD 3-phase: Power Now only showing CT1

PLEASE CHECK THAT YOUR COMMENT HAS HOT BEEN HELD FOR MODERATION BEFORE YOU POST MULTIPLE COPIES

You should see a message that tells you if your post has gone into the moderation queue. It takes time and effort to weed out copies that I'm sure you'll agree is better served answering questions and helping people like you.

The 'phase rotation' should be as you state. There's no absolute guarantee, but it's unlikely that your electricity supplier will have got it wrong.

As there are 4 CT inputs and only three phases, and CT 4 is rated differently, it is "spare". The Phase 1 voltage is delayed in the array so as to line up with the second and third phases. Adding the extra CT reading takes time, so the time between successive samples is longer, hence there will be less of them by the time the next phase comes around. However, the choice of the array element with PHASE2 and PHASE3 is only a coarse adjustment. PHASECAL provides a fine adjustment. If you cannot read a power factor of 1 by adjusting PHASECAL over the range 0 - 2 (or better still 0 - 1) then you need to change PHASE2 and/or PHASE3 until you can. You can read how PHASECAL works in Building Blocks.

The "standard" calibration values are starting points. Component tolerances mean they can never be exact, so if possible you should adjust them to give you the correct values (assuming your meter is accurate). You can read in Building Blocks how the tolerances affect accuracy.

You must do the calibration exactly in the order that I say in the comments at the beginning of the sketch, as the values are inter-dependant.

To get the correct real power with CT 4, you need to use the correct delayed voltage. If your Geyser is on Phase 1 as specified, then the sketch as-is is OK. If it is on one of the other phases, you need to change line 395: sumP4 += phaseShiftedV1 * filteredI4; to use the appropriate voltage.

ajscheid's picture

Re: EmonGLCD 3-phase: Power Now only showing CT1

Sorry Robert, 

I didn't want to waist your time. Indeed the massage came up that the post is queued but unfortunately I only realized it after posting the 3rd or 4 th time.... My apologies.

i will now go back and study the building blocks once again. Eventually I will get there.

Thank you for you assistance, highly appreciated!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.