Having trouble to understand the payload structure

Hi Guys,

I got my kit last week, AWESOME STUFF this, thanks.

Now the problems/confusion started.  I hooked everything up and data is being sent and received, no problem there.  I am having a problem to understand what it means though. My base unit(a Pi with the wireless receiver and default downloaded gatewayforwarder firmware shows the following output debug values/string:

INFO Serial Rx: 10 51 2 64 2 0 0 0 0 140 100 196 0

DEBUG Values: [556, 568, 0 0 25708, 196]

I guess the DEBUG Values are what is actually sent sent to emoncms as I can see them in the URL string as well as on emoncms when logged into my account.

I have 3 CTs connected and one temperature sensor on the terminal block as well as the ac-ac power supply.

Q:  The first two values look the same and I understand that(watt values), but what does the subsequent 4 mean?  Looking at http://emoncms.org/site/docs/identifyinginputs I can see various types of payloads.  My payload(containing 6 integers) doesn't seem to match any of the definitions.  What am I missing?  Can anybody point me to a post or help that explains the 6 integers, please?  I am pretty sure the last integer is the temperature reading, it does need some processing though, as it sure as heck is not 196 deg C in here...

Q:  Further, I did a lot of digging(although I didn't read evey post on the forum) and there seems to be many examples of how to edit your sketch.  I am running a Pi gatewayforwarder, so where do I find my current "live" sketch on my Pi?  All the examples seem to point to Arduino.  I shoul djust be able to log in to my Pi directly and see what it's using there, or not?

Q: Can I use the CT4 connection on the Tx the same as the other three as long as I am sure it will never exceed the 4.5kW maximum?

Thanks for your time and help guys.  Many more questions and hopefully (eventually) some contributions to follow. :)

 

 

 

Robert Wall's picture

Re: Having trouble to understand the payload structure

Your RPi is running the gateway forwarder, so that's exactly what it does - it receives the data from the emonTx and forwards it to emonCMS. It doesn't do anything to it.

The place to look for what is being sent is inside your emonTx. You don't say which it is, nor if you loaded a sketch, so I'm guessing it is a V3 with the default sketch, as listed on the emonTx V3 page under "Modules". If you download that sketch and look at it with a text editor, you'll find a line defining the payload structure, and it's instantiated on the next line:

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

If you go further down the sketch, you'll be able to read how those numbers are generated. Fairly well down, you'll find buried in an "if" clause

emontx.temp=(temp*10);

which immediately tells you your temperature is 19.6°C - it's multiplied by 10 because only integers are sent. In emonCMS, you need to multiply by 0.1 to get back to the true temperature.

CT4 is good to 4.5 kW as you say. It was intended for circuits where you will not be drawing too much current - about 19 A max - and where you would benefit from better resolution at low currents. It's unlikely to cause damage to the emonTx if you exceed that, but the readings will be inaccurate (because the waveform will be clipped) and it's best avoided.

pb66's picture

Re: Having trouble to understand the payload structure

Welcome to OEM.

The payload is made up of a string of values 0-255, this is so the data can be passed over rf network in bytes. Most sketches up until recently send integers by splitting them into 2 bytes and they get rebuilt after being received by a compatible device. that device will rebuild the integers from the byte pairs.

So the first byte is the node id in this case 10, each pairs of bytes after that make an int eg 51 + (2 x 256) = 563 and 64 + (2 x 256) = 576, (I'm guessing your examples were not taken at the same time as they appear incorrect)

the last pair are indeed temp, but as we are using ints not floats the value is multiplied by 10 and then divided by 10 at the other end so 19.5 deg C sounds a little more comfortable :-) the same (x100)is normally applied to the ac voltage, so 240v is passed as 24000.

the v3 integers are ct1 power, ct2 power, ct3 power, ct4 power, voltage, temp. so 257v ac also sounds a bit high where are you located ? 

The sketches cannot be "found" or edited once loaded. you can download a copy of the sketch and edit it locally on your pc or pi and then when you upload it to the emontx it overwrites what ever is there and any future changes are done by editing your local copy or obtaining/writing a new sketch and uploading it over the last.

All the sketches are written in arduino code and the emontx uses an arduino type processor, so as far as instructions and sketches go when you upload your sketch to the emontx it is as if you were uploading to an arduino. to do this you use the arduino IDE http://openenergymonitor.org/emon/buildingblocks/setting-up-the-arduino-environment.

to do this you will also need a programmer if you don't already http://shop.openenergymonitor.com/programmer-usb-to-serial-uart/

CT4 is identical to the other 3 except it is "scaled" differently using a different value burden resistor, it has the same measurement potential but across a smaller range, therefore higher accuracy. changing the resistor would make all the inputs the same resolution and range. so providing 4.5Kw is ample range yes, it will be ok.

Paul

pb66's picture

Re: Having trouble to understand the payload structure

Sorry Robert typing at the same time, I took a little longer than expected as I was thrown by the byte values :-)

Paul

calypso_rae's picture

