I am writing to seek advice regarding the current-only measurement with an emonTx (V3).
In order to obtain the current measurement, I tried to modify the firmware changing these lines
emontx.power1 = ct1.calcIrms(no_of_samples)*Vrms
emontx.power1 = ct1.calcIrms(no_of_samples)
as was suggested for the emonPI in this link , but it doesn’t work. I have no measument at all: it’s always set to zero. Did I miss anything? Do I have to change some other parameters?
Thank you for your attention.
If you do not have an a.c. adapter, your emonTx sketch will automatically switch to measuring current only, and will report apparent power (volt-amperes) based on the assumed, fixed value of voltage.
The code you have changed is not the best - there is no need to use
calcVI( ) and
ct1.Irms because you immediately overwrite the value, so you only need the second line. It might not “work” if the current is less than 1, because
emontx.power1 is an integer value, so a current less than 1 A will be truncated to zero.
The “right” way will be to (optionally) change the name of
current1 and then (necessarily) multiply the return value of calcIrms( ) by 100 before assigning it. That will give you units of 10 mA, divide by 100 again (or multiply by 0.01) in emonHub or emonCMS when you use the number.
(For an example, look at how temperature is handled - it’s exactly the same.)