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

I would be interested in seeing any example code you might have.

Hello
@ JustPlaying (deri jones)
maybe you’ve already got an answer…
anyway, here is a link where you can find an arduino library which permits to use many single wire devices such as DS18B20 ou DS2438…

if it can help you…

That looks really useful and really neat way of referencing the different sensors. What boards do you use it on and what are the physical connections.

hi Brian
I used it on about 10 different brands of ESPs. depending on the ESP you may or may not need 10k resistor
the ESP i usually use are wemosd1,wemos mini, NodeMcu, esptoy or generic ESP

it would be D4 (gpio 2) on esp for onewire and positive and negative where ever i can grab it…

as to my connection hardware – depending how many DS18b20 i intent to use… I usually build a wemosD1 shield with 5- 10 audio ports and if i need more ports just use a audio splitter or connect several ds18b20 to one audio plug and if i need longer wire just use a audio jack extension cable

5mm audio splitter ext

hope that helps

1 Like

Maybe you have a particularly bad environment or some flaky code. I’m sure I’m not alone in having an ESP8266 based system reporting many DS18B20s without a hitch. In my case for a couple of years with 7 sensors and as far as I can tell no problems with the connection. Power cuts haven’t been a problem and the system is on a heat bank, the other side of the house from the router with a 9 inch brick wall between as well as the internal walls. It never fails, the pi which it reports to does lose it’s connection. If I can’t see the pi on the network I can always still see the ESP8266.

I think there was another comment about the number of DS18B20s that an eMonTH can handle, implying it wasn’t a lot. The sensors currently on the ESP system used to be connected to an eMonTX doing PV diversion and performed without a hitch. Actually I say without a hitch but the combo of emonTX RF with emoncms on a Pi actually had lots of issues with dropped connections which is why I moved to the ESP system. The emonTX could certainly manage the number of sensors.

The number of sensors isn’t a problem with the emonTH, its the wireless transmission part of the hardware which could be a problem if there are several emonTH units all trying to “talk” at the same time.

The ESP8266 units are good, but what happens when somebody changes the WIFI password (which ideally you do regularly!) and suddenly nobody can communicate with the temperature sensors anymore :frowning:

How about this for an idea for the software/hardware:

  1. Using Veroboard or similar, make a pluggable bus - 14 - 3 pin sockets all connected together and then connected to the emonTH
  2. Using the DIP switches on the emonTH, put it into “program mode” (perhaps both off?)
  3. Insert a SINGLE temp sensor into the veroboard
  4. Power on the emonTH - this when scans for the new sensor and stores it in position 1 (eeprom)
  5. Insert the next temp sensor into the veroboard
  6. Reboot the emonTH - this when scans for the new sensor and stores it in position 2 (eeprom)

Rinse + repeat for the remaining sensors.

  1. Put the DIP switches into another position - perhaps to control the base nodeId

If a sensor fails (multiple failures may cause problems) or the sensor is removed, the code could be written to detect this and blank out its programming position(s). When a new sensor is discovered/inserted, it assumes the gap and everything returns to normal.

Using the above, you will then get consistently ordered sensor data which is configured in the order the operator wants (manually via the connections) with the bonus of easy replacement of failed components.

There had been some comments on an emonTh not being able to handle many sensors - just wanted to correct that impression.

And on the changing passwords - use a variant of Ahrends software (GitHub - arendst/Tasmota: Alternative firmware for ESP8266 and ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at) or stitch in some of the emonESP code. I know this won’t be an option for the OP but if you only have a smidgen of programming expertise this shouldn’t be difficult - might even be fun.

Maybe what we need is a library for the ESP that you can easily integrate. A cut down version of emonESP would do.

Simon

2 Likes

Guys - you are all stars for putting in your knowledge into the middle - many thanks!

Summarising: is this a fair summary?

Robert said:

don’t think the emonTH and radio is a viable solution any more.

So that means I do need some other hardware in the mix… shame but not the end of the world.

The consensus seems to be that ESP8266 is the preferred choice (or have I misunderstood ?)

Question: will that feed direct to emonCMS online or to local emonPi first ?

Bramco said: 'The ESP8266 units are good,

but what happens when somebody changes the WIFI password

How about this solution: we set up a wifi AP dedicated to the system: so password will never get changed underneath us?

Is the software spec now well defined or are there still questions?

So the scope of the work I want to pay someone to do is

Software task

  • Set up a sketch to do what we need:
    Hardware:
  • install the above onto ESP hardware that I then buy off you.

At project kickoff - I’d

  • order the ESP hardware and have it shipped to the person
  • pay half the quoted time costs
    and on completion: pay the other half.

And would want the new sketch to be added to the Github for emon -to benefit future folks.

Thanks again guys!

I think we’re all guessing in regard to the actual number of sensors and their disposition. When the requirement went from 1 emonTH with 14 sensors in one location to many with variable numbers of sensors attached, presumably in widely separated places, the problem got a whole lot more complicated. If that can be tied down, then there’s going to be a much better definition of the problem.

Hi Robert
does this help:

UK installation: in kent

Underloor heating manifolds - 6 off

are spread about 10-15m apart -all in one building.

2 x 14 sensors
2 x 10 sensors
2 x 6 sensors

Boiler-room sensors
1 x 12 sensors (currently use 3 emonTH’s with 2 sensors each -works fine)

( boiler room is under a concrete floor but no problems with lost samples, so radio connection seems OK -back to emonPi in office room, 20 metres across an L in the building: * Internet connectivity: cabled with ethernet to an ethernet router)

Room temp measurements

a single temp sensor at each emonTh
running 2 right now - will add maybe 5 or 6 more

Short term extras
Gas meter
we may be stuck on this: we can;t connect our own ‘spinning magnet’ sensor - because it has an existing ‘meter reading’ attachment from the gas company- we are contacting them to see if we can get online access in their portal to hourly graphs… fingers crossed.

Medium Term extras
Electricity meter pulse counter
Electrical CTs

add 2nd building

we have also have a community hall, 20m away.
Sadly it has electric heating -radiant heaters =- greedy

Would add temp sensor inside: and maybe CT’s on the heating

10 posts were split to a new topic: WiFi security and multiple AP’s

Hi Guys

many thanks for all the insight shared here.

Would anyone be able to quote me the cost and lead-time: to develop the firmware for consensus solution here - an ESP8266 based controller for 14 DS18B20 sensors.

Private message me if you prefer

Thanks in advance

Hi @JustPlaying

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

The code is here. GitHub - stuartpittaway/ESP8266-DS18B20-EMONCMS: ESP8266 based temperature monitor for emonCMS

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 http://192.168.4.1

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!

7 Likes

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?

Cheers

Simon

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!

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).

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.

Happy to accept a pull request :slight_smile:

Thanks Stuart - will have another go.

simon