Wemos with pt100/max31865

Moderators: Voyager, BertB, rtenklooster, Stuntteam, grovkillen, TD-er

Post Reply
Normal user
Posts: 26
Joined: 28 Dec 2017, 15:56

Wemos with pt100/max31865

#1 Post by remko2000 » 13 Jan 2019, 12:15

I have connected a PT100 with MAX31865 to my wemos d1. I have uploaded this script via the arduino ide.

Code: Select all

  This is a library for the Adafruit PT100/P1000 RTD Sensor w/MAX31865

  Designed specifically to work with the Adafruit RTD Sensor
  ----> https://www.adafruit.com/products/3328

  This sensor uses SPI to communicate, 4 pins are required to  
  Adafruit invests time and resources providing this open source code, 
  please support Adafruit and open-source hardware by purchasing 
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.  
  BSD license, all text above must be included in any redistribution

#include <Adafruit_MAX31865.h>

// Use software SPI:         CS, DI, DO, CLK
//NodeMCU pins connected to: D0, D1, D2, D3
Adafruit_MAX31865 max1 = Adafruit_MAX31865(16, 5, 4, 0);
// use hardware SPI, just pass in the CS pin
//Adafruit_MAX31865 max1 = Adafruit_MAX31865(16);

// The value of the Rref resistor. Use 430.0!
#define RREF 431.0

void setup() {
  Serial.println("Adafruit MAX31865 PT100 Sensor Test!");

  max1.begin(MAX31865_3WIRE);  // set to 2WIRE or 4WIRE as necessary

void loop() {
  uint16_t rtd = max1.readRTD();

  //Serial.print("RTD value: "); Serial.println(rtd);
  float ratio = rtd;
  ratio /= 32768;
  //Serial.print("Ratio = "); Serial.println(ratio,8);
  //Serial.print("Resistance = "); Serial.println(RREF*ratio,8);
  //Serial.print("Temperature = "); 
  Serial.println(max1.temperature(100, RREF));

/*  // Check and print any faults
  uint8_t fault = max1.readFault();
  if (fault) {
    Serial.print("Fault 0x"); Serial.println(fault, HEX);
    if (fault & MAX31865_FAULT_HIGHTHRESH) {
      Serial.println("RTD High Threshold"); 
    if (fault & MAX31865_FAULT_LOWTHRESH) {
      Serial.println("RTD Low Threshold"); 
    if (fault & MAX31865_FAULT_REFINLOW) {
      Serial.println("REFIN- > 0.85 x Bias"); 
    if (fault & MAX31865_FAULT_REFINHIGH) {
      Serial.println("REFIN- < 0.85 x Bias - FORCE- open"); 
    if (fault & MAX31865_FAULT_RTDINLOW) {
      Serial.println("RTDIN- < 0.85 x Bias - FORCE- open"); 
    if (fault & MAX31865_FAULT_OVUV) {
      Serial.println("Under/Over voltage"); 
I get the correct values back via the serial monitor. Thats great!

The next step is of course that I want to see these values in eg. domoticz.
I searched with google and I think I've to include the esp library into my sketch with
#include <ESP8266WiFi.h>
but how do I send this temperature to my domoticz? I have already created a dummy switch temperature in domoticz with IDX 4732. How do I integrate this ESP8266-code in my working max31865script?

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 8 guests