Start by following the existing EmonTx4 How to compile and upload firmware guide. While the
EmonTx4DB_rf firmware example does not use all of the libraries listed (it just needs emonLibDB and RFM69_LPL), it is worthwhile installing them all so that you have the capability to compile all EmonTx4 firmwares. I’ve updated the guide to include the new
emonLibDB library alongside the others.
Using the Arduino IDE, open the
EmonTx4DB_rf firmware example. Navigate to:
File > Examples > emonLibDB > Examples > EmonTx4DB_rf
With the example open, save as a new local copy e.g
This example supports up to 12 CT sensors using the 6 CT EmonTx4 expansion board. I will be adding this to the shop soon, in the mean-time if you have a standard EmonTx4 with 6 CT inputs these additional inputs should be disabled by commenting out the line (line 33):
// #define EXPANSION_BOARD
With EXPANSION_BOARD disabled, ignore the txPacket2 code in the example, this is for transmitting the data from the second set of CT sensors on the expansion board.
Note that the Node ID for txPacket1 is set to 28 (line 42). If you have multiple EmonTx4 units, make sure that the NodeID set here is unique on your system. Set as required:
uint16_t NodeID1 = 28;
Configure the emonVs voltage sensor calibration values (lines 119-124). If you want to have 3 phase voltage sensing, make sure all 3 lines are present as default:
EmonLibDB_set_vInput(1, 100.0, 0.16);
/* Include the next two lines if you have a 3-phase emonVS */
EmonLibDB_set_vInput(2, 100.0, 0.16);
EmonLibDB_set_vInput(3, 100.0, 0.16);
100.0 here refers to 100% of the default calibration value.
To be updated with more detailed note here.
Please see emonLibDB user guide for more info as well
0.16 refers to the voltage sensor phase calibration.
Configure the CT channel calibration values (lines 126-131):
EmonLibDB_set_cInput(1, 100.0, 0.3); // 0.3° @ 20 A for 100 A CT
EmonLibDB_set_cInput(2, 100.0, 0.3);
EmonLibDB_set_cInput(3, 100.0, 0.3);
EmonLibDB_set_cInput(4, 100.0, 0.3);
EmonLibDB_set_cInput(5, 100.0, 0.3);
EmonLibDB_set_cInput(6, 100.0, 0.3);
100.0 here refers to 100A CT sensors. If you have 20A or 50A CT sensors change the relevant channels to 20.0 or 50.0 to match the CT sensor.
0.3 refers to the CT sensor phase calibration.
To be updated with more detailed note here.
Link voltage and current sensors to define the power & energy measurements (lines 156-161). I’ve changed the defaults in this example below so that CT 1 & 2 is associated with V1 (phase 1), CT 3 & 4 is associated with V2 (phase 2) & CT 5 & 6 is associated with V3 (phase 3):
EmonLibDB_set_pInput(1, 1); // CT1, V1 (etc)
These can be adjusted as required. You could have CT 1, 2 & 3 on phase 1,2,3 and CT’s 4,5 & 6 all on phase 1. This would look like this:
Note: It is also possible to measure Line-Line loads, see Line-Line loads: example lines 175-188.
Compile and upload your configured firmware to the EmonTx4. Note compilation and upload settings as covered in the EmonTx4 How to compile and upload firmware guide.
To receive the radio packet data on an emonPi or emonBase first make sure that you are running LowPowerLabs radio firmware on the emonPi or emonBase receiver.
If you have existing nodes running the original JeeLib classic radio format, the firmware on these will also need to be updated if everything is to continue talking to each other.
If you have an emonPi make sure that it’s running the latest emonPi LowPowerLabs firmware, this can be uploaded from the local emoncms Admin > Update page:
If you bought an emonBase alongside an emonTx4 and selected the standard radio format option the radio configuration should already be correct and ready to receive data from the EmonTx4 running the above firmware example.
Configure emonHub to decode the
EmonTx4DB_rf radio packet.
If you have the latest version of emonhub with autoconf enabled, it will automatically populate the node decoder configuration below. If you have an older system with autoconf disabled, follow the following manual steps:
On your local emonPi/emonBase navigate to Setup > Emonhub > Edit Config.
If you already have a node configuration in the
[nodes] section for the EmonTx4 under the same nodeid as above, remove this first.
Add the following node decoder in its place (Adjust the nodeid to match the configured nodeid as set in the firmware above):
nodename = emonTx4_28
names = MSG, Vrms1, Vrms2, Vrms3, P1, P2, P3, P4, P5, P6, E1, E2, E3, E4, E5, E6, pulse, Analog
datacodes = L, h, h, h, h, h, h, h, h, h, l, l, l, l, l, l, L, H
scales = 1.0, 0.01, 0.01, 0.01, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0
units = n, V, V, V, W, W, W, W, W, W, Wh, Wh, Wh, Wh, Wh, Wh, p, n
That should be it! you should now see the EmonTx4 data appear both in the EmonHub log window and as inputs on the Emoncms inputs page