Measuring two temps

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!

Hopefully, you do it before you need to replace a probe.

With minor changes, the old emonTx ‘Temperature Search’ sketch works for the emonTH:

/*******************************************************************************************
*                                                                                          *
*                         Temperature Search for emonTH V2                                 *
*                                                                                          *
*******************************************************************************************/


// Connect Sensor as here: https://wiki.openenergymonitor.org/index.php/EmonTH_V1.5#External_DS18B20_Temperature_Sensor_Connections
// Test one sensor at a time, restart this sketch for each, and note the serial number.
//
// THIS SKETCH REQUIRES:

// Libraries in the standard arduino libraries folder:
//
//	- OneWire library	http://www.pjrc.com/teensy/td_libs_OneWire.html
//	- DallasTemperature	http://download.milesburton.com/Arduino/MaximTemperature

#include <OneWire.h>
#include <DallasTemperature.h>

#define ONE_WIRE_BUS 17
#define TEMPERATURE_PRECISION 12
#define DS18B20_PWR   5

// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature. 
DallasTemperature sensors(&oneWire);

void setup()
{
  delay(1000);
  Serial.begin(115200);
  Serial.println("Temperature search");
  Serial.println("waiting 6 seconds before printing");
  delay(6000);

  pinMode(DS18B20_PWR,OUTPUT);
  digitalWrite(DS18B20_PWR, HIGH); delay(50);
  sensors.begin();
  
  DeviceAddress tmp_address;
  int numberOfDevices = sensors.getDeviceCount();
  
  for(int i=0;i<numberOfDevices; i++)
  {
    oneWire.search(tmp_address);
    printAddress(tmp_address);
    Serial.println();
  }
}

void loop()
{ 
 
}

void printAddress(DeviceAddress deviceAddress)
{
  Serial.print("{ ");
  for (uint8_t i = 0; i < 8; i++)
  {
    // zero pad the address if necessary
    Serial.print("0x");
    if (deviceAddress[i] < 16) Serial.print("0");
    Serial.print(deviceAddress[i], HEX);
    if (i<7) Serial.print(", ");
    
  }
  Serial.print(" }");
}

I use a couple of ESP8266, flashed with Tasmota with up to 6 connected sensors . They report by Mac code which I then process in NR and send to emoncms. If I need to replace one it just appears as a new Mac Code in emoncms and I can just make that one log to the right Feed.

You just need to modify the Input processing to put the right Input feeding the right Feed.

Yes, but if the emonTH is hard-coded with the sensor serial numbers, you don’t get them mixed up in the first place.

Just offering an alternative solution :slight_smile:

Got there in the end - thanks @TrystanLea! I just ordered one of the programmer boards for the sake of simplicity because I realised I don’t have the same range of plugs/wires/crocodile clips in the shed which I had when I was a teenager so getting the other UART board working just seemed like a pain. Now receiving two external sensors, I can clip these to the boiler flow/return and see how badly it’s cycling. Hooray! :slight_smile:

I’ve got to say that my experience with platformio was appalling. I’ll never touch it ever again and always continue to use the Arduino IDE.

I would agree Robert!

On Debian, PlatformIO was a mare to even get installed (running older version of Python for starters!). Went back to Arduino IDE and the only issue I has was to go hunting for si7021 libraries which are not listed in the libraries documentation!
https://learn.openenergymonitor.org/electricity-monitoring/arduino-ide/ubuntulib
Please can this page be updated so it links the correct library as there are a few different ones out there.

YMMV, but I installed PIO on an RPi to use from the command line to rebuild the EmonTX firmware and upload it to the TX via the serial interface. Really was exceptionally easy.

The GUI and the Command line versions are quite different beasts. The GUI version of PIO has come a long way and the integration with VSCode is now very good (not that I have need to use it).

I’m on Endless OS, meaning I need to get my apps as Flatpaks - both Arduino IDE and VS Code were there, so I tried Arduino first, couldn’t immediately find the dependencies I needed, so I tried PlatformIO once I’d figured out it was a VS Code plugin. It worked fine apart from the versioning problem I mentioned - I was able to easily edit the platformio.ini to remove the git hashes (as I guess my newer version of PlatformIO wanted semantic version numbers) and then it built, auto-detected the programmer, and uploaded, without any other hiccups. If the platformio.ini upstream can be updated with some “blessed” version numbers, I would’ve called that the easier path for me.

I’ve told here many times what platformio did to my system - moved files and directories around and broke the scripts I use to update from Github. Some here say it’s impossible. Perhaps they can explain how a Bash script can download from Git and put the files in the correct place one day, and a few weeks later the directory it’s looking for isn’t there? It took me 3 or 4 hours to find everything it had moved and put it all back, and put all of platformio into the bit bucket. As far as I’m concerned, that is the behaviour of (at best) malware.

Sorry it didn’t work well for you! It worked well for me. To each his own. :slight_smile:

2 Likes

Good spot. I’ve asked Gwil to add the LowPowerLabs version to all three OS’s pages.

That was in the dark ages though :laughing:

I presume you referring to me and I very much doubt I said it was impossible. Whatever it was you installed all that time ago, is a million miles from the current releases. I think some of the several million of current users would notice and complain :grinning_face_with_smiling_eyes:

Once bitten, twice shy. I can’t even feel inclined to set up a VM to try it out again, because I surely won’t risk screwing up my setup again.

I can understand that :wink:

Go on… :grinning_face_with_smiling_eyes:

I’m not saying it is perfect mind, it does have quirks as does any IDE and as ever YMMV.