Current-only measurement for emonPi

Hello guys, I did not find this information in the forum and also the support did not reply me, so I will post here.

I would like to measure only the current using the emonPi and set the voltage as a constant (127V since I am in Brazil). Is that possible? The manual states that the AC-AC adapter is optional, however there is no current parameter on Emoncms, only power, vrms and related. Should I access emonPi via ssh and config that?

Thanks in advance,

  • Fernando

Where did you send the email to “support”? They normally reply, so it might be the case that your email got lost on the way.

As far as I know, there is a switch in Emonhub.conf to select the USA voltage, but it is not a calibration variable, therefore it selects the pre-programmed value of 110 V set in the sketch. (You can find the firmware via “Resources”). If the a.c. voltage input is not detected at startup, then it is indeed that default voltage that is used, and you will measure apparent power (VA) assuming 110 V. To use your value of 127 V, it will be necessary to download the firmware files (from Github), edit, compile and then reload the Atmel processor via the serial connection inside the emonPi. How to do that is described in the Hardware Docs (also in Resources).

I would recommend using USA ac ac adapter from the shop and enabling usa mode see

This will ensure your voltage is measured correctly

As you quite rightly noticed, only the power values are accessible, current is not readily available. Since the “current” values are not passed from the emonPi board to the Pi you will need to customise the emonPi firmware for your own use, it shouldn’t be to difficult to do as the current values are used in the sketches but just not brought out in the payload. and while you are at it you can edit the static voltage to 127v as well.

If you were to use the “USA 110v mode” there is a way to edit the voltage in emonhub.conf by scaling the voltage by 1.154545 (ie 110 to 127) but note that doing that is only half the job as the powers will have been calculated at 110v too, so a rough workaround the voltage difference is to scale all the powers and voltage by 1.154545, not a good solution but better than the ~15% error you would get with the default 110 setting.

But that still won’t give you “current” just a slightly more accurate way of reverse calculating it from the power values, which without PF still won’t be accurate.

The best way is to edit the sketch for the emonPi board, if you do, I recommend disabling (part of?) the emonPi update routine or find another way to prevent the automated updates from overwriting your sketch.

Appologies, I missed this. Yes, emonPi does not report current by default only power. You will need to modify the firmware:

Follow the emonlib example:

In the emonPi firmware change

ct1.calcVI(no_of_half_wavelengths,timeout); emonPi.power1=ct1.realPower;

to

ct1.calcVI(no_of_half_wavelengths,timeout); emonPi.power1=ct1.Irms;

This will return current instead of power

Maybe using the emonTx Shield will be easier to do what you require since uploading to an Arduino is easier.

Thank you for the help Robert, Paul and Glyn,

For now, I will follow Paul’s suggestion and change emonhub.conf to USA 110v mode (not quite sure how, yet) just to make sure the device is working. It is a little scary to see only zeros, I was expecting some readings since the CT is connected.

Is there some guide to update the firmware? Robert mentioned that it is described in the Hardware Docs. The only related command that I found was this one (in the section Uploading Arduino Firmware):

$ avrdude -v -c arduino -p ATMEGA328P -P /dev/ttyAMA0 -b 115200 -U flash:w:sketch_name.hex

However, the files that I should edit for the firmware are .ino, so what am I missing here?

Correct, however emonhub must be stopped first to free up the serial port. See script:

emonpi firmware files are in ~/emonpi/firmware/src

PlatformIO can be used to compile and upload the firmware direct on the emonPi see blog post example: