Measuring two temps

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.

The conclusion is… cycling like an absolute b******d… :laughing:

12kW (at -3C external) house with a 30kW boiler that can only modulate down to 8kW… so… c’est la vie I think. At least it’s condensing now. Roll on heat pump! :slight_smile:

Is this boiler flow/return - if so, I’d suggest something is not right with the controller.

If that is flow and return, it looks like the return temperature is not rising at all. Here’s mine at the moment.
T1 Flow, T2 Return and T3 DHW output (as its a Combi).

If your return temp is not rising, either the sensor is on the wrong pipe, or there’s an issue with the circulation pump or diverter valve perhaps?

Interesting! I was worried about the flow a bit so I tried a period with all TRVs set to 30C and it didn’t have any impact. That said, I’m not expecting many spikes (the big peaks are DHW charging and that has a separate return pipe, as the diverter is on the return) because I have set the weather compensation to match what the heat pump heat loss / radiator survey said - 55C flow at 3C outside. Which means like this week its only been aiming for 30Cish, and I’d expect it to keep running pretty much constantly.

Its a 30kW boiler and the house heat loss is 12kW so I’ve range rated it to 35% which maaaaybe made the triangles a little less spiky but no real change in frequency of the peaks. It might just be too big? The house is warm enough, keeping at 19-20ish in most rooms (measured at the TRV, mind) which is perfectly comfortable.

If the flow temperature for the radiators is 30-35C then it might well be that the radiators are dissipating all of that energy perhaps resulting in the lack of a spiky return temperature? What happens if you crank up the flow temperature on the boiler? Does the return temperature start to react and does it result in less cycling, or more?

I have to confess, I’m more used to looking at heat pump data logger graphs - on a daily basis for work. I’m used to seeing delta-t differences of 5 to 10k (higher flow rates than the usual gas boiler) and the systems I work with all use return set temperatures as their control, not flow, so when I see a flatlined return temperature, my gut reaction is a loss of flow, failed sensor etc.

If that genuinely is the return temperature, the pump works fine and there are no shut valves, then I guess all that energy is being transferred to the rooms!