OpenEnergyMonitor Community

How to connect Arduino to Emoncms using WiFi module?

Tags: #<Tag:0x00007fc9b689d730> #<Tag:0x00007fc9b689d3c0> #<Tag:0x00007fc9b689cdf8> #<Tag:0x00007fc9b689cb78>

Hi guys

I did this circuit as shown in, I used the EmonLib, CT and AC-AC circuits, I added kwh calculation in the sketch and everything is shown in the monitor serial, works perfectly. However I want to send this data to Emoncms using arduino + Wifi module (not the official Arduino module).
Which one is the best?.. I mean the more realible to get it working with arduino? I’m thinking about ESP8266, have anyone got it done?
If anyone have any web page link, experience, circuit or sketch to share, it will be helpful!

PS. II really want to know if someone got it done, and what is the issues that I have to consider to get it done to

1 Like

Try searching here for “ESP8266”.

1 Like

Try to search in this site for EmonESP developments. Follow the instructions and load the sketch “EmonESP Serial to emoncms gateway” in your ESP-12E module.
I have 2 setups which are working well with EmonESP one with arduino due and one with arduino pro mini 3v3.
Good luck!

Yeah, I searched about EmonESP here and I looked Trystan EmonESP
( and I did all the procedure, my Arduino IDE is prepared for plugging the ESP module for update, but I don’t have EmonTX, or EmonPI, EmonTH or EmonBase, I’m using just the Arduino (Mega or Uno) with EmonLib. My goal is to post the readings of the energy to EmonCMS using the ESP WiFi module

My doubts are:

  1. Which ESP module should I use to get my data to EmonCMS? I see how to set up EmonTx v3 with the ESP8266 Huzzah WIFI module, but it works just with arduino and EmonLib?
  2. How can I get the EmonLib modified to send data over the ESP to emonCMS? First load the EmonESP to the ESP-12E, like you said… so ok, it is prepared to connect with arduino and EmonCMS, right? and after that how I can I sent the values from the energy variable (or any other)?

Could you help me understand how it works?

I appreciate any help, Thanks!

you should use only ESP-12E module. I checked with ESP-07 and it is not working. Load the example sketch for EmonTx v3 in your arduino and adapt it to your requirements.I changed the sketch to measure 2 voltages, 2 currents , 2 active power and 2 active energy ( you can add how many measurements you need ) and print them to the serial port connected to esp module. You will see them on the emonesp web page. After you will set up the api key of your account in the esp web page esp module will send them to as inputs for the node 0.
Best regards

1 Like

Thanks for helping, stefandumitrica!

Now I understand in a whole how it works. I’m gonna look foward to adapt the sketch and use the focus to use the ESP-12E then, but I got confused in some points:

  1. You mentioned that I should load the sketch “EmonESP Serial to emoncms gateway” in my ESP-12E module.
    One of its instructions it says: "modify your emonTX sketch to print in the requiered format - NODEID VALUE1 VALUE2 VALUE3 VALUE… what exactly is these values and how to set up them?

  2. In emonTXSerialGateway page it says I can use it to forward all emonTX v3 readings to EmonCMS, but emonTX v3 has sketches mentioning ESP modules, and RF and RMF modules, It works only on ESP, right?

Hi Mateus,
you should use the example sketch written by Trystan to be used with emontx v3 for this application, not the general ones. Check the link bellow:

Load this sketch, connect your arduino with esp module and you will see the measurements of arduino in the emonesp html web page under the latest data value.
After that, you can start to modify this sketch to send what ever measurements you need.
Best regards

1 Like

Hi, Stefan

Oh I see… I understood about the code and the other precedures you told me, I’m going to study them and do the experiments,

Thank you so much for helping!

We have just published a simple DHT22 > example using wifi on the ESP8266:

1 Like

Hi again, guys

After some time I created this post, I finaly have the ESP 12E all set up and running (altready upload some test sketches) ok, so now I’m ready to upload EmonESP sketch,
but I didn’t understand this:

ESP8266 WIFI serial to emoncms


How this works? What’s the connection between this and the ssid, passkey and apikey in the EmonESP sketch?
It means that I can change access any wifi network and apikey WITHOUT flashing the ESP again?

In step 3, it says “Upload home.html web page using the ESP8266 Sketch Data Upload tool under Arduino tools.” I’ve search about this , but found nothing


The emonesp creates it’s own wifi hot-spot ap at startup to enable connection to existing wifi networks. The emonesp repository has now been moved to openenergymonitor github, Pleae see this repo for latest code