K-Type / MAX6675 build in

Moderators: grovkillen, Stuntteam, TD-er

Message
Author
rippchen
New user
Posts: 2
Joined: 23 Sep 2016, 18:49
Location: Germany / NRW

K-Type / MAX6675 build in

#1 Post by rippchen » 23 Sep 2016, 19:30

Hello,
can you buid in a K-Type Sensor Module like: http://www.14core.com/wiring-thermocoup ... e-nodemcu/
I want to use it for my Wood Oven.
Sorry about my English

Greetings from Germany and Thanks for the nice ESP Firmware

User avatar
moelski
Normal user
Posts: 161
Joined: 31 Aug 2016, 06:33
Location: Germany - NRW
Contact:

Re: K-Type / MAX6675 build in

#2 Post by moelski » 25 Sep 2016, 12:44

Hi rippchen,

just ordered my Modul from ebay.
I think there should be first results at the end of next week. 8-)

And if it´s working I try to bring it to the GIT repo ...

Dominik
regards
Dominik

User avatar
moelski
Normal user
Posts: 161
Joined: 31 Aug 2016, 06:33
Location: Germany - NRW
Contact:

Re: K-Type / MAX6675 build in

#3 Post by moelski » 27 Sep 2016, 22:20

Hi rippchen,

just finished the code for the MAX6675. It uses the hardware SPI feature of the ESP8266.
So you can´t use the ESP modules with limited GPIO like theESP-01.

As soon as I got a MAX 31855 I will implement the reading for that, too.

Attached are some pictures from my tests.

Regards
Dominik
Attachments
Thermocouple01.PNG
Thermocouple01.PNG (25.57 KiB) Viewed 38156 times
Thermocouple02.PNG
Thermocouple02.PNG (12.76 KiB) Viewed 38156 times
Thermocouple03.PNG
Thermocouple03.PNG (45.35 KiB) Viewed 38156 times
regards
Dominik

rippchen
New user
Posts: 2
Joined: 23 Sep 2016, 18:49
Location: Germany / NRW

Re: K-Type / MAX6675 build in

#4 Post by rippchen » 27 Sep 2016, 23:04

Hi Dominik,
very fast build.

Roland

User avatar
moelski
Normal user
Posts: 161
Joined: 31 Aug 2016, 06:33
Location: Germany - NRW
Contact:

Re: K-Type / MAX6675 build in

#5 Post by moelski » 28 Sep 2016, 21:08

Hi @all,

the new Plugin is available on Github Plugin Playground:
https://github.com/ESP8266nu/ESPEasyPlu ... couple.ino

Using the MAX6675 works for me.
Using the MAX31855 is experimental 8-) I don´t have such a board at the moment.
So it´s only implemented on the datasheet facts - hope that works :-)

Would be nice if anyone can verify the plugin.
Suggestions are welcome :-)

Dominik
regards
Dominik

User avatar
moelski
Normal user
Posts: 161
Joined: 31 Aug 2016, 06:33
Location: Germany - NRW
Contact:

Re: K-Type / MAX6675 build in

#6 Post by moelski » 29 Sep 2016, 20:09

Hi @all,

just want to let you know that the first long time test (3,5 hours) was successful.
I monitored my oven temperature while making some rips :D

I used a Thermocouple with a MAX6675.

But see the pictures ;)

Dominik
Attachments
Temperature monitored over MQTT in Fhem
Temperature monitored over MQTT in Fhem
IMG-20160929-WA0038.jpg (37.12 KiB) Viewed 38108 times
ESP12E with Adapter and Thermocouple
ESP12E with Adapter and Thermocouple
IMG-20160929-WA0014.jpg (64.7 KiB) Viewed 38108 times
The RESULT. It was delicious :)
The RESULT. It was delicious :)
IMG-20160929-WA0035.jpg (105.61 KiB) Viewed 38108 times
regards
Dominik

tozett
Normal user
Posts: 734
Joined: 22 Dec 2015, 15:46
Location: Germany

Re: K-Type / MAX6675 build in

#7 Post by tozett » 30 Sep 2016, 11:14

slow cooking?
thanks for the images, getting hungry ...
! :D

Drum
Normal user
Posts: 300
Joined: 07 Feb 2016, 11:56

Re: K-Type / MAX6675 build in

#8 Post by Drum » 30 Sep 2016, 13:03

Very nice, I see a new way to monitor my smoker and grill... Also what looks like an inexpensive way to fit more ribs in my smoker... ;)

Thanks!

User avatar
moelski
Normal user
Posts: 161
Joined: 31 Aug 2016, 06:33
Location: Germany - NRW
Contact:

Re: K-Type / MAX6675 build in

#9 Post by moelski » 30 Sep 2016, 13:18

Hi Drum,
I see a new way to monitor my smoker and grill
Well the plugin was inspired by rippchen and he want´s to do the same :D

