Spike issue trending (- input) command

Hi,
I’ve just recently installed a EmonBase and Tx in my house, the TX is currently power off battries so using the powersave firmware. I have a consumer unit which is split between two RCDs with various circuits in both. I currently have two CT sensors connected, one on the main incomer live tail and one on the second RCD live feed. I basically want to monitor each RCD separately. I’ve setup the following configuration on the main incomer CT to give me the first RCD readings.

The second circuit setup below

Below is the problem I’m having with this solution

Every time that there is a load on the second circuit, it is causing the first circuit to spike either positively or negatively, I’m presuming this is because the feed is setup in the main incomer input, the spike lasts about 30 seconds, I know its not a huge issue over all but would be nice to know if someone has a solution to this. All feeds are setup to 10 second updates.
Thanks,
Phil

Welcome, Phil, to the OEM forum.

It’s a timing problem, as I think you know. I don’t know whether this will cure it, but the recommended method is to subtract the Feed, rather than the Input, so step 3 will read - feed (Circuit 2)

What I’m quite certain will cure the problem, but it means altering the sketch in your emonTx and reloading it, is to do the subtraction at source where it’s guaranteed that the numbers relate to the same sampling period, and aren’t affected by delays through emonHub and however the numbers make their way via the RPi into emonCMS. If you want to go that route, you’ll need to set up the Arduino IDE and obtain a programmer from the OEM Shop, and I can post the details of the changes you need - it’s not all that complicated.

Hi Robert,
Thanks for your help, I’ve just had the programmer arrive, if you could post details about that change that would be great, it would give me a better understanding of the data is processed.

Thanks

You first need to install the Arduino IDE and libraries - details are in Learn: Learn→Electricity Monitoring→Using the Arduino IDE
I can’t support you if you use any other IDE.

Download the default sketch from Github, which I think will be EmonTxV3CM/src at master · openenergymonitor/EmonTxV3CM · GitHub
(you’ll need all the files in there when you come to compile and upload)
and look at EmonTxV3CM.ino, around line 277. This is where the data that emonLibCM has extracted from the sensors is loaded into a structure to send by radio.

What you need to do is take the CT1 data (I presume CT1 (logical channel 0) is the main incomer and CT2 (logical channel 1) is the second RCD), and in there, before/as you assign the P1 and E1 (Power & Energy) values, do the maths.

You’ll need to do the same a bit further down below line 295 where it does the same sort of thing but using a guessed voltage for when you’re not using the a.c. adapter (or maybe don’t bother).

So I think you’ll end up with something like this:

      emontx.P1 = EmonLibCM_getRealPower(0) - EmonLibCM_getRealPower(1);
      emontx.E1 = EmonLibCM_getWattHour(0) - EmonLibCM_getWattHour(1); 
      E1        = EmonLibCM_getWattHour(0) - EmonLibCM_getWattHour(1); 

The last line saves the energy in memory across a power failure.

That should be it. No change for P2 & E2. There’s nothing to change in emonHub, but you might want to empty your feed data in emonCMS and start afresh.

Note, if you ever change and use the serial output, you’ll need to do roughly the same down below line 332. I recommend you don’t change the outputs for calibration right at the bottom in line 356 onwards.

Thanks Robert, that’s giving me a bit more understanding about the EmonTx. Is it possible to create a new output from there instead of using the input 1? so then I still receive data for main incomer? No worries if its quite a hassle, I’ll have a read of the code today to get my head around it. Thanks for your help much appreciated!

Yes - you can send what you like - but you must change the struct which encapsulates the data and the corresponding entry in emonHub to suit.

Something like:

typedef struct {
    unsigned long Msg;
    int Vrms,P0,P1,P2,P3,P4; 
    long E0,E1,E2,E3,E4; 
    int T1,T2,T3;
    unsigned long pulse;
} PayloadTX;

and to correspond:

[[15]]
  nodename = emontx3cm15
  [[[rx]]]
    names = MSG, Vrms, Incomer, House, RCD2, P3, P4, E_Incomer, E_House, E_RCD2, E3, E4, T1, T2, T3, pulse
    datacodes = L,h,h,h,h,h,h,l,l,l,l,l,h,h,h,L
    scales = 1,0.01,1,1,1,1,1,1,1,1,1,1,0.01,0.01,0.01,1
    units = n,V,W,W,W,W,W,Wh,Wh,Wh,Wh,Wh,C,C,C,p
    whitening = 1

All those match up left to right. It’s up to you to change the rest of the sketch :wink:
(But I’ll help if you get in a mess. It’s just that I’ve got a lot on at present.)

Perfect, I’ve got my head around it now so I’ll give it ago and see what happens
Thanks

Just to update, I created an extra variable (p1minusp2) and done the calculation in the emonTx, changed the emonhub as you suggested and got it working after making sure the positions from left to right matched up in the struct and emonhub config file. I then did some power spike tests and no longer getting issues with circuit 1 spiking. Thanks for your help Robert

1 Like