Please see steps below to enable emonTx 3P to RPi4 over serial using the emonTx_3Phase_PLL sketch. Thank you to @Robert.Wall and @borpin for your help with this.
The sketch has been edited to include a sum of the 3 phases to pull through a single kWh figure (sumPower).
I have edited the sketch as follows:
-
edited the emonhub.conf node decoder:
[[17]] nodename = emonTx_three_phase17 firmware = three_phase hardware = emonTx V3.2/V3.4/Shield [[[rx]]] names = power1, power2, power3, power4, sumPower, Vrms, temp1, temp2, temp3, temp4, temp5, temp6, pulsecount datacode = 0 scales = 1,1,1,1,1,0.01,0.01,0.01,0.01,0.01,0.01,0.01,1 units = W,W,W,W,W,V,C,C,C,C,C,C,p
-
changed ‘//Output Settings’ on row 82 to ‘SERIALOUT’
-
added ‘sumPower’ to row 300
-
added the following below row 838:
emontx.sumPower=(int)(realPower1+realPower2+realPower3+realPower4+0.5); -
added the following below row 930:
Serial.print((int)(realPower1+realPower2+realPower3+realPower4+0.5)); Serial.print(F(" "));
In emonhub I added the following interfacer:
[[SerialTx3e]]
Type = EmonHubSerialInterfacer
[[[init_settings]]]
com_port = /dev/ttyAMA0
com_baud = 9600
[[[runtimesettings]]]
pubchannels = ToEmonCMS,
I finally added the the node below:
[[99]]
nodename = my-serial-device
[[[rx]]]
names = power1, power2, power3, power4, sumPower, vrms
datacode = 0
scale = 1
units =W,W,W,W,W,V
The emonTx is connected to the RPi4 over serial per the diagram here:
Direct connection emonTx V3 > Raspberry Pi GPIO
The RPi4 is powered using a USB-C PSU and is connected via Ethernet. The emonTx is powered by the 9V AC PSU.
I have also connected a RPiZero W to the emonTx using the jump leads per the diagram above. The RPiZero W is powered directly by the emonTx, with the emonTx being powered by the 9V AC and the 5V USB DC PSUs. I added wifi to the SD card before putting it in the RPiZero W