by the way ... The temperature was very precise. My oven was at 115 and the readings swing around this value (given by heating / cooling phases).
Also what looks like an inexpensive way to fit more ribs in my smoker
Look for the "VARIERA" at Ikea 8-)
regards
Dominik

Drum
Normal user
Posts: 300
Joined: 07 Feb 2016, 11:56

Re: K-Type / MAX6675 build in

#10 Post by Drum » 30 Sep 2016, 14:40

Look for the "VARIERA" at Ikea
I thought I saw something like that at Ikea. I will add it to my wife's list, Ikea is right next to the airport and she is traveling next week.

Timing is everything... :D

r_255
Normal user
Posts: 32
Joined: 20 Nov 2015, 20:42

Re: K-Type / MAX6675 build in

#11 Post by r_255 » 02 Oct 2016, 20:15

How sweet is that..... now i can ditch the maveric !
gonna order one and give it a test run! thanks for the plugin


Input :
How about adding a fan controller + pid and make it a full bqq controller :lol:
Great for those long low and slow sessions.

Just like this....
http://heatermeter.myshopify.com/

happy esp easy bbq'ing

User avatar
moelski
Normal user
Posts: 161
Joined: 31 Aug 2016, 06:33
Location: Germany - NRW
Contact:

Re: K-Type / MAX6675 build in

#12 Post by moelski » 03 Oct 2016, 07:32

Hi @all,

I´ver just uploaded an updated version of the Plugin with these changes:
  1. Added Max31855 calculation for negative values
  2. Added some Links and Information for ChipSelect (CS)
https://github.com/ESP8266nu/ESPEasyPlu ... couple.ino
How about adding a fan controller + pid and make it a full bqq controller
For sure that would be possible. My biggest problem is the missing smoker for testing (I only have a gas grill). :D

So give me an idea how to test it without a smoker and I will give it a try ;)
regards
Dominik

r_255
Normal user
Posts: 32
Joined: 20 Nov 2015, 20:42

Re: K-Type / MAX6675 build in

#13 Post by r_255 » 04 Oct 2016, 09:04

Well i guess that might be a issue that can't be solved with software ;o)

I am thinking of creative solutions here, but so far i am not coming further than buying you a 'decent' bbq.
I am not sure if there are others that are willing to contribute?

Sure it would be cheaper to buy something already made, but to me it would be a good addition to the already great espeasy library.

:D
Yes i am smiling... but not kidding !

frank
Normal user
Posts: 116
Joined: 15 Oct 2016, 20:17
Location: Nederland

Re: K-Type / MAX6675 build in

#14 Post by frank » 28 Oct 2016, 11:30

this is great. But for a noob like me how do you put the plug in in the software? (i found out already :oops: )

I am building an controller based on this for my BBQ. I have orderd the max6675.

Drum
Normal user
Posts: 300
Joined: 07 Feb 2016, 11:56

Re: K-Type / MAX6675 build in

#15 Post by Drum » 02 Nov 2016, 16:32

Hi Dominik,
MAX6675 just arrived this morning, Plugin seems to work perfect. Coexists with the BME280, OLED and PWM with no poblem.
Well under .5C difference between BME280 and MAX6675. Thanks for the connection info in the file!

You could use something like this if you can get the gas grill really low or even off completely they say.. https://www.amazon.de/Jaeger-Sparbrand- ... 08QKT3S54M

They also have some nice smokers, I have to get a new one too, after 8 years my $40 weber is rusting through on the bottom. Lasted a lot longer than the really expensive Outdoor Chef gas grill, but the weber doesn't have black granite.

By the way the "Ikea Rib Rack" works great in the smoker too... Smoked bacon, sausage and ribs last weekend.

Drum
Normal user
Posts: 300
Joined: 07 Feb 2016, 11:56

Re: K-Type / MAX6675 build in

#16 Post by Drum » 03 Nov 2016, 13:59

Disconnect the MAX and see what happens when it re-boots... I am in a continual boot loop,. no idea what the problem is, even went back to V120 but connects to wifi, INIT i2c INIT Pulse 10 and reboot. Tx-Rx trick is not working either.

Drum
Normal user
Posts: 300
Joined: 07 Feb 2016, 11:56

Re: K-Type / MAX6675 build in

#17 Post by Drum » 07 Nov 2016, 16:31

I was able to get it back by putting R143 built for NodeMCU on it. No idea why it worked, R143 for Huzzah had the same problem....

No idea what the difference is between the two boards

BertB
Normal user
Posts: 1049
Joined: 25 Apr 2015, 14:39

Re: K-Type / MAX6675 build in

#18 Post by BertB » 30 Nov 2016, 23:39

@Dominik.
Hi, I have a WeMos D1 with ESPEasy 147 and only your SPI plugin and a MAX31855.
I followed your pinconfig as described in your plugin. Nevertheless, I only get NAN.
When I look with a logic analyser, I only see one or two clockpules coming from the D5 port.
Do I have to make other settings, except checking Init SPI in Hardware?

