Just in case anyone wants it, i did a copy and paste job to get pulse counter + temperature and 3 phase running at home.
/*
emonTx V3 CT1234 + 3-phase Voltage exampleAn example sketch for the emontx module for
3-phase electricity monitoring, with 4 current transformers
and 1 only voltage transformerPart of the openenergymonitor.org project
Licence: GNU GPL V3Authors: Glyn Hudson, Trystan Lea
Builds upon JeeLabs RF12 library and Arduino
Extended for 3-phase operation: Robert Wall
V.1 7/11/2013 Derived from emonTx_CT123_3Phase_Voltage.inoemonTx V3 Shield documentation:http://openenergymonitor.org/emon/modules/emonTxV3
emonTx firmware code explanation: http://openenergymonitor.org/emon/modules/emontx/firmware
emonTx / emonTx Shield calibration instructions: http://openenergymonitor.org/emon/buildingblocks/calibrationREQUIRES in [Arduino]/libraries
Arduino.h
WProgram.h
avr/wdt.h // the UNO bootloader
RFu_JeeLib.h // Download RFu_JeeLib:https://github.com/openenergymonitor/RFu_jeelib
REQUIRES in project directory
emontx_lib.ino(does NOT require EmonLib)
=============================================================================================Extended to allow the voltage measurement of a single phase to be used to generate approximate indications of
power (real and apparent) and phase angle for the other two phases of a 3-phase installation.The measured voltage of one phase is delayed in an array and subsequently used in the calculations for the
remaining phases.
N.B. "Phase shifted" means a small adjustment to the voltage waveform to accommodate small ( < 10 degrees) phase shifts
in the transformers etc. "Delayed" means a delay of the voltage samples by approx 1/3 or 2/3 cycle.
Without the 4th c.t. in use, this sketch records approx 24 sample sets per cycle at 50 Hz.POSSIBLE SOURCES OF ERROR
This method is an approximation. It assumes that the voltages of the three phases remain identical and the angles
between the voltage vectors remain accurately 120 degrees apart. The lower the fault level of the supply (i.e. the higher
the impedance), the greater the change in the true voltage will be as a result of load changes, and therefore the
inaccuracies that result from these approximations will be greater also.
If the mains frequency changes, this will appear as a change in real power and power factor for L2 and more so for L3.CALIBRATION
Adjust Vcal = 234.26 so that the correct voltage for L1 is displayed.
Adjust Ical1 = 119.0 so that the correct current for L1 is displayed.
Do the same for Ical2 & Ical3.
Connect a pure resistive load (e.g. a heater) to L1 and adjust Phasecal1 to display a power factor of 1.00.
Do the same for L2 and L3. If it not possible to keep Phasecal within the range 0 - 2, it is permissible to
change "#define PHASE2 8" and/or "#define PHASE3 18"The fourth channel may be used, for example, for a PV input. This must be on Phase 1 (meaning the same phase as the CT
connected to Input 1).
Include the line " #define CT4 " if the fourth C.T. is to be used.*/
// #define DEBUGGING // enable this line to include debugging print statements
#define SERIALPRINT // include print statement for commissioning - comment this line to exclude
//#define CT4 // uncomment this line if you are using the 4th c.t.
// The timing values "PHASE2", "PHASE3", "Phasecal2" & "Phasecal3" will be different
// depending on whether CT 4 is used or not.
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif#define RF_freq RF12_433MHZ // Frequency of RF12B module can be
// RF12_433MHZ, RF12_868MHZ or RF12_915MHZ.
// You should use the one matching the module you have.
#define FILTERSETTLETIME 5000 // Time (ms) to allow the filters to settle before sending data#define PHASE2 8 // Number of samples delay for L2
#define PHASE3 18 // Number of samples delay for L3, also size of array
// These can be adjusted if the phase correction is not adequate
// Suggested starting values for 4 ct's:
// PHASE2 6
// PHASE3 15
// Phasecal2 = 0.57
// Phasecal3 = 0.97const int nodeID = 10; // emonTx RFM12B node ID
const int networkGroup = 210; // emonTx RFM12B wireless network group
// - needs to be same as emonBase and emonGLCD needs to be same
// as emonBase and emonGLCDconst int UNO = 1; // Set to 0 if you are not using the UNO bootloader
// (i.e using Duemilanove) - All Atmega's shipped from
// OpenEnergyMonitor come with Arduino Uno bootloader
#include <avr/wdt.h> // the UNO bootloader#include <RFu_JeeLib.h> // Download JeeLib:https://github.com/openenergymonitor/RFu_jeelib
ISR(WDT_vect) { Sleepy::watchdogEvent(); }#include <OneWire.h> //http://www.pjrc.com/teensy/td_libs_OneWire.html
#include <DallasTemperature.h> //http://download.milesburton.com/Arduino/MaximTemperature/DallasTemperature_LATEST.zip//Set Voltage and current input pins
int inPinV = 0;
int inPinI1 = 1;
int inPinI2 = 2;
int inPinI3 = 3;
int inPinI4 = 4;
//Calibration coefficients
//These need to be set in order to obtain accurate results
double Vcal = 276.9; // Calibration constant for voltage input
double Ical1 = 90.9; // Calibration constant for current transformer 1
double Ical2 = 90.9; // Calibration constant for current transformer 2
double Ical3 = 90.9; // Calibration constant for current transformer 3
double Ical4 = 16.6; // Calibration constant for current transformer 4double Phasecal1 = 1.00; // Calibration constant for phase shift L1
double Phasecal2 = 1.35; // Calibration constant for phase shift L2
double Phasecal3 = 1.37; // Calibration constant for phase shift L3
double Phasecal4 = 1.00; // Calibration constant for phase shift CT 4const int TEMPERATURE_PRECISION= 11;
#define ASYNC_DELAY 375
const byte DS18B20_PWR= 19; // DS18B20 Power
#define ONE_WIRE_BUS 5 // DS18B20 Data
//-------------------------------------------------------------------------------------------------------------------------------------------//Setup DS128B20
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);//--------------------------------------------------------------------------------------
// Variable declaration for filters, phase shift, voltages, currents & powers
//--------------------------------------------------------------------------------------
double realPower1, // The final data
apparentPower1,
powerFactor1,
Irms1,
realPower2,
apparentPower2,
powerFactor2,
Irms2,
realPower3,
apparentPower3,
powerFactor3,
Irms3,
realPower4,
apparentPower4,
powerFactor4,
Irms4,
Vrms;
typedef struct { int power1, power2, power3, power4, Vrms, temp, power, pulse; } PayloadTX; // neat way of packaging data for RF comms
// (Include all the variables that are desired,
// ensure the same struct is used to receive)PayloadTX emontx; // create an instance
const int LEDpin = 6; // On-board emonTx LED
boolean settled = false;
// Added by BW for Pulse Counting
long pulseCount =0;
unsigned long pulseTime,lastTime;
double power, elapsedWh;
int ppwh=1;boolean DS18B20_STATUS;
int numSensors;
byte allAddress [4][8];void setup()
{
attachInterrupt(0, onPulse, FALLING);
pinMode(DS18B20_PWR, OUTPUT);
Serial.begin(9600);
Serial.println("emonTx V3 CT1234 Voltage 3 Phase example");
Serial.println("OpenEnergyMonitor.org");
Serial.print("Node: ");
Serial.print(nodeID);
Serial.print(" Freq: ");
if (RF_freq == RF12_433MHZ) Serial.print("433Mhz");
else if (RF_freq == RF12_868MHZ) Serial.print("868Mhz");
else if (RF_freq == RF12_915MHZ) Serial.print("915Mhz");
else Serial.print("Not set");
Serial.print(" Network: ");
Serial.println(networkGroup);rf12_initialize(nodeID, RF_freq, networkGroup); // initialize RF
rf12_sleep(RF12_SLEEP);pinMode(LEDpin, OUTPUT); // Setup indicator LED
digitalWrite(LEDpin, HIGH);if (UNO) wdt_enable(WDTO_8S); // Enable anti crash (restart) watchdog if UNO bootloader is selected.
// (Watchdog does not work with duemilanove bootloader)
// Restarts emonTx if sketch hangs for more than 8s
//################################################################################################################################
//Setup and for presence of DS18B20
//################################################################################################################################
digitalWrite(DS18B20_PWR, HIGH); delay(50);
sensors.begin();
sensors.setWaitForConversion(false); //disable automatic temperature conversion to reduce time spent awake, conversion will be implemented manually in sleeping http://harizanov.com/2013/07/optimizing-ds18b20-code-for-low-power-appli...
numSensors=(sensors.getDeviceCount());
byte j=0; // search for one wire devices and
// copy to device address arrays.
while ((j < numSensors) && (oneWire.search(allAddress[j]))) j++;
digitalWrite(DS18B20_PWR, LOW);
if (numSensors==0) DS18B20_STATUS=0;
else DS18B20_STATUS=1;
}//*********************************************************************************************************************
void loop()
{
emontx.pulse = pulseCount; pulseCount=0; // Added by BWif (DS18B20_STATUS==1)
{
digitalWrite(DS18B20_PWR, HIGH); Sleepy::loseSomeTime(50);
for(int j=0;j<numSensors;j++) sensors.setResolution(allAddress[j], TEMPERATURE_PRECISION); // and set the a to d conversion resolution of each.
sensors.requestTemperatures(); // Send the command to get temperatures
Sleepy::loseSomeTime(ASYNC_DELAY); //Must wait for conversion, since we use ASYNC mode
float temp=(sensors.getTempC(allAddress[0]));
digitalWrite(DS18B20_PWR, LOW);
if ((temp<125.0) && (temp>-40.0)) emontx.temp=(temp*10); //if reading is within range for the sensor convert float to int ready to send via RF
Serial.print("temperature: "); Serial.println(emontx.temp*0.1); delay(20);
}
// Outer loop - Reads Voltages & Currents - Sends results
calcVI3Ph(11,2000); // Calculate all. No.of complete cycles, time-out// Removing these print statements is recommended for normal use (if not required).
#ifdef SERIALPRINTSerial.print("Voltage: "); Serial.println(Vrms);
Serial.print(" Current 1: "); Serial.print(Irms1);
Serial.print(" Power 1: "); Serial.print(realPower1);
Serial.print(" VA 1: "); Serial.print(apparentPower1);
Serial.print(" PF 1: "); Serial.println(powerFactor1);
Serial.print(" Current 2: "); Serial.print(Irms2);
Serial.print(" Power 2: "); Serial.print(realPower2);
Serial.print(" VA 2: "); Serial.print(apparentPower2);
Serial.print(" PF 2: "); Serial.println(powerFactor2);
Serial.print(" Current 3: "); Serial.print(Irms3);
Serial.print(" Power 3: "); Serial.print(realPower3);
Serial.print(" VA 3: "); Serial.print(apparentPower3);
Serial.print(" PF 3: "); Serial.println(powerFactor3);
#ifdef CT4
Serial.print(" Current 4: "); Serial.print(Irms4);
Serial.print(" Power 4: "); Serial.print(realPower4);
Serial.print(" VA 4: "); Serial.print(apparentPower4);
Serial.print(" PF 4: "); Serial.println(powerFactor4);
#endifSerial.println(); delay(100);
#endif
emontx.power1 = realPower1; // Copy the desired variables ready for transmision
emontx.power2 = realPower2;
emontx.power3 = realPower3;
emontx.power4 = realPower4;
emontx.Vrms = Vrms;if (!settled && millis() > FILTERSETTLETIME) // because millis() returns to zero after 50 days !
settled = true;
if (settled) // send data only after filters have settled
{
send_rf_data(); // *SEND RF DATA* - see emontx_lib
digitalWrite(LEDpin, HIGH); delay(2); digitalWrite(LEDpin, LOW); // flash LED
emontx_sleep(3);
}
}//*********************************************************************************************************************
void calcVI3Ph(int cycles, int timeout)
{
//--------------------------------------------------------------------------------------
// Variable declaration for filters, phase shift, voltages, currents & powers
//--------------------------------------------------------------------------------------static int lastSampleV,sampleV; // 'sample' holds the raw analog read value, 'lastSample' holds the last sample
static int lastSampleI1,sampleI1;
static int lastSampleI2,sampleI2;
static int lastSampleI3,sampleI3;
static int lastSampleI4,sampleI4;static double lastFilteredV,filteredV; // 'Filtered' is the raw analog value minus the DC offset
static double lastFilteredI1, filteredI1;
static double lastFilteredI2, filteredI2;
static double lastFilteredI3, filteredI3;
static double lastFilteredI4, filteredI4;double phaseShiftedV1; // Holds the calibrated delayed & phase shifted voltage.
double phaseShiftedV2;
double phaseShiftedV3;
double phaseShiftedV4;double sumV,sumI1,sumI2,sumI3,sumI4;
double sumP1,sumP2,sumP3,sumP4; // sq = squared, sum = Sum, inst = instantaneous
int startV; // Instantaneous voltage at start of sample window.
int SupplyVoltage = 3300; //Hardcode supply voltage for emonTx V3, it should be always 3.3V
int crossCount = -2; // Used to measure number of times threshold is crossed.
int numberOfSamples = 0; // This is now incremented
int numberOfPowerSamples = 0; // Needed because 1 cycle of voltages needs to be stored before use
boolean lastVCross, checkVCross; // Used to measure number of times threshold is crossed.
double storedV[PHASE3]; // Array to store >240 degrees of voltage samples
//-------------------------------------------------------------------------------------------------------------------------
// 1) Waits for the waveform to be close to 'zero' (500 adc) part in sin curve.
//-------------------------------------------------------------------------------------------------------------------------
boolean st=false; // an indicator to exit the while loopunsigned long start = millis(); // millis()-start makes sure it doesnt get stuck in the loop if there is an error.
while(st==false) // Wait for first zero crossing...
{
startV = analogRead(inPinV); // using the voltage waveform
if ((startV < 550) && (startV > 440)) st=true; // check it's within range
if ((millis()-start)>timeout) st = true;
}//-------------------------------------------------------------------------------------------------------------------------
// 2) Main measurment loop
//-------------------------------------------------------------------------------------------------------------------------
start = millis();while ((crossCount < cycles * 2) && ((millis()-start)<timeout))
{
lastSampleV=sampleV; // Used for digital high pass filter - offset removal
lastSampleI1=sampleI1;
lastSampleI2=sampleI2;
lastSampleI3=sampleI3;
lastSampleI4=sampleI4;lastFilteredV = filteredV;
lastFilteredI1 = filteredI1;
lastFilteredI2 = filteredI2;
lastFilteredI3 = filteredI3;
lastFilteredI4 = filteredI4;//-----------------------------------------------------------------------------
// A) Read in raw voltage and current samples
//-----------------------------------------------------------------------------
sampleV = analogRead(inPinV); // Read in raw voltage signal
sampleI1 = analogRead(inPinI1); // Read in raw current signal
sampleI2 = analogRead(inPinI2); // Read in raw current signal
sampleI3 = analogRead(inPinI3); // Read in raw current signal
#ifdef CT4
sampleI4 = analogRead(inPinI4); // Read in raw current signal
#endif
//-----------------------------------------------------------------------------
// B) Apply digital high pass filters to remove 2.5V DC offset (to centre wave on 0).
//-----------------------------------------------------------------------------
filteredV = 0.996*(lastFilteredV+(sampleV-lastSampleV));
filteredI1 = 0.996*(lastFilteredI1+(sampleI1-lastSampleI1));
filteredI2 = 0.996*(lastFilteredI2+(sampleI2-lastSampleI2));
filteredI3 = 0.996*(lastFilteredI3+(sampleI3-lastSampleI3));
#ifdef CT4
filteredI4 = 0.996*(lastFilteredI4+(sampleI4-lastSampleI4));
#endifstoredV[numberOfSamples%PHASE3] = filteredV; // store this voltage sample in circular buffer
//-----------------------------------------------------------------------------
// C) Find the number of times the voltage has crossed the initial voltage
// - every 2 crosses we will have sampled 1 wavelength
// - so this method allows us to sample an integer number of half wavelengths which increases accuracy
//-----------------------------------------------------------------------------lastVCross = checkVCross;
checkVCross = (sampleV > startV)? true : false;
if (numberOfSamples==1)
lastVCross = checkVCross;
if (lastVCross != checkVCross)
{
crossCount++;
if (crossCount == 0) // Started recording at -2 crossings so that one complete cycle has been stored before accumulating.
{
sumV = 0;
sumI1 = 0;
sumI2 = 0;
sumI3 = 0;
sumI4 = 0;
sumP1 = 0;
sumP2 = 0;
sumP3 = 0;
sumP4 = 0;
numberOfPowerSamples = 0;
}
}//-----------------------------------------------------------------------------
// D) Root-mean-square method voltage
//-----------------------------------------------------------------------------
sumV += filteredV * filteredV; // sum += square voltage values//-----------------------------------------------------------------------------
// E) Root-mean-square method current
//-----------------------------------------------------------------------------
sumI1 += filteredI1 * filteredI1; // sum += square current values
sumI2 += filteredI2 * filteredI2;
sumI3 += filteredI3 * filteredI3;
#ifdef CT4
sumI4 += filteredI4 * filteredI4;
#endif//-----------------------------------------------------------------------------
// F) Phase calibration - for Phase 1: shifts V1 to correct transformer errors
// for phases 2 & 3 delays V1 by 120 degrees & 240 degrees respectively
// and shifts for fine adjustment and to correct transformer errors.
//-----------------------------------------------------------------------------
phaseShiftedV1 = lastFilteredV + Phasecal1 * (filteredV - lastFilteredV);
phaseShiftedV2 = storedV[(numberOfSamples-PHASE2-1)%PHASE3]
+ Phasecal2 * (storedV[(numberOfSamples-PHASE2)%PHASE3]
- storedV[(numberOfSamples-PHASE2-1)%PHASE3]);
phaseShiftedV3 = storedV[(numberOfSamples+1)%PHASE3]
+ Phasecal3 * (storedV[(numberOfSamples+2)%PHASE3]
- storedV[(numberOfSamples+1)%PHASE3]);
//-----------------------------------------------------------------------------
// G) Instantaneous power calc
//-----------------------------------------------------------------------------
sumP1 += phaseShiftedV1 * filteredI1; // Sum += Instantaneous Power
sumP2 += phaseShiftedV2 * filteredI2;
sumP3 += phaseShiftedV3 * filteredI3;
#ifdef CT4
sumP4 += phaseShiftedV1 * filteredI4;
#endif
numberOfPowerSamples++; // Count number of times looped for Power averages.
numberOfSamples++; //Count number of times looped.}
//-------------------------------------------------------------------------------------------------------------------------
// 3) Post loop calculations
//-------------------------------------------------------------------------------------------------------------------------
//Calculation of the root of the mean of the voltage and current squared (rms)
//Calibration coefficients applied.double V_Ratio = Vcal *((SupplyVoltage/1000.0) / 1023.0);
Vrms = V_Ratio * sqrt(sumV / numberOfPowerSamples);double I_Ratio1 = Ical1 *((SupplyVoltage/1000.0) / 1023.0);
Irms1 = I_Ratio1 * sqrt(sumI1 / numberOfPowerSamples);
double I_Ratio2 = Ical2 *((SupplyVoltage/1000.0) / 1023.0);
Irms2 = I_Ratio2 * sqrt(sumI2 / numberOfPowerSamples);
double I_Ratio3 = Ical3 *((SupplyVoltage/1000.0) / 1023.0);
Irms3 = I_Ratio3 * sqrt(sumI3 / numberOfPowerSamples);
#ifdef CT4
double I_Ratio4 = Ical4 *((SupplyVoltage/1000.0) / 1023.0);
Irms4 = I_Ratio4 * sqrt(sumI4 / numberOfPowerSamples);
#endif//Calculation power values
realPower1 = V_Ratio * I_Ratio1 * sumP1 / numberOfPowerSamples;
apparentPower1 = Vrms * Irms1;
powerFactor1 = realPower1 / apparentPower1;realPower2 = V_Ratio * I_Ratio2 * sumP2 / numberOfPowerSamples;
apparentPower2 = Vrms * Irms2;
powerFactor2 = realPower2 / apparentPower2;realPower3 = V_Ratio * I_Ratio3 * sumP3 / numberOfPowerSamples;
apparentPower3 = Vrms * Irms3;
powerFactor3 = realPower3 / apparentPower3;#ifdef CT4
realPower4 = V_Ratio * I_Ratio4 * sumP4 / numberOfPowerSamples;
apparentPower4 = Vrms * Irms4;
powerFactor4 = realPower4 / apparentPower4;
#else
realPower4 = 0.0;
apparentPower4 = 0.0;
powerFactor4 = 0.0;
#endif//Reset accumulators
sumV = 0;
sumI1 = 0;
sumI2 = 0;
sumI3 = 0;
sumI4 = 0;
sumP1 = 0;
sumP2 = 0;
sumP3 = 0;
sumP4 = 0;
//--------------------------------------------------------------------------------------#ifdef DEBUGGING
// Include these statements for development/debugging only
Serial.print("Total Samples: "); Serial.print(numberOfSamples);
Serial.print(" Power Samples: "); Serial.print(numberOfPowerSamples);
Serial.print(" Time: "); Serial.print(millis() - start);
Serial.print(" Crossings: "); Serial.println(crossCount);for (int j=0; j<PHASE3; j++)
{
Serial.print(storedV[j]); Serial.print(" ");
Serial.println();
}
#endif
}//*********************************************************************************************************************
long readVcc()
{
long result;
ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
delay(2);
ADCSRA |= _BV(ADSC);
while (bit_is_set(ADCSRA,ADSC));
result = ADCL;
result |= ADCH<<8;
result = 1126400L / result;
return result;
}void onPulse()
{
lastTime = pulseTime; //used to measure time between pulses.
pulseTime = micros();
pulseCount++; //pulseCounter
emontx.power = int((3600000000.0 / (pulseTime - lastTime))/ppwh); //Calculate power
}
Re: 3 Phase + Temp + Pulse
Hi wjwnz,
that's exactly what I want to have on my emontx 3.4. unfortunately as I uploaded this code emoncms is not getting any inputs.. Could you help me out?
Debugging my raspberry I got this:
2015-02-21 18:04:52,319 DEBUG 1 NEW FRAME : 1424534692.32 > 4b
2015-02-21 18:04:52,321 WARNING 1 Discard RX frame 'information' : ['>', '4b']
2015-02-21 18:04:52,525 DEBUG 2 NEW FRAME : 1424534692.52
2015-02-21 18:04:52,527 INFO 2 Ignoring frame consisting of SOH character
2015-02-21 18:04:52,732 DEBUG 3 NEW FRAME : 1424534692.73 > 210g
2015-02-21 18:04:52,734 WARNING 3 Discard RX frame 'information' : ['>', '210g']
2015-02-21 18:04:52,937 DEBUG 4 NEW FRAME : 1424534692.94
2015-02-21 18:04:52,940 INFO 4 Ignoring frame consisting of SOH character
2015-02-21 18:04:53,144 DEBUG 5 NEW FRAME : 1424534693.14 > 15i
2015-02-21 18:04:53,146 WARNING 5 Discard RX frame 'information' : ['>', '15i']
2015-02-21 18:04:53,362 DEBUG 6 NEW FRAME : 1424534693.36
2015-02-21 18:04:53,365 INFO 6 Ignoring frame consisting of SOH character
tried few different settings in emonhub.conf but it seams that I don't understand the full logic behind it..
what should be the right setting under the 'Nodes':
[[99]] datacode = h
datacodes = l, h, h, h,
Re: 3 Phase + Temp + Pulse
I don't think you should need anything special - that sketch outputs the default signed integers (data code: h):
Node 99 is (obviously?) out of range and included only as a template. Your emonTx is Node 10. Paul (pb66) can tell you more.
Re: 3 Phase + Temp + Pulse
Hi Robert,
thanks for your reply. Paul explained in another post that this setup in emonhub.conf:
[[99]] datacode = h
datacodes = l, h, h, h,
is the default setting. And it is unchanged from my previous setup. I had a default running setup with emonTx 3.4, and Raspbery Pi with these settings and it was sending data to the Emoncms. But because at home I have a 3 phase setup I tried to upload to the emonTx this version to measure 3 phase setup (Temp and pulse will be added later).
It seams that the upload was successful it compiles without errors and in Arduino serial monitor I get following results:
emonTx V3 CT1234 Voltage 3 Phase example
OpenEnergyMonitor.org
Node: 10 Freq: 433Mhz Network: 210
Voltage: 355.07
Current 1: 93.80 Power 1: 24725.30 VA 1: 33303.95 PF 1: 0.74
Current 2: 93.52 Power 2: 26267.98 VA 2: 33206.72 PF 2: 0.79
Current 3: 93.52 Power 3: 26853.05 VA 3: 33206.00 PF 3: 0.81
Current 4: 17.07 Power 4: 4546.02 VA 4: 6062.33 PF 4: 0.75
Voltage: 254.38
Current 1: 35.23 Power 1: 3177.04 VA 1: 8962.16 PF 1: 0.35
Current 2: 35.09 Power 2: 3906.26 VA 2: 8927.39 PF 2: 0.44
Current 3: 35.09 Power 3: 3834.19 VA 3: 8927.16 PF 3: 0.43
Current 4: 6.40 Power 4: 623.00 VA 4: 1629.24 PF 4: 0.38
Voltage: 237.00
Current 1: 13.80 Power 1: 164.90 VA 1: 3271.04 PF 1: 0.05
Current 2: 13.71 Power 2: 693.26 VA 2: 3248.09 PF 2: 0.21
Current 3: 13.68 Power 3: 548.57 VA 3: 3242.64 PF 3: 0.17
Current 4: 2.49 Power 4: 73.94 VA 4: 591.21 PF 4: 0.13
Although I have spotted one interesting thing. The EmonTx module has the red led always on and only every 10-15s it blinks. But it stays on. Does this indicate something? Before it was the other way round it was short blinking of the red led.
Re: 3 Phase + Temp + Pulse
The bit about the LED is interesting. As you can see from the sketch above, it should blink for 2 ms immediately after each time data is sent, which should be a little slower than once every 3 s. Does that tie in with how often it prints the voltage and currents?
Re: 3 Phase + Temp + Pulse
I can see nothing obviously wrong in the info you've given. The node [[99]] will have no impact (whilst it remains 99) and it looks like that payload is likely to be all ints, therefore default and not requiring any special settings.
Is the green led on the rfm2pi flashing to indicate reception of packets from the emonTx ?
If YES, what image or software etc to you have on the Pi? is the serial port available to the rfm2pi?
if NO, How close is the emonTx to the Pi? How frequent are the values output over serial?
The sketch above is for a v3(.2) and you mention a v3.4, these are not directly interchangeable, Are you sure you are using a v3.4 compatible sketch? if not it would explain the led activity on the emonTx as well as the lack of data.
Paul
Re: 3 Phase + Temp + Pulse
I didn't notice that RFu_JeeLib was being used. Intruder needs to at least change that to the plain JeeLib. I've not studied the sketch in detail, as "ownership" has now passed to BW/wjwnz, who included the code for the pulse input.
But if the wrong library is being used, it normally fails to return from initialising the RFM module, which means (if the watchdog is causing a restart) that we should see the startup messages, which we're not seeing. So there seems to be an inconsistency there.
Re: 3 Phase + Temp + Pulse
Yes I have Emontx 3.4. So if I understood correctly this will be the main problem. I will try to upload the emonTxV3_4_3Phase_Voltage from GitHub to see if this was the problem..
By the way are there 3 phase, pulse and temperature sketch for 3.4 or no one needs that kind of setup :)
Re: 3 Phase + Temp + Pulse
"are there 3 phase, pulse and temperature sketch for 3.4 or no one needs that kind of setup"
Either no-one has asked for that particular combination before, or they have converted/merged the sketches themselves and not published the result.
If the emonTxV3_4_3Phase_Voltage sketch works (which it probably will), in your original sketch you should only need to change the library as I mentioned above. If it doesn't work, or it gives silly results, then it's possible you've run into the memory corruption problem that's been reported and is still under investigation.
Re: 3 Phase + Temp + Pulse
yes emonTxV3_4_3Phase_Voltage works without errors.
Do I understand correctly that in this sketch for 3.2 version all I need to do is change the RFu_JeeLib to plain JeeLib and it should be ok?
Re: 3 Phase + Temp + Pulse
Correct. (At least, I can't think of anything else that needs changing. The DIP switch settings etc are redundant for your needs. (You don't need them to change the Node number, nor the input voltage setting.)
Re: 3 Phase + Temp + Pulse
This is very interesting!
I am currently running emonTxV3_4_3Phase_Voltage and plan to include pulse counting for our "distributed heating meter", so I'll be very interested to learn if you get the sketch to run on v3.4.