Hi Robert,
I found the sketch for emonTx4, version 1.57. There are two files, one is the config. Below are the references to voltage in the non-config file, with my comments in yellow.
I do not find the “x voltage” line that you reference. replace the apparent power value with the current (i.e. delete the " × voltage" in one line where it appears).
Also, when you say – “If you’re happy to get apparent power and then divide by voltage to get back to current after the emonTx4, then fine - you don’t need to edit the sketch. But you’ll still need to replace the default sketch with another.” I am assuming you mean replace emonLibDB with emonLibCM – correct?
Your assistance is greatly appreciated.
Thank you,
Gordon
bool showCurrents = false; // Print to serial voltage, current & p.f. values
Do I change false to true?
//----------------------------emonTx V4 hard-wired connections-----------------------------------
const byte LEDpin = PIN_PB2; // emonTx V4 LED
const byte DIP_switch1 = PIN_PA4; // RF node ID (default no change in node ID, switch on for nodeID + 1) switch off D8 is HIGH from internal pullup
const byte DIP_switch2 = PIN_PA5; // Voltage selection 240 / 120 V AC (default switch off 240V) - switch off D9 is HIGH from internal pullup
No changes?
Serial.print(F("Reference voltage calibration: "));
No changes?
// Using AVR-DB 1.024V internal voltage reference
EmonLibCM_ADCCal(reference);
EmonLibCM_SetADC_VChannel(0, EEProm.vCal); // ADC Input channel, voltage calibration
EmonLibCM_SetADC_IChannel(3, EEProm.i1Cal, EEProm.i1Lead); // ADC Input channel, current calibration, phase calibration
EmonLibCM_SetADC_IChannel(4, EEProm.i2Cal, EEProm.i2Lead); // The current channels will be read in this order
EmonLibCM_SetADC_IChannel(5, EEProm.i3Cal, EEProm.i3Lead);
EmonLibCM_SetADC_IChannel(6, EEProm.i4Cal, EEProm.i4Lead);
EmonLibCM_SetADC_IChannel(8, EEProm.i5Cal, EEProm.i5Lead);
EmonLibCM_SetADC_IChannel(9, EEProm.i6Cal, EEProm.i6Lead);
// to show voltage, current & power factor for calibration:
Serial.print(F(",I1:")); Serial.print(EmonLibCM_getIrms(EmonLibCM_getLogicalChannel(1)),3);
Serial.print(F(",I2:")); Serial.print(EmonLibCM_getIrms(EmonLibCM_getLogicalChannel(2)),3);
Serial.print(F(",I3:")); Serial.print(EmonLibCM_getIrms(EmonLibCM_getLogicalChannel(3)),3);
Serial.print(F(",I4:")); Serial.print(EmonLibCM_getIrms(EmonLibCM_getLogicalChannel(4)),3);
Serial.print(F(",I5:")); Serial.print(EmonLibCM_getIrms(EmonLibCM_getLogicalChannel(5)),3);
Serial.print(F(",I6:")); Serial.print(EmonLibCM_getIrms(EmonLibCM_getLogicalChannel(6)),3);
Serial.print(F(",pf1:")); Serial.print(EmonLibCM_getPF(EmonLibCM_getLogicalChannel(1)),4);
Serial.print(F(",pf2:")); Serial.print(EmonLibCM_getPF(EmonLibCM_getLogicalChannel(2)),4);
Serial.print(F(",pf3:")); Serial.print(EmonLibCM_getPF(EmonLibCM_getLogicalChannel(3)),4);
Serial.print(F(",pf4:")); Serial.print(EmonLibCM_getPF(EmonLibCM_getLogicalChannel(4)),4);
Serial.print(F(",pf5:")); Serial.print(EmonLibCM_getPF(EmonLibCM_getLogicalChannel(5)),4);
Serial.print(F(",pf6:")); Serial.println(EmonLibCM_getPF(EmonLibCM_getLogicalChannel(6)),4);
delay(80);