BertB
Normal user
Posts: 1049
Joined: 25 Apr 2015, 14:39

Re: K-Type / MAX6675 build in

#19 Post by BertB » 04 Dec 2016, 16:29

It seems that some Chinese suppliers deliver the MAX31855 board with T- connected to ground.
I could not undo this, zo I reworked the code a bit.
For the MAX31855 it also shows the cold junction temperature.

frank
Normal user
Posts: 116
Joined: 15 Oct 2016, 20:17
Location: Nederland

Re: K-Type / MAX6675 build in

#20 Post by frank » 13 Dec 2016, 20:49

the MAX6675 arrived from hong kong. But it isn't working. How do i connect it to an esp8266 12e devkit the cs is at gpio 15

frank
Normal user
Posts: 116
Joined: 15 Oct 2016, 20:17
Location: Nederland

Re: K-Type / MAX6675 build in

#21 Post by frank » 20 Dec 2016, 15:35

frank wrote:the MAX6675 arrived from hong kong. But it isn't working. How do i connect it to an esp8266 12e devkit the cs is at gpio 15
I had some time and have got it working. It works great. Now i am going to try mutiple TK on the esp.

It works with 2 TK :D :D

arista
New user
Posts: 1
Joined: 24 Dec 2016, 19:52

Re: K-Type / MAX6675 build in

#22 Post by arista » 24 Dec 2016, 20:11

I got this working pretty easily so Huge Thanks for You!

Steps to reproduce (you have to compile Esp Easy firmware by yourself, but do not be afraid if you are familiar to Arduino):

1) Follow these steps: http://www.letscontrolit.com/wiki/index ... are_Upload
- I use Mac so I copied the libs as advised in this doc: https://www.arduino.cc/en/Guide/Libraries#toc5
2) Copy https://raw.githubusercontent.com/ESP82 ... couple.ino to your ESPEasy directory, mine is: ~/Downloads/ESPEasy_R147_RC8/Source/ESPEasy
3) Open ~/Downloads/ESPEasy_R147_RC8/Source/ESPEasy/ESPEasy.ino in Arduino 1.8.0 IDE and compile/upload it into ESP8266

