Wanted: emonTH 2 sketch that handles many external ds1820Bs - I'll pay for it!

Tags: #<Tag:0x00007f1bdf6f18a8> #<Tag:0x00007f1bdf6f1678>

(stuart) #41

Hi @JustPlaying

This evening I thought I’d write you a program to solve the temperature monitoring problem you have!

The code is here.

It uses the ESP-8266-12E (NODE MCU 1.0) with the Arduino firmware on it - these chips are about $3USD each!

Once you write my program to the chip and power it up from USB, it will create a new WIFI access point named “ESP8266_TEMP_MON”. Connect to this WIFI from your phone or PC and browse to

Now simply select the WIFI access point you want this device to connect to in the future and its password.

You will also need to configure the emonCMS server to connect with (it won’t work with HTTPS) and enter your read+write API key.

Click submit to save the values and then when prompted, press RESET on the ESP chip.

After reboot it will then automatically connect to your WIFI as a client, scan for up to 20 temperature sensors and then transmit the readings every 30 seconds to emonCMS.

When it uploads, it posts the values into the node specified in the configuration page and labels each reading with the sensors serial number, like this…

You can edit the labels to add on a name if you want to.

The code is a bit rough and ready, but give it a go and see what you think!

(Simon) #42

Stuart, I was interested to see if this would fit on an ESP8285 which is what is the Sonoff devices are based on.

The compile fails and I’m assuming it is because the user_interface.h file isn’t present. Any chance you could upload that to Github?



WiFi security and multiple AP's
(dj jones) #43

Stuart - you’re a star!

If I sent you some money now - would you be willing to send me a hardware system already set up with your code? I’m in the UK - and would cover your postage.

It’s just that I’m a noob at this… and would hate to faff about for weeks never quite getting to the point of trying your software properly…

Thanks again for your creativity!

(Brian Orpin) #44

I’d been thinking about this for a while, but it was all new to me so I had not got around to it.

Could I suggest adding an option to put in a static IP as well?

Node can be text as well as a number now (used to be only numbers).

WiFi security and multiple AP's
(stuart) #45

Just take those lines out - should compile without them - this is copied from the ESP libraries - its not my code.

Its from here…

I’ve a SONOFF relay unit at home, may also give it a try.

(stuart) #46

Happy to accept a pull request :slight_smile:

(Simon) #47

Thanks Stuart - will have another go.


(stuart) #48

I’ve updated the code again tonight, just a general tidy up.

I’m now using the Arduino JSON library to generate the packet to send to emonCMS - this also means that should a temp sensor fail we just skip over it on the readings and the others continue.

(John Cantor) #49

Coming back to an origional question here, Is there a sketch for multiple (maybe 4) ds18b20s for the latest EmonTh with RFM69. Not worried about sensor ordering.