Using The Emon Libraries

I am using an arduino to build my energy monitor. I want to compile the code on arduino IDE showing all the calculations. I cant seem to write the contents of the EmonLib.cpp and EmonLib.h and compile the code correctly. Please help.

You should save the library in its directory/folder - called Emonlib - as part of the Arduino file structure. Unfortunately, our instructions for doing that have been lost.
On my (Ubuntu Linux) system, it is


“/home/r/OpenEnergy/Software” is the “Sketchbook location” in the Arduino IDE.

After that, the IDE should automatically include the library when it sees “<#include Emonlib.h>” in your sketch.

@admins Please note that the link from Firmware Modification - Guide | OpenEnergyMonitor is dead.

[Update - April 2020]
Full instructions for installing the Arduino IDE and libraries for Windows 10, Linux and MacOS are available in ‘Learn’ at Learn→Electricity Monitoring→Using the Arduino IDE

Thank you for the response. I’m also interested in how the values are calculated. I’ve been studying the EmonLib.cpp and Emonlib.h libraries. I tried to write the code contained in the libraries as it is in the Arduino IDE. Is that possible or the library can only be added in the #include Emonlib,h?

Those files are not two libraries, they are two parts of the same thing. the .h file is the ‘header’ that contains the class declaration, the .cpp is the actual code of the class methods. You can read more about the maths in “Learn” (Link at the top of every page.)

thank you.

1 Like