Works as expected. (Even better than I expected, I couldn't believe it would work out of the box!)

User avatar
moelski
Normal user
Posts: 161
Joined: 31 Aug 2016, 06:33
Location: Germany - NRW
Contact:

Re: K-Type / MAX6675 build in

#23 Post by moelski » 29 Dec 2016, 06:03

@bertb:
zo I reworked the code a bit.
Did you put update the github code?

Code: Select all

Works as expected. (Even better than I expected, I couldn't believe it would work out of the box!)
8-)
regards
Dominik

BertB
Normal user
Posts: 1049
Joined: 25 Apr 2015, 14:39

Re: K-Type / MAX6675 build in

#24 Post by BertB » 29 Dec 2016, 21:00

moelski wrote:@bertb:
zo I reworked the code a bit.
Did you put update the github code?

No, I do not know how to. Besides, it's far from decent. I only changed the MAX31855 part.
Per haps one of the real programmers can take it to the next level.
As long as you do not have a MAX31855 with the K- connected to ground, as I do, you will not need to ignore errors.
I also took out the SPI init lines as this is already done by ESPEasy and I show the cold junction temperature.

It works very good for me.

Here is my stuff:

Code: Select all

//#######################################################################################################
//######################## Plugin 120: Thermocouple (MAX6675 / MAX31855) ################################
//#######################################################################################################

// Plugin Description
// This Plugin reads the data from Thermocouples. You have to use an Adapter Board with a
// MAX6675 or MAX31855 in order to read the values. Take a look at ebay to find such boards :-)
// You can only use ESP8266 boards which expose the SPI Interface. This Plugin uses only the Hardware
// SPI Interface - no software SPI at the moment.
// But neverless you need at least 3 Pins to use SPI. So using an very simple ESP-01 is no option - Sorry.
// The Wiring ist straight forward ...
//
// If you like to send suggestions feel free to send me an email : dominik@logview.info
// Have fun ... Dominik

// Wiring
// https://de.wikipedia.org/wiki/Serial_Peripheral_Interface
// You need an ESP8266 device with accessable SPI Pins. These are:
// Name   Description     GPIO      NodeMCU   Notes
// MOSI   Master Output   GPIO13    D7        Not used (No Data sending to MAX)
// MISO   Master Input    GPIO12    D6        Hardware SPI
// SCK    Clock Output    GPIO14    D5        Hardware SPI
// CS     Chip Select     GPIO15    D8        Hardware SPI (CS is configurable through the web interface)

// Thermocouple Infos
// http://www.bristolwatch.com/ele2/therc.htm

// Chips
// MAX6675  - Cold-Junction-Compensated K-Thermocouple-to-Digital Converter (   0°C to +1024°C)
//            https://cdn-shop.adafruit.com/datasheets/MAX6675.pdf (only
// MAX31855 - Cold-Junction Compensated Thermocouple-to-Digital Converter   (-270°C to +1800°C)
//            https://cdn-shop.adafruit.com/datasheets/MAX31855.pdf

//#include <SPI.h>

#define PLUGIN_120
#define PLUGIN_ID_120         120
#define PLUGIN_NAME_120       "Temperature Thermocouple"
#define PLUGIN_VALUENAME1_120 "Temperature C"
#define PLUGIN_VALUENAME2_120 "Temperature K"

uint8_t Plugin_120_SPI_CS_Pin = 15;  // D8
uint16_t Plugin_120_SensorError;
double Plugin_120_HJ_Temp = 0.0;
double Plugin_120_CJ_Temp = 0.0;
uint16_t Plugin_120_IgnoreError;

boolean Plugin_120(byte function, struct EventStruct *event, String& string)
{
  boolean success = false;

  switch (function)
  {
    case PLUGIN_DEVICE_ADD:
      {
        Device[++deviceCount].Number = PLUGIN_ID_120;
        Device[deviceCount].Type = DEVICE_TYPE_SINGLE;
        Device[deviceCount].VType = SENSOR_TYPE_DUAL;                           // 2 Messwerte
        Device[deviceCount].Ports = 0;
        Device[deviceCount].PullUpOption = false;
        Device[deviceCount].InverseLogicOption = false;
        Device[deviceCount].FormulaOption = true;
        Device[deviceCount].ValueCount = 2;
        Device[deviceCount].SendDataOption = true;
        Device[deviceCount].TimerOption = true;
        Device[deviceCount].GlobalSyncOption = true;
        break;
      }

    case PLUGIN_GET_DEVICENAME:
      {
        string = F(PLUGIN_NAME_120);
        break;
      }

    case PLUGIN_GET_DEVICEVALUENAMES:
      {
        strcpy_P(ExtraTaskSettings.TaskDeviceValueNames[0], PSTR(PLUGIN_VALUENAME1_120));
        strcpy_P(ExtraTaskSettings.TaskDeviceValueNames[1], PSTR(PLUGIN_VALUENAME2_120));
        break;
      }

    case PLUGIN_INIT:
      {
        // Get CS Pin
        // If no Pin is in Config we use 15 as default -> Hardware Chip Select on ESP8266
        if (Settings.TaskDevicePin1[event->TaskIndex] != 0)
        {
          // Konvert the GPIO Pin to a Dogotal Puin Number first ...
          Plugin_120_SPI_CS_Pin = Settings.TaskDevicePin1[event->TaskIndex];
        }

        // set the slaveSelectPin as an output:
        pinMode(Plugin_120_SPI_CS_Pin, OUTPUT);
        // initialize SPI:
//        SPI.setHwCs(false);
//        SPI.begin();

        addLog(LOG_LEVEL_INFO, (char*)"P120 : SPI Init");

        success = true;
        break;
      }

    case PLUGIN_WEBFORM_LOAD:
      {
        string += F("<TR><TD>Info GPIO:<TD><b>1st GPIO</b> = CS (Usable GPIOs : 0, 2, 4, 5, 15)");

        byte choice1 = Settings.TaskDevicePluginConfig[event->TaskIndex][0];
        String options[2];
        options[0] = F("MAX 6675");
        options[1] = F("MAX 31855");
        //options[2] = F("MAX 31865");
        int optionValues[2];
        optionValues[0] = 1;
        optionValues[1] = 2;
        //optionValues[2] = 3;
        string += F("<TR><TD>Adapter IC:<TD><select name='plugin_120_maxtype'>");
        for (byte x = 0; x < 2; x++)
        {
          string += F("<option value='");
          string += optionValues[x];
          string += "'";
          if (choice1 == optionValues[x])
            string += F(" selected");
          string += ">";
          string += options[x];
          string += F("</option>");
        }
        string += F("</select>");

        byte choice2 = Settings.TaskDevicePluginConfig[event->TaskIndex][1];
        String options2[4];
        options2[0] = F("None");
        options2[1] = F("All");
        options2[2] = F("SCV");
        options2[3] = F("SCG");
        int optionValues2[4];
        optionValues2[0] = 0;
        optionValues2[1] = 7;
        optionValues2[2] = 4;
        optionValues2[3] = 2;
        string += F("<TR><TD>Ignore error:<TD><select name='plugin_120_error'>");
        for (byte x = 0; x < 4; x++)
        {
          string += F("<option value='");
          string += optionValues2[x];
          string += "'";
          if (choice2 == optionValues2[x])
            string += F(" selected");
          string += ">";
          string += options2[x];
          string += F("</option>");
        }
        string += F("</select>");

        byte choice3 = Settings.TaskDevicePluginConfig[event->TaskIndex][2];
        String options3[2];
        options3[0] = F("Celsius");
        options3[1] = F("Fahrenheit");
        int optionValues3[2];
        optionValues3[0] = 1;
        optionValues3[1] = 2;
        string += F("<TR><TD>C/F:<TD><select name='plugin_120_cf'>");
        for (byte x = 0; x < 2; x++)
        {
          string += F("<option value='");
          string += optionValues3[x];
          string += "'";
          if (choice3 == optionValues3[x])
            string += F(" selected");
          string += ">";
          string += options3[x];
          string += F("</option>");
        }
        string += F("</select>");

        success = true;
        break;
      }

    case PLUGIN_WEBFORM_SAVE:
      {
        String plugin1 = WebServer.arg("plugin_120_maxtype");
        Settings.TaskDevicePluginConfig[event->TaskIndex][0] = plugin1.toInt();
        String plugin2 = WebServer.arg("plugin_120_error");
        Settings.TaskDevicePluginConfig[event->TaskIndex][1] = plugin2.toInt();
        String plugin3 = WebServer.arg("plugin_120_cf");
        Settings.TaskDevicePluginConfig[event->TaskIndex][2] = plugin3.toInt();
        success = true;
        break;
      }

    case PLUGIN_READ:
      {
        // Get the MAX Type (6675 / 31855)
        // TBD ... Auswertung je nach Chip !!!
        byte MaxType = Settings.TaskDevicePluginConfig[event->TaskIndex][0];
        Plugin_120_IgnoreError = Settings.TaskDevicePluginConfig[event->TaskIndex][1];
        byte viewcf = Settings.TaskDevicePluginConfig[event->TaskIndex][2];

        // Get CS Pin
        // Konvert the GPIO Pin to a Dogotal Puin Number first ...
        Plugin_120_SPI_CS_Pin = Settings.TaskDevicePin1[event->TaskIndex];

        switch (MaxType) {
          case 1:       // MAX6675
            Plugin_120_HJ_Temp = readMax6675();
            break;
          case 2:       // MAX31855
            Plugin_120_HJ_Temp = readMax31855();
            break;
          case 3:       // MAX31865 (not implemented yet)
            //do something when var equals 2
            break;
        }

        if (Plugin_120_HJ_Temp != NAN)
        {
          if (viewcf == 1)
          {
            UserVar[event->BaseVarIndex] = Plugin_120_HJ_Temp;
            UserVar[event->BaseVarIndex + 1] = Plugin_120_CJ_Temp;
          }
          else
          {
            UserVar[event->BaseVarIndex] = CelsiusToFahrenheit(Plugin_120_HJ_Temp);
            UserVar[event->BaseVarIndex + 1] = CelsiusToFahrenheit(Plugin_120_CJ_Temp);
          }
          String log = F("P120 : HJ : ");
          log += UserVar[event->BaseVarIndex];
          log += F(" - CJ : ");
          log += UserVar[event->BaseVarIndex + 1];
          addLog(LOG_LEVEL_INFO, log);
          success = true;
        }
        else
        {
          UserVar[event->BaseVarIndex] = NAN;
          UserVar[event->BaseVarIndex + 1] = NAN;
          String log = F("P120 : No Sensor attached !");
          addLog(LOG_LEVEL_INFO, log);
          success = false;
        }

        break;
      }
  }
  return success;
}

double readMax6675()
{
  uint16_t rawvalue = 0;
  // take the SS pin low to select the chip:
  digitalWrite(Plugin_120_SPI_CS_Pin, LOW);
  // String log = F("P120 : CS Pin : ");
  // log += Plugin_120_SPI_CS_Pin;
  // addLog(LOG_LEVEL_INFO, log);
  // "transfer" 0x0 and read the Data from the Chip
  rawvalue = SPI.transfer16(0x0);
  // take the SS pin high to de-select the chip:
  digitalWrite(Plugin_120_SPI_CS_Pin, HIGH);

  String log = F("P120 : MAX6675 : RAW - BIN:");
  log += String(rawvalue, BIN);
  log += " HEX:";
  log += String(rawvalue, HEX);
  log += " DEC:";
  log += String(rawvalue);
  addLog(LOG_LEVEL_DEBUG, log);

  // Open Thermocouple
  // Bit D2 is normally low and goes high if the thermocouple input is open. In order to allow the operation of the
  // open  thermocouple  detector,  T-  must  be  grounded. Make  the  ground  connection  as  close  to  the  GND  pin
  // as possible.
  Plugin_120_SensorError = !(rawvalue & 0x0004);

  if (Plugin_120_SensorError)
  {
    // Shift RAW value 3 Bits to the right to get the data
    rawvalue >>= 3;

    // Calculate Celsius
    return rawvalue * 0.25;
  }
  else
  {
    return NAN;
  }
}

double readMax31855()
{
  uint16_t hrawvalue = 0;
  uint16_t crawvalue = 0;
  // take the SS pin low to select the chip:
  digitalWrite(Plugin_120_SPI_CS_Pin, LOW);
  // "transfer" 0x0 and read the MSB Data from the Chip
  hrawvalue = SPI.transfer16(0x0);
  // Shift MSB 16 Bits to the left
//  rawvalue <<= 16;
  // "transfer" 0x0 and read the LSB Data from the Chip
  crawvalue = SPI.transfer16(0x0);
  // take the SS pin high to de-select the chip:
  digitalWrite(Plugin_120_SPI_CS_Pin, HIGH);

  // D0,1,2 - This bits read at 1 when any of the SCV, SCG, or OC faults are active. Default value is 0.
  Plugin_120_SensorError = (crawvalue && 0x0007);
  hrawvalue >>= 2;
  crawvalue >>= 4;


  String log = F("P120 : MAX31855 : hRAW - BIN:");
  log += String(hrawvalue, BIN);
  log += " HEX:";
  log += String(hrawvalue, HEX);
  log += " DEC:";
  log += String(hrawvalue);
  log += F(" : cRAW - BIN:");
  log += String(crawvalue, BIN);
  log += " HEX:";
  log += String(crawvalue, HEX);
  log += " DEC:";
  log += String(crawvalue);

  addLog(LOG_LEVEL_DEBUG, log);

  
  if (Plugin_120_IgnoreError==7 | Plugin_120_SensorError==Plugin_120_IgnoreError)
  {
    // Data is D[31:18]
    // Shift RAW value 18 Bits to the right to get the data

    // Check for negative Values
    //  +25.00    0000 0001 1001 00 
    //    0.00    0000 0000 0000 00
    //   -0.25    1111 1111 1111 11
    //   -1.00    1111 1111 1111 00
    // -250.00    1111 0000 0110 00
    if (hrawvalue & 0x2000) // Bit 31=1 -> neg Values
    {
      // Negate all Bits
      hrawvalue = ~hrawvalue; 
      // Add 1 and make negative 
      hrawvalue = (hrawvalue + 1) * -1;
    }

    if (crawvalue & 0x800) // Bit 31=1 -> neg Values
      {
        // Negate all Bits
        crawvalue = ~crawvalue; 
        // Add 1 and make negative 
        crawvalue = (crawvalue + 1) * -1;
      }

    // Calculate Celsius
    Plugin_120_CJ_Temp=(crawvalue * 0.0625);
    
    // Calculate Celsius
    return hrawvalue * 0.25;
  }
  else
  {
    return NAN;
  }
}

// Convert Celsius to Fahrenheit
double CelsiusToFahrenheit(double celsius) {
  return celsius * 9.0 / 5.0 + 32;
}

/*double cJuntionTemp() {
    
}*/


rtenklooster
Normal user
Posts: 320
Joined: 15 Apr 2015, 14:17

Re: K-Type / MAX6675 build in

#25 Post by rtenklooster » 23 Jan 2017, 18:53

frank wrote:
frank wrote:the MAX6675 arrived from hong kong. But it isn't working. How do i connect it to an esp8266 12e devkit the cs is at gpio 15
I had some time and have got it working. It works great. Now i am going to try mutiple TK on the esp.

It works with 2 TK :D :D
How did you manage to get two of them to work?
You're able to add two devices and two different i/o ports for the CS.
But the SPI is using the same pins..i'm not able to get two readings, even though i have a different delay for both max6675's
Richard - Groningen (NL) - Image

frank
Normal user
Posts: 116
Joined: 15 Oct 2016, 20:17
Location: Nederland

Re: K-Type / MAX6675 build in

#26 Post by frank » 25 Jan 2017, 09:13

rtenklooster wrote:
frank wrote:
frank wrote:the MAX6675 arrived from hong kong. But it isn't working. How do i connect it to an esp8266 12e devkit the cs is at gpio 15
I had some time and have got it working. It works great. Now i am going to try mutiple TK on the esp.

It works with 2 TK :D :D
How did you manage to get two of them to work?
You're able to add two devices and two different i/o ports for the CS.
But the SPI is using the same pins..i'm not able to get two readings, even though i have a different delay for both max6675's
I gave every TK its own cs port and put the other pins on the same io ports.
It is now even working with 3 TK ( 2 meat probes and 1 dome probe) and it controls the fan. I am waiting for an warmer day so i can test the setup on mu BBQ :D

rtenklooster
Normal user
Posts: 320
Joined: 15 Apr 2015, 14:17

Re: K-Type / MAX6675 build in

#27 Post by rtenklooster » 25 Jan 2017, 18:34

frank wrote:
rtenklooster wrote:
frank wrote:
I had some time and have got it working. It works great. Now i am going to try mutiple TK on the esp.

It works with 2 TK :D :D
How did you manage to get two of them to work?
You're able to add two devices and two different i/o ports for the CS.
But the SPI is using the same pins..i'm not able to get two readings, even though i have a different delay for both max6675's
I gave every TK its own cs port and put the other pins on the same io ports.
It is now even working with 3 TK ( 2 meat probes and 1 dome probe) and it controls the fan. I am waiting for an warmer day so i can test the setup on mu BBQ :D
And all three sensors the same delay? did you used if for a couple of minutes / hours?
I did the same, but even though all sensors have their own CS pin, the values being reported are not always from the according sensor.

If you are sure then maybe i'm using a different plugin, i used the plugin from the last post of this topic.
Richard - Groningen (NL) - Image

frank
Normal user
Posts: 116
Joined: 15 Oct 2016, 20:17
Location: Nederland

Re: K-Type / MAX6675 build in

#28 Post by frank » 30 Jan 2017, 06:35

I am using the plug in from github.

Yesterday i did a test run in an oven and it worked like a charm

frank
Normal user
Posts: 116
Joined: 15 Oct 2016, 20:17
Location: Nederland

Re: K-Type / MAX6675 build in

#29 Post by frank » 05 Feb 2017, 19:54

today an 7 hour sparerib sesion and it worked like a charm :D
Knowthe focus on the temperature/fan control

nettworker
Normal user
Posts: 10
Joined: 07 Feb 2017, 18:12

Re: K-Type / MAX6675 build in

#30 Post by nettworker » 11 Feb 2017, 19:38

Hello,

i have downloaded the _P120_Thermocouple.ino from https://raw.githubusercontent.com/ESP82 ... nd/master/ .
I have opend it in the Arduino IDE with R120, compiled the whole Project without errors and uploaded it to the Nodemcu. After that the ESP reboots all the time.
If i compile without the _P120_Thermocouple.ino it works.

What's wrong? Anything forgotten?

nettworker
Normal user
Posts: 10
Joined: 07 Feb 2017, 18:12

Re: K-Type / MAX6675 build in

#31 Post by nettworker » 12 Feb 2017, 16:04

Problem solved. Seems it was an internally Problem with different Builds ( R120, R147 ) an th evalues in Eprom.
After Reset the module, the R120 with the _P120_Thermocouple.ino works on the ESP. Now i am waiting for my Max6675 Modul and then K Type Needles from China.

mattes1007
New user
Posts: 1
Joined: 15 Feb 2017, 20:03

Re: K-Type / MAX6675 build in

#32 Post by mattes1007 » 15 Feb 2017, 20:18

Hi,
I have tested the plugin with my MAX31855K ​​breakout boards. Unfortunately, the interface only displays incorrect temperatures:

Image

Code: Select all

MainConfigHardwareDevices Tools

log
334685: WD: Uptime 5 ConnectFailures 28 FreeMem 28288
336546: P120: C: 2152.75 - F: 3906.95
336552: HTTP: connection failed
346814: P120: C: 2048.00 - F: 3718.40
346819: HTTP: connection failed
357164: P120: C: 2263.75 - F: 4106.75
357170: HTTP: connection failed
364686: WD: Uptime 6 ConnectFailures 31 FreeMem 28272
367295: P120: C: 2234.50 - F: 4054.10
367300: HTTP: connection failed
Powered by www.esp8266.nu
If no probe is connected, it shows 0 C / 32 F

I've tried it with 3 different MAX31855k and various TYP-K thermocouples. Always these values ​​....
Do I need to change something at the code?

mattes

mr_sensor
Normal user
Posts: 10
Joined: 08 Mar 2017, 15:47

Re: K-Type / MAX6675 build in

#33 Post by mr_sensor » 08 Mar 2017, 17:33

I just started to explore ESPEasy and it has a lot of possibilities. My second project is wiring up the MAX6677 to an esp8266 12f. I followed the samples and all the posts here on the board and ended up with an log file showing me:

Code: Select all

5105189 : WD : Uptime 85 ConnectFailures 0 FreeMem 28352
5109843 : P120 : C : nan - F : nan
5114847 : P120 : C : nan - F : nan
5119852 : P120 : C : nan - F : nan
5124857 : P120 : C : nan - F : nan
5129862 : P120 : C : nan - F : nan
So that is not what I expected to see :)

