How to force a 115Vac value instead of reading from AC-AC adapter


Talking about a homebrew EmonPi, what’s the best way to eliminate VRMS measurement and set a Fixed AC voltage value for power calculations?

If I remove A0 input still getting wrong values, even pulling it down to ground. And the software still think there’s an AC-AC adapter connected.

Any idea about how to “force” a 115Vac value for power calculation?


What software does you “homebrew” emonPi run in the ATmega328P (assuming that is what you have to measure voltage and current)?

It’s running the Github firmware for EmonPi, GitHub - openenergymonitor/emonpi: Raspberry Pi Based Energy Monitor. Hardware, Firmware & related software for the PI.
in firmware/src/src.ino

You need to edit that file. As you are in the Americas, I suggest you change

const byte Vrms_USA = 110;

to whatever value you want to use for your apparent power calculation, and you need to set

boolean USA = TRUE;

(it is false by default).
Provided you do not have the a.c. adapter connected when you power up your emonPi, that should calculate apparent power at the voltage you set.

DO NOT now do the automatic update of your emonCMS saying it is an “emonPi” - if you do, the change you have made will be overwritten by the new release of the ATMega sketch. You can update it if you say it is an “emonBase” - the update of the ATMega will fail and your sketch will not be overwritten.

The emonPi sketch should detect if the AC:AC adapter is present at start up, once that test is done once at start up it will not change by unplugging the AC:AC or pulling it to ground.

Are you restarting/reseting the ATmega328 after disconnecting the AC:AC?

If that isn’t working then maybe your emonpi board has an issue that is causing the sketch to detect an AC:AC signal even when one is not connected.

This should cause a fixed Vrms value to be used. 110v if use=true and 230v otherwise. The USA=true can be set via the serial connection by sending 2p

You can of course set the USA value to 115v in the sketch as Robert says and you can also set it to default to USA too, alternatively if you are using the emonSD and want to keep everything stock(ish) so you can use the update routine, you could make the adjustments from 110v to 115v externally to the sketch eg in emonhub, adjust the scales for Vrms, power1, power2 and power1pluspower2 by multiplying them by 1.045 _115/110) or in emoncms if you are not using emonhub.