OpenEnergyMonitor Community

emonGLCD SolarPV.ino help with customisation to display outputs correctly

Tags: #<Tag:0x00007fc9b1786518> #<Tag:0x00007fc9b17863d8> #<Tag:0x00007fc9b17861d0>


I have just assembled an emonGLCD which I ordered in June 2014.

It worked! However I have a few questions regarding displaying information.

On my emoncms install running locally on an RPi I have a page which shows “PV Generation”, “Nett Power Use” (which is the amount of power coming from/going to the grid) and “Real Power Use” which is the amount of power the household is using.

On the emonGLCD I expected that the top left window with the House icon would reflect the equivalent of the “Real Power Use” in emoncms and the bottom left window with the Transmission Tower icon would show arrows pointing away from the icon when I am consuming/exporting power equivalent to “Net Power Use” in emoncms.

What appears to be happening is the House icon area is actually showing the “Nett Power Use” and the Transmission Tower icon area is displaying solar output minus the “Nett Power Use” displayed in the House icon area.

I’m confused too believe me.

emonTX V3 is using emontx.power2 for grid power and emontx.power3 for solar power - emontx.power1 would never calibrate correctly when I first installed the emonTX.

I have changed the SolarPV.ino sketch to reflect these inputs and am getting the figures as displayed in the attached photo.

As a complete noob to anything to do with sketch programming I would like some assistance as to what I need to change in the sketch to display the fields with the correct figures.

I know it is something I am a) over my head in and b) doing something daft to make it not work correctly.

Where in the sketch is the math done to calculate the data to populate the displayed fields?

Another quick question. When I first installed the emonTX I changed the const float Ical fields as below to fine tune my system.
const float Ical2= 92.6; // (2000 turns / 22 Ohm burden) = 90.9
const float Ical3= 87.7; // (2000 turns / 22 Ohm burden) = 90.9

After I had the emonTX installed and tucked away under the house I also needed to fine tune the emoncms feeds with Calibration once I had it up and running. As a result the figures shown on the emonGLCD reflect the data received from the emonTX. Is there any way of calibrating the data in the SolarPV.ino sketch?

Gary (who is floundering a bit at this stage)

Your emonGLCD is receiving its data direct from your emonTx, as you know. What it doesn’t know, unless you have changed anything else, is what the values that the emonTx sends actually mean. That is, where you are monitoring what.

If you look at the sketch, there’s a variable called SolarPV_type. The comment near the top explains what the two types are. Essentially, ‘Type 1’ is for when you don’t have an a.c. adapter, therefore you need to put the c.t’s where you know the direction of power flow; ‘Type 2’ is where you have an a.c. adapter and thus you can have a c.t. on the grid connection and it can determine the direction of power flow. The type determines how the maths derives the third quantity from the two that you are measuring.

If you go back to GitHub (from whence you got the SolarPV sketch), you’ll find there is an explanation of how the code works. I’m not sure what you’ve changed, or where your c.t’s are, so I can’t be more specific.

That’s fine. Components never (for me at least) come exactly on the nominal value.

There isn’t one provided, but you can easily add a calibration multiplier to a convenient place. I’d suggest inside but right at the bottom of the
if (rf12_recvDone())
conditional section, so that the values are updated immediately they are received, and before they are used.
Something like:

emontx.power2 *= 1.01; // increase the value by 1% emontx.power3 *= 0.99; // decrease the value by 1%

It should come good if you use the same numbers as you used in emonhub/

Thanks for your help Robert.

The calibration worked a treat and is yielding results that exactly match the figures shown in emoncms.

I corrected the problem with the Home icon field - “Real Power Use” - with the following change to the code in SolarPV.ino

if (SolarPV_type==1){
cval_use = cval_use + (((emontx.power3 + emontx.power2)) - cval_use)*0.50;
cval_gen = cval_gen + (emontx.power3 - cval_gen)*0.50;


if (SolarPV_type==1){
usekwh += ((emontx.power3 + emontx.power2) * 0.2) / 3600000;
genkwh += (emontx.power3 * 0.2) / 3600000;

Hope this is correct. It seems to be working so far.

I also made a change to the emonTX packet structure to match what I assume would be transmitted. I copied this from my emonTX sketch.

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

As an aside I have found a problem with these calculation that have existed on my emoncms installation since installing it. The calculation for “Real Power Use” has been incorrect. More things to fix.

Again thanks for giving me help with this project.