What could be the problem here? Broken board? Lack of power? I have it running on two batteries, since I want to have it portable for outdoor use.

I wired it up exactly as shown in the sketch:

Code: Select all

// MISO   Master Input    GPIO12
// SCK    Clock Output    GPIO14 
// CS     Chip Select     GPIO15 (CS 15  is configured in the web interface)
Gnd to Gnd
and Vcc to Vcc 
Any advice?

Thanks. Wiechert

mr_sensor
Normal user
Posts: 10
Joined: 08 Mar 2017, 15:47

Re: K-Type / MAX6675 build in

#34 Post by mr_sensor » 09 Mar 2017, 14:06

Any thoughts on this? Will give it a try connecting it to usb power.

W.

BertB
Normal user
Posts: 1049
Joined: 25 Apr 2015, 14:39

Re: K-Type / MAX6675 build in

#35 Post by BertB » 09 Mar 2017, 17:46

Sorry, I can't help you. I don't have that MAX.
However, did you check the enable SPI in the hardware tab?

mr_sensor
Normal user
Posts: 10
Joined: 08 Mar 2017, 15:47

Re: K-Type / MAX6675 build in

#36 Post by mr_sensor » 09 Mar 2017, 19:21

No I did not do that. Did not know that I was supposed to do that. So I will have a look. Might be the solution.

