Wemos D1 not working with MAX6675

I had an up and running UNO+MAX6675 connecting to Blynk, this weekend i received a Wemos D1 and…
my problems started…
In the end I got my Wemos D1 working in Blynk (with a simple virtual math) but in combination with a MAX6675 the system goes into an error resulting in:
+++++
ets Jan 8 2013,rst cause:4, boot mode:(3,6)
wdt reset
load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v00000000
~ld
+++++
Any ideas how to connect a MAX6675 with a Wemos D1/ESP8266?
Present .ino looks like:

/*
  Single_Temp.pde - Example using the MAX6675 Library.
  Created by Ryan McLaughlin <ryanjmclaughlin@gmail.com>

  This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
  http://creativecommons.org/licenses/by-sa/3.0/
  https://github.com/mcleng/MAX6675-Library
  http://datasheets.maximintegrated.com/en/ds/MAX6675.pdf
  */
#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "pin";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "ssid";
char pass[] = "password";

#include <MAX6675.h>
#include <SPI.h>
// left_2_right: GND - VCC - NCK - CS - SO
int xSO = 6;               // SO pin of MAX6675
int xCS = 5;               // CS pin on MAX6675
int xNCK = 4;              // SCK pin of MAX6675 (variable SCK cannot be used reserved for RTC) 
int xunits = 1;            // Units to readout temp (0 = raw, 1 = ˚C, 2 = ˚F)
float t = 0.00;           // Temperature output variable

// Initialize the MAX6675 Library for our chip
// MAX6675 Library already sets pin modes for MAX6675 chip!
MAX6675 temp(xCS,xSO,xNCK,xunits); //two variations on a theme even tried a different library
// MAX6675 temp(5,6,4,xunits);

void setup() {
  Serial.begin(115200);
  Blynk.begin(auth, ssid, pass);
  t = 0;
}

BLYNK_READ(V21){
  t = temp.read_temp();  // Read the temp from the MAX6675
  Blynk.virtualWrite(V21, t);
  t = t + 0.1;
}

void loop(){
  Blynk.run();
}
1 Like

Show your Blynk with MAX sketch.

https://forum.wemos.cc/topic/324/max-6675-and-d1-mini-can-t-read-temperature might be worth a look.

In principle the Blynk - UNO - W5100 - MAX6675 combination .INO which is working perfectly is not much different from the Wemos version. The main reason why i want to use the Wemos is that I would like to monitor my BBQ while I am slowwwww cooking;). Here is the .INO for the UNO combination as you can see I even try to crasp the concept of handlers:

/*
  Single_Temp.pde - Example using the MAX6675 Library.
  Created by Ryan McLaughlin <ryanjmclaughlin@gmail.com>
  This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
  http://creativecommons.org/licenses/by-sa/3.0/
  https://github.com/mcleng/MAX6675-Library
  http://datasheets.maximintegrated.com/en/ds/MAX6675.pdf
  */

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>
                                
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "pw";

;

#define W5100_CS  10
#define SDCARD_CS 4

#include <MAX6675.h>
// left_2_right: GND - VCC - SCK - CS - SO
int SO = 6;               // SO pin of MAX6675
int CS = 5;               // CS pin on MAX6675
int NCK = 4;              // SCK pin of MAX6675 (variable SCK cannot be used reserved for RTC) 
int units = 1;            // Units to readout temp (0 = raw, 1 = ˚C, 2 = ˚F)
float t = 0.00;           // Temperature output variable

// Initialize the MAX6675 Library for our chip
// MAX6675 Library already sets pin modes for MAX6675 chip!
MAX6675 temp(CS,SO,NCK,units);

void setup() {
  Serial.begin(115200);
  pinMode(SDCARD_CS, OUTPUT);
  digitalWrite(SDCARD_CS, HIGH); // Deselect the SD card

  Blynk.begin(auth);
  // You can also specify server.
  // For more options, see BoardsAndShields/Arduino_Ethernet_Manual example
  //Blynk.begin(auth, "your_server.com", 8442);
  //Blynk.begin(auth, IPAddress(192,168,1,100), 8888);
}
BLYNK_READ(V21){
  t = temp.read_temp();  // Read the temp from the MAX6675
  Blynk.virtualWrite(V21, t);
}
void loop(){
  Blynk.run();
}

Your problem is with an ESP (WeMos) so we need to see the ESP sketch not the Uno sketch.

The Wemos sketch is provided in my initial email; when i comment out the two following lines in the sketch:
MAX6675 temp(xCS,xSO,xNCK,xunits); //two variations on a theme even tried a different library
and
t = temp.read_temp(); // Read the temp from the MAX6675
The sketch runs like a charme and in Blynk it is just increasing virtual V21 with 0.1 every cycle.

@W-J sorry I see the sketch now.

There is no pin 6 on a WeMos. Your probably mean D6, D5 and D4 for xSO, xCS and xNCK.

I never use the screen printed Dx details and use the GPIO numbers as it makes the sketch portable with other ESP’s.

Shout if you don’t know what pins a WeMos has.

1 Like

You make me a happy man, it works! Conclusion I made a classic? newbie error:
int xSO = D6; // SO pin of MAX6675
int xCS = D5; // CS pin on MAX6675
int xSCK = D4; // SCK pin of MAX6675
I should have made my digital pins preceded by a “D”; an error which is tolerated (?) on the UNO.
and for this reason not yet encountered in my steep sketch learning curve :smiley:
Thanks for the gentle push in the right direction.

can share the success coding. I still failed to compile the coding. thank you

This is an old topic. If you have a project you need help with, please create a new topic and supply actual details. Thank you.