Hi there,
I'm completely new in the world of programming Arduino and Raspberry, so I have some struggles to get the 3-phase sketch working right.
I'd like to get al the available data of a 3-phase motor, so I want to read all the data and transmit it to my raspberry Pi. The clean sketch is working and the results are good. But when I add my parameters (see below), the TX don't send any data anymore. Something with the 60 bytes?
typedef struct { int power1, realPower1, apparentPower1, powerFactor1, Irms1, power2, realPower2, apparentPower2, powerFactor2, Irms2, power3, realPower3, apparentPower3, powerFactor3, Irms3, power4, realPower4, apparentPower4, powerFactor4, Irms4, Vrms; } PayloadTX;
My second issue is about sending the data, when I lower the number of parameters in the typedef struct (see below), the emonTX sends every 10 seconds the data package to my PI. So it is working well, but my Emonhub only reads 0 for realPower and apparentPower.
typedef struct { int power1, realPower1, apparentPower1, power2, realPower2, apparentPower2, power3, realPower3, apparentPower3, power4, realPower4, apparentPower4, Vrms; } PayloadTX;
Do I have to specify these parameters for RF transmission?
Thanks in advance!
Re: Customize 3-phase sketch
The 60 bytes limit is a function of the JeeLib radio packet format. It is supposed to be 66 bytes, but there is a bug somewhere that I believe JeeLabs were looking at, but I know no more. Take a look at the Resources article about the RFM12B for details on how the radio packet is transmitted. It's a little out of date now as more data types are permitted and interpreted by emonHub, but the principle remains sound. What might be happening to produce the zero values (assuming you have picked up the correct values - do they appear in the IDE serial window?) is integer truncation - what's the difference between "power" and "realPower"/"apparentPower" (i.e. are you sending the same value twice?).
Re: Customize 3-phase sketch
First, thanks for your reaction.
I have read the file, that's why I thought that it should had something to do with the bytes, but I wasn't sure about it.
After your answer, I have checked if values appeared in the serial window and it was. So after that I checked the sketch and founded out that I still had to define the other serial parameters.
You were right about Power and realPower, they are both the same but I was still testing with defining.
Final typedef struct:
Other definitions:
Re: Customize 3-phase sketch
The calculations produce all the values. The limited number of values sent is only to make the 'payload' compatible with the standard emonTx demo sketches.
But a warning is needed: There have been problems with synchronisation between the two ends of the radio link, especially if there are long runs of zero values; the symptoms are that the emonHub rejects the data because the received byte string is the wrong length.