mr_sensor
Normal user
Posts: 10
Joined: 08 Mar 2017, 15:47

Re: K-Type / MAX6675 build in

#37 Post by mr_sensor » 09 Mar 2017, 20:24

If I have a look at the hardware tab I do not see any SPI mentioned. So what do you mean. Gpio12 and Gpio14 ? or pin mode?

BertB
Normal user
Posts: 1049
Joined: 25 Apr 2015, 14:39

Re: K-Type / MAX6675 build in

#38 Post by BertB » 10 Mar 2017, 07:12

What firmware version do you use?

mr_sensor
Normal user
Posts: 10
Joined: 08 Mar 2017, 15:47

Re: K-Type / MAX6675 build in

#39 Post by mr_sensor » 10 Mar 2017, 08:15

Hourly Build 2017/01/17 If that's the version (in the ReleaseNotes.ino it says R120 )? Could the problem also be that I have a regular esp 12f but arduino has NodeMcu 1.0 12e module? as a board ?

BertB
Normal user
Posts: 1049
Joined: 25 Apr 2015, 14:39

Re: K-Type / MAX6675 build in

#40 Post by BertB » 10 Mar 2017, 09:09

No that is not the problem since you can upload and run the firmware.
I think in 120, SPI is not supported. You could try to use the release candidate 147-RC8

