Final update to esp8266 for emontx shield publish as mqtt json string

hi there - not sure if anyone would be interested, but my final update to esp8266 (wemos D1)with 74HC4051 - i made it as compatible as possible to emontx shield. though the temp sensor is on a different pin, but everything seams works as it should…
it uses:
D5 (14), D6 (12), and D8 (15) to drive 74HC4051
D7 (14) drives the emontx shield LED
SDA (D2) and SDL (D1) are free to use LCD if you like
D0 (16) to driver diverter if you wish that function( or adapt software to handle bigger analogmultiplexer)
D4 ( 2) for your temp sensor

you can modify wemos D1 if you wish just cut trace on analog (0) and analog (4) &(5) against the header then solider in 74HC4051

solider SIG to esp8266 analog (0) input
S1 to D05
S2 to D06
S3 to D08
then solider 74HC4051 A(0) - A(5) to the corresponding header pin on the wemos

or make adapting shield for you esp8266 to take full advantage of the 7 CTs

upload to your arduino library (16.9 KB)
to your device and configure and away you go


great project.
I have already made a powermeter with arduino, emontx shield and an lcd screen sending data to a local emoncms raspberry server.
Is it possible for your configuration to send directly to an emoncms server and not through mqtt?
Thank you in advance.

hi not directly you have to adjust it the code- but as a suggestion use my mcp300X version instead it works much better and more actuate then this version ( though i think you can make 74hc451more accurate if you want there a timing delay in the switching that bleeds data from one port to the other as it switching ) . so the more CTs added the less accurate it becomes. the mcp300x version you can have 36 or more cts and it stay accurate through all of them . but also with that one you have to add direct emoncms compatibility

thanks for the reply.
I will only use 3 CTs for the 3 phases and the ac-ac adapter for real power.
I can work the code for talking to emoncms server, but how can I add the timing delay for 74hc451 to be more accurate?
Thank you once more.

Could you please tell me which version of wemos you are talking about or show me a schematic for I thing there are two versions and the pins don’t much with what you are describing.
Thanks in advance.
Here is what I have

webmos d1 r2 looks slightly different

Hi i managed to work the code and add a wifi manager and send data directly to If you are interested i can leave the files here and include them in your packets if you want.

you are more the welcome to leave them here if you like . as I would also be curious to see what changes you made :slight_smile:

Here is the code. There are 4 different ino files, with the emontx_lcd the main one so it could be easier to read and make changes.
I have set it up only for 3 ct’s. It might need a little cleanup and maybe some mistakes, but i have no programming knowledge and i made it little from here little from there.
Any comment (6.1 KB)

Do i have to change anything concerning the pins when i use 74hc451 in the emonlib.cpp file? And do i need something else if i want to use a ac-ac 9v adaptor? Thank you once more.