Re: Having trouble to understand the payload structure

Thanks for the tutorials, all very helpful  :)

Robert Wall's picture

Re: Having trouble to understand the payload structure

"Sorry Robert typing at the same time, I took a little longer than expected as I was thrown by the byte values :-)"

We need "thread locking" on the forums! - No, not really, but it would be nice to be able to set a flag (that would automatically disappear after (say) an hour) to indicate that a response was being composed.

WernerOpenEM's picture

Re: Having trouble to understand the payload structure

Awesome guys, really thank you for the replies, Paul and Robert.

Some responses:

1) I have a emonTx v3 with the default sketch, 100% stock(for now). :)  Seems like I'll need an Arduino programmer soon.  I assume I'll be making changes there when adding more temperature sensors to the 1-wire bus as well.

2) I am in South Africa, but my Vrms reading is taken AFTER my Outback inverter, I'll move it to a pre-battery circuit and see if it changes, although, on the long run I do want my emonTx and base to be on the battery backup circuits.  But you are right 257V is a tad too much, I'll whip out the standard multimeter and see what it says tomorrow.

3) And yes Paul, my readings were not from the same payload message, just random numbers as I was busy typing up my questions.

Would it be OK if I clip the CT around more than 1 Live cable in my circuit?  Assuming I get the direction right. 

 

 

 

 

 

pb66's picture

Re: Having trouble to understand the payload structure

Although we do sometimes "coil" a wire through a ct multiple times to magnify a resistive load, eg testing a 3kw range with a 1kw load by looping 3 times through ct, I don't believe it's good practice as if the different cables are feeding different loads, especially if they are inductive, will produce at best inaccurate results... I believe !

Robert's your man for answering that question really, which he could actually be doing right now for all I know :-)

Paul

Robert Wall's picture

Re: Having trouble to understand the payload structure

Not quite - watching a TV programme about the Royal Palaces!

There's no problem with passing several cables through a CT, provided they are all on the same phase. The CT will respond to the combined current, just as it would have done had one wire passed through it and then split to feed the different loads. Therefore if you have one purely resistive load, one inductive load and one capacitive load, it could be, if the values are arranged so that the two reactive loads have exactly equal and opposite reactive components, that the CT will see only a resistive load; and that of course is exactly as it should be - it sees the vector sum of the currents.

If you get the direction of one of the cables wrong, then it subtracts that current from the others.

If the loads are on different phases, then it still does the same thing, and it is again the vector sum of currents that it responds to, but in this case that is generally speaking not the answer you want.

dBC's picture

Re: Having trouble to understand the payload structure

I clamp multiple circuits that I don't want to be able to distinguish between, with a single CT.  The CT will just give you the addition of the currents flowing.   When you think about it, clamping multiple circuits is really no different from clamping further upstream before they get spit out.   You could clamp your 80A feed from the street, or clamp all the consumer feed as they come off each of their breakers (assuming you can physically get all those wires to pass through the one CT) and the results should be the same.

Robert Wall's picture

Re: Having trouble to understand the payload structure

Not another typing at the same time!

pb66's picture

Re: Having trouble to understand the payload structure

Sounds obvious now! I was so wrapped up in thinking about all the possible loads and effects that could be on each cable I totally over looked the simple fact all the other ends would be common regardless. 

WernerOpenEM's picture

Re: Having trouble to understand the payload structure

Thanks guys.

 

I currently clamp my circuits as follows:

1) Main coming from the street.  This feeds my inverter as well as other non-essentials (geysers/air-cons/swimming pool pump/irrigation pumps/outside room)

2) Inverter circuit: This only powers my lights and plugs

3) Geysers

 

What I will do now after reading your suggestions is to clamp my non-essentials at their feed, instead of after they break out into their various circuit breakers.  I could still use my 4th clamp to view Geysers only, as long as they don't exceed 4.5kW.  Will probably be better off to clamp CT4 on my inverter rather as that is less likely to go over 4.5kW.

 

YOU GUYS ROCK!!!!

pb66's picture

Re: Having trouble to understand the payload structure

If 4.5Kw is too restricting on CT4 it is very easily changed. to match the other 3 you can either remove the smt burden resistor and fit a through hole resistor (holes provided) 22ohm metal film 1% would match ct's1-3 or you could just fit a 27ohm in the holes without removing the smt for a near as damn it match.

You can of course make a custom range with other size resistors, eg put a 120ohm in parallel with smt will double the range. either way you will need to update the sketch's calibration value for ct4

Paul

calypso_rae's picture

Re: Having trouble to understand the payload structure

Er, what's a Geyser please :-p

pb66's picture

Re: Having trouble to understand the payload structure

I pictured steaming hot water fountains but a quick google left me a little disappointed to finf out they are just small tank electric water heaters, they look alot like an instant water heater just bigger.

Paul

warlock's picture

Re: Having trouble to understand the payload structure

lol,

Hot water storage tank for the bath and shower.

 

Comment viewing options

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