mr_sensor
Normal user
Posts: 10
Joined: 08 Mar 2017, 15:47

Re: K-Type / MAX6675 build in

#41 Post by mr_sensor » 10 Mar 2017, 09:41

Ok. Can not find that on Github only the master/ dev branche where is it located? :roll: Sorry I found it while sending this message :) This is the one? http://www.letscontrolit.com/downloads/ ... 47_RC8.zip

BertB
Normal user
Posts: 1049
Joined: 25 Apr 2015, 14:39

Re: K-Type / MAX6675 build in

#42 Post by BertB » 10 Mar 2017, 09:53

yep

mr_sensor
Normal user
Posts: 10
Joined: 08 Mar 2017, 15:47

Re: K-Type / MAX6675 build in

#43 Post by mr_sensor » 10 Mar 2017, 10:00

So I can still use this _P120_Thermocouple.ino sketch?

mr_sensor
Normal user
Posts: 10
Joined: 08 Mar 2017, 15:47

Re: K-Type / MAX6675 build in

#44 Post by mr_sensor » 10 Mar 2017, 10:45

Ok the hardware tab is now showing the SPI part. Give it a try later-on :) Thanks.

Code: Select all

Init SPI:	 (Note : Chip Select (CS) config must be done in the plugin)

mr_sensor
Normal user
Posts: 10
Joined: 08 Mar 2017, 15:47

