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(" }");
}