Hello,
Very nice, I've the same idea, to use M5Stack as a monitor that works with HomeAssistant and MQTT. I'll take a look at your repo.
Best regards
Hello,
Very nice, I've the same idea, to use M5Stack as a monitor that works with HomeAssistant and MQTT. I'll take a look at your repo.
Best regards
Hello, your prototype board is very usefull, more than the genuine one.
It's possible to order a set from EasyEDA ?
Hello,
thank you for your reply. I'v tried to only use the CS pin and it works, but... yes, there is always a but :-) the results are not very accurate. From the moment a set a brightness in the screen, the values of the temperatures grows.
I try to read the temp in a separate task, but it didn't change anything.
Here is my code
#include "Adafruit_MAX31855.h"
#include <SPI.h>
#include <M5Stack.h>
// Example creating a thermocouple instance with software SPI on any three
// digital IO pins.
#define MAXCS 17
Adafruit_MAX31855 thermocouple(MAXCS);
void task1(void * pvParameters) {
for (;;) {
float avg = 0;
/* Read nbReadToAvg times to make an average of the temp */
for (int i = 0; i < nbReadToAvg; i++) {
float c = thermocouple.readCelsius();
avg = avg + c;
delay(100);
}
avg = avg / nbReadToAvg;
Serial.println(avg);
}
}
void setup() {
Serial.begin(115200);
Serial.print("MOSI=");
Serial.println(MOSI);
Serial.print("MISO=");
Serial.println(MISO);
Serial.print("SCK=");
Serial.println(SCK);
Serial.print("SS=");
Serial.println(SS);
thermocouple.begin();
Serial.print("Internal Temp = ");
Serial.println(thermocouple.readInternal());
while (!Serial) delay(1); // wait for Serial on Leonardo/Zero, etc
Serial.println("MAX31855 Initializing ...");
// M5.Lcd.setTextColor(WHITE, BLACK);
// wait for MAX chip to stabilize
delay(1000);
xTaskCreatePinnedToCore(
task1,
"task1",
4096,
NULL,
1,
NULL,
0
);
Serial.println("M5 begin without LCD");
M5.begin(false, false);
delay(10000);
Serial.println("LCD Start");
M5.Lcd.begin();
for(int j=0;j<100;j++) {
//Serial.printf("Brigthness=%d\n", j);
M5.Lcd.setBrightness(j);
delay(200);
}
//delay(10000);
Serial.println("LCD Shutdown set Brightness to 20");
M5.Lcd.setBrightness(10);
//M5.Lcd.sleep();
M5.Lcd.setTextSize(4);
M5.Lcd.print("test");
M5.update();
}
void loop() {
}
And here is the result :
20.27
20.50
20.35
20.45
20.27
18.52
20.12
20.58
20.42
LCD Start
20.27
18.60
21.55
22.73
21.58
21.77
21.98
20.87
21.40
22.40
21.65
23.60
23.40
24.02
24.48
24.62
24.55
29.67
26.83
25.52
29.15
LCD Shutdown set Brightness to 20
23.48
22.27
22.15
21.50
22.92
20.50
21.67
22.60
21.92
22.12
22.42
Why can see that between the line LCD start and the LCD shutdown, the temperature grows and that why the brightness of the screen is increasing. After the line "LCD Shutdown" the brightness is set to 20 and the value are higher that the values at the beginning but they don't moved.
@reaper7 在 SPI clash between LCD and nRF24L01 中说:
thermocouple.begin();
Thank you for the reply.
Wich pin do you think I have to use for the CS ? No matter wich one ? In the MAX31855 I've 5 pins
If I only initialize the object with the CS, what must I do with the other pins (DO and CLK) ?
Sorry for this question, but I'm a begginer
Thank you @JimiT
Indeed I forgot to include the SPI lib, but unfortunetaly the result isn't good. The values jump between positive and negastives and I do nothing.
Internal Temp = 68.12
Something wrong with thermocouple!
Internal Temp = -111.87
Something wrong with thermocouple!
Internal Temp = 33.75
Something wrong with thermocouple!
Internal Temp = -120.00
C = 1548.50
Internal Temp = 32.63
C = 530.00
Internal Temp = 33.56
Something wrong with thermocouple!
@JimiT You're right. Here is my code and the result when M5 lib is included or not
#include <Adafruit_MAX31855.h>
//#include <M5Stack.h>
// Example creating a thermocouple instance with software SPI on any three digital IO pins.
#define MAXDO 19
#define MAXCS 17
#define MAXCLK 18
Adafruit_MAX31855 thermocouple(MAXCLK, MAXCS, MAXDO);
void setup() {
//M5.begin();
Serial.begin(115200);
Serial.print("Internal Temp = ");
Serial.println(thermocouple.readInternal());
while (!Serial) delay(1); // wait for Serial on Leonardo/Zero, etc
Serial.println("MAX31855 test");
// wait for MAX chip to stabilize
delay(2000);
}
void loop() {
// basic readout test, just print the current temp
Serial.print("Internal Temp = ");
Serial.println(thermocouple.readInternal());
double c = thermocouple.readCelsius();
if (isnan(c)) {
Serial.println("Something wrong with thermocouple!");
} else {
Serial.print("C = ");
Serial.println(c);
}
delay(1000);
//M5.update();
}
And the result is
Internal Temp = 32.50
C = 17.25
Internal Temp = 32.56
C = 15.25
Internal Temp = 32.56
C = 18.25
Internal Temp = 32.50
C = 16.50
Internal Temp = 32.56
C = 17.25
Internal Temp = 32.63
C = 18.50
Internal Temp = 32.56
C = 18.25
Internal Temp = 32.63
But if I uncomment the line 3 lines to include M5 to the projet, the result is:
Internal Temp = 0.00
C = 0.00
Internal Temp = 0.00
C = 0.00
Internal Temp = 0.00
C = 0.00
Internal Temp = 0.00
C = 0.00
Internal Temp = 0.00
C = 0.00
Internal Temp = 0.00
C = 0.00
I think is something about the SPI, but I'm not sure. I try to use other pins but unfortunately unsucessfully
Hello, It seems like I have a problem similaire has yours... I would like to use à MAX6675 to get temperature from a Thermocouple K, but this board use SPI.
When I test my code in a ESP32, it's OK. When I test my code in the M5Stack without the M5.begin(), it's ok, but when I include de M5.begin, the value returned by the MAX6675 are 0
Is there any solution ?