Re: K-Type / MAX6675 build in

#45 Post by mr_sensor » 10 Mar 2017, 12:07

Must still over-see something I guess. Now I get this:

Code: Select all

34710 : P120 : C : 0.00 - F : 32.00
39714 : P120 : C : nan - F : nan

BertB
Normal user
Posts: 1049
Joined: 25 Apr 2015, 14:39

Re: K-Type / MAX6675 build in

#46 Post by BertB » 10 Mar 2017, 12:41

Which sensor do you have?
Can you measure between t- wire and ground? Is there a connection?
Is the thermocouple not connectoed to other stuff?
I guess you have to do some more research.

mr_sensor
Normal user
Posts: 10
Joined: 08 Mar 2017, 15:47

Re: K-Type / MAX6675 build in

#47 Post by mr_sensor » 10 Mar 2017, 13:52

Now I got it working. I tried an other MAX6675 module and that worked. So the other module might have been broken. :) Nice!

Next part is connecting an display.

W.

nettworker
Normal user
Posts: 10
Joined: 07 Feb 2017, 18:12

Re: K-Type / MAX6675 build in

#48 Post by nettworker » 12 Mar 2017, 10:11

Keep us updated :)
I am working on a standalone Version for mobil use.....

QcVictor
Normal user
Posts: 46
Joined: 23 Feb 2016, 00:47

Re: K-Type / MAX6675 build in

#49 Post by QcVictor » 11 Oct 2017, 21:47

HI Guys
Does he work with ESP Easy Mega ?

Code: Select all

Edit: Yes he works  :D , In the first post I can see reported 2 temperature in the plugin P039 only one is displayed How get the second value ?

dcjona
New user
Posts: 7
Joined: 13 Dec 2017, 14:05

Re: K-Type / MAX6675 build in

#50 Post by dcjona » 09 Jan 2018, 13:43

hello everybody, thanks for the information on this topic.
I try to use the sensor but on esp easy the temperature doesn't change, always 30.5°C .. any info about the refresh ?

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 0 guests