emonBase not sending same data as emonTX

Hi

I have added a voltage input to my TX so needed to update the firmware, it now outputs correct values every 10 secs (I added a zero to the wait count as it was too often), when I check the output via the serial port all looks well.

I then updated the code on the emonBase (nanodeRF) and it outputs the wrong values?? nothing like what is being transmitted by the emonTX.

this is the payload for the TX

 Serial.print(emontx.real1);

    Serial.print(' ');

    Serial.print(emon1.apparentPower);

    Serial.print(' ');

    Serial.print(emon1.Vrms);

    Serial.print(' ');

    Serial.print(emon1.Irms);

    Serial.print(' ');

Serial.println(emon1.powerFactor);

and this is the payload on the Base

 

str.print("{rf_fail:0,");                                   

    str.print("RealPower:");    

    str.print(emontx.real1);          

    str.print(",ApparentPower:");    

    str.print(emontx.apparentpower);      

    str.print(",Mains:");    

    str.print(emontx.Vrms);        

    str.print(",Current:");    

    str.print(emontx.Irms); 

    str.print(",PowerFactor:");    

    str.print(emontx.powerFactor); 

 

I have tried taking our the rf_fail flag also but didnt make a difference.

 

This is driving me crazy, any one have any idea what im doing wrong?

 

Thanks

Gary

 

 

 

glyn.hudson's picture

Re: emonBase not sending same data as emonTX

When we refer to the 'payload' we are refering to the RF transmission payload. I think you have mixed this up with what the units are printing out to ther serial terminal. For example the emonTx single CT example transmitts the RF payload emontx.power and emontx.battery as defined near the beginning of the sketch:

typedef struct { int power, battery; } PayloadTX;     
PayloadTX emontx;   

It is this that must be the same on the emonTx and emonBase. Name of variables does not matter but number of and order does. 

 

Tailzer's picture

Re: emonBase not sending same data as emonTX

 ok, i wrongly assumed that the serial print would be in the format the RF payload was sent? i changed the names to the same as a long shot.

So if i had the right values but in the worng order they would just be assigned to the wrong inputs?

I have started again with the latest sketches from GITHUB and its working fine with just the CT info, im using CT123Voltage and it seems to be more accruate than just using a CT on its own (voltage here is normally around 233V)

So how do I get it to send the Powerfactor etc and mains volatge as these would be interesting to trend. Is there a wiki type page on settingup the payload? (I have looked but may have missed)

Thanks

glyn.hudson's picture

Re: emonBase not sending same data as emonTX

Good to hear you got it working. 

To send another variable (e.g 'PF' and 'Vrms') just add it in to the payload on both the emonTx and emonBase:

typedef struct { int power, battery, PF, Vrms; } PayloadTX;

 Yes your correct, the order in which the variables are on the Tx will be the same order that they are received on the Rx, independant of what their called. The name of the variables in the payload don't matter, it's the order that does.

Tailzer's picture

Re: emonBase not sending same data as emonTX

 ok I understand now, got it sending all the data I want from Mains, next up Tempreture!

I might try and write up about fidling with payloads as its not so straight forward...

glyn.hudson's picture

Re: emonBase not sending same data as emonTX

 That would be fantastic. If you post what you write up on the forum initally then I will make it into a page titled 'customising the emonTx' or something similar. 

Remember all pages on the site are an open wiki (once logged in) feel free to edit any page if you think you can improve it. Revision history is always saved. 

Thanks. 

Comment viewing options

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