Measuring two temps

Hi there, I’d like to measure two temperatures, the flow and return on my boiler. It looks like emonTH v1 had a way to attach two external sensors, but I’m wondering if emonTH v2 can do this? Obviously am going to struggle to mount the internal sensor on a copper pipe… :slight_smile: What’s the most cost-effective way to measure two temperatures?

The external sensors work on a One-wire bus, so software and battery life permitting, you can have many more than two.

The default sketch that is loaded in the factory has provision for only one external sensor, so you’d need to modify the sketch and reload it, and to do that you need the Arduino IDE and a programmer. The programmer is a fraction of the price of an emonTH, so I would expect, unless you cost in your time, that is the cheaper route.

It’s been on my list to make the required modifications to the EmonTh firmware to enable this. I will take a quick look at it now.

Ok here it is :slight_smile: first step is connecting two DS18B20 temperature sensors to the same terminals on the EmonTH, this can be really fiddly, stripping back the black cable sheathing and tinning the wires with a bit of solder makes connecting multiple sensors like this much easier!

I’ve uploaded the modified firmware that supports multiple DS18B20 temperature sensors as a feature branch on github here: GitHub - openenergymonitor/emonth2 at multiple_ds18b20_external

If you are confident using git, you can clone the repository and checkout to the multiple_ds18b20_external branch using git. Alternatively here’s the zip download for this specific version of the modified code: https://github.com/openenergymonitor/emonth2/archive/multiple_ds18b20_external.zip

Modify this line at the top of the sketch to specify the number of DS18B20 temperature sensors that you have connected: https://github.com/openenergymonitor/emonth2/blob/multiple_ds18b20_external/firmware/src/src.ino#L65

It’s possible to either compile this using the Arduino IDE or with platformIO. Let me know if you need any more detail on this @ramcq?

Once the firmware is uploaded the next step is to modify the EmonHub decoder to be able to read the radio packet sent from the EmonTH. This can be done from Emoncms > Setup > EmonHub > Edit Config.

Here’s an example for two temperature sensors, assuming that the nodeid is 23, you will need to replace the existing node decoder with this one for this to work:

[[23]]
    nodename = emonth_2ext
    [[[rx]]]
       names = temperature, ext1,ext2, humidity, battery, pulsecount
       datacodes = h,h,h,h,h,L
       scales = 0.1,0.1,0.1,0.1,0.1,1
       units = C,C,C,%,V,p
1 Like

Amazing, thanks. I’ll order the stuff and then see when I can give it a go. :+1:

1 Like

My answer to that is to solder a bit of 0.5 mm diameter solid tinned copper wire onto the multistrand, and sleeve the joint.

1 Like

Looks like I got it built but I had to drop the pinned versions for JeeLib and Si7021 from platformio.ini because at least the platformIO extension to VS Code that I have is now requiring a semantic version. I tried translating the git revisions there into the 0.0.0~git kind of syntax, but those versions don’t exist in the platformIO repository. It seemed to compile at least… any downsides to just going with the latest versions?

I got the external sensors connected too, only to realise I didn’t buy the programmer so will need to figure that out next - I have a lot of USB UART things knocking around such as USB-UART 2 Module Kit - could that work if I managed some dodgy leads somehow, or is that a bad way to save a tenner?

Hello @ramcq Looking at the Odroid usb to uart it looks like it could work, you will need to power up the EmonTh with its batteries as the programmer does not provide 5V, you will also need to manually reset the emonth just at the right point to get the upload started

This looks just like what I’m after too (but with 5 sensors, not 2) so I’ll be giving this a go when my additional emonTH and probes arrive.

I have started making all my sensors demountable. My solution to multiple sensors would be to use these (3 wire) prewired connectors for the board end.
image

One (male/female) per sensor and feed all those wires into a single ferrule to put in the terminal block.

Then crimp a connector onto the sensor leads.

image

Once you get into crimping and ferrules you never look back. Worth the initial investment and much better than soldering (IMNSHO).

Provided of course the correct size of crimp is used, for the wire size in use. Otherwise, a crimp can be most unreliable.

They don’t do well in a damp/moist environment. I’ve used some that look quite similar to the
one shown in the lower right of the picture. They didn’t take too well to being wet. (corrosion)

Keep 'em dry and they do OK.

Neither does the EmonTH :laughing:

Well I can confirm using this latest sketch, I now have 5x external probes plus the onboard temp and humidity sensor running!


Not drilled a hole through the wall to get the 5th sensor outside, but I’m pleased so far.

If you are using more than 4x external probes, you also need to scroll down the src file and change the default [4][8] to:

int numSensors;
//addresses of sensors, MAX 4!!
byte allAddress [5][8];

I have found that powering the emonth2 off and on a few times does not affect the sensor order as I am guessing it loads each one according the probes serial numbers in the same order each time.

This could prove really useful in the future when the boiler eventually gets replaced by a heat pump. It’s got me thinking if anyone on here has ever connected refrigerant pressure sensors to a heat pump to monitor the machine, where it has no logging facility built in. 0-5v pressure sensors and 4-20mA ones seem to be an industry standard, but I don’t think I remember seeing the heatpump monitoring board accepting these sort of inputs.

1 Like

Great to see @moojuiceuk !

When you do fit plenty of sensor pockets in the pipework so you can measure the temps accurately.

For now I have used thermal paste and cable ties against copper pipework (soon to be covered with insulation once I find an off cut down the workshop). Armaflex would also be a good choice, if I had any spare. I know from experience working with heat pumps that this works pretty well if the surfaces are making good contact.

As most do. But to fit the pockets when you do the pipework is worth the effort (I wish I’d thought about it for my tank pipework :slight_smile: ).

That is indeed true, as is explained in ‘Learn’. However, the danger comes when you need to replace one, the new order will probably be different, and all the right temperatures will be reported from the wrong places. The cure is to remove the temperature search command and hard-code the addresses into that array you expanded up to 5 × 8. Then the sensors will forever report in the same order, even when you replace one (provided you put its address in the slot that belonged to the old one).

That’s a good point! Noted for when the time comes when I want more probes!