Closed sirLeone closed 5 years ago
Yes the MAIX, MAX31850 zero has ending lifetime some time ago so far i know.
Question:
You are messaure so high temperatures that you need a thermocouple K type?
It is not the solution but there are other very good sensors when you will messaure air or liquid media. Have you ever tried a PT100 or PT1000?
Official there is no I2C breakout board, SPI only, but there are chips and i had done some tests. No official driver yet and no support by tasmota right now.
Possible you are able to write a driver based on the Ladyada stuff for the newer MAX31855?
I would like to make fireplace controler so that i need to measure temps up to let say 400C-600C (sonoff may control fans and air intake valve additionaly) I think that thermocouples K type are so popular and easier to byu that it would be great addition for tasmota for many people.
Unfortunately i am not good at programming and i am afraid that my driver would not be acceptable quality :)
@sirLeone Have ordered now a little breakout board with that MAX31855 and a K-Type sensor for -100...700 degress celsius.
There are a lot of MAX31855 to buy on ALI, Banggood and 5 local stores. So the chip is still there and alive +/'.
Have to wait around two weeks now, then they will be here and i can start to develop it.
Breakout board, with zero point compensation, all the cheaper bords don't have that function: https://nl.aliexpress.com/item/MAX31855-K-Type-Thermokoppel-Breakout-Board-Temperatuurmeting-Module-Voor-Arduno-Groothandel-prijs/32920349240.html?spm=a2g0s.9042311.0.0.27e74c4d00pBEG
@sirLeone Short update for you:
the sensor arrived from china yesterday in the afternoon. and that one is from a very, very good quality so far i have messaured. The shield around the teflon cable looks so good that you can't see any space at all.
the amplifier is still missing because the douane will have 5,-Euro extra tax money. ;-) I got that information yesterday. I hop the AMP arrives this week..
These guys are so s****d there. They think our local system loses money when i order it in China. Right, but no shop has that special amp because the zero point compensation i need. So the import control system is wrong.
Keep fingers crossed for you work !!! :)
Requested from @Tommy-LSA (#4315):
Actually there seems to be no support for MAX6675 (SPI Sensor). Is it possible to get that in? There are no additional libraries needed (beside of SPI) and the code is straight forward, just a few bit operations. Example here https://gist.github.com/sleemanj/059fce7f1b8087edfe7d7ef845a5d881 The Sensor board is very cheap (Aliexpress around $2, thermocouple included)
Reason is to make Tasmota able to measure temperatures far above 100°C to measure temperatures in heaters, ovens, solder stations and react on.
The approach reading both sensors is the same but MAX31855 has an other response than MAX6675. (MAX6675 outputs 12 bits of data. The MAX31855 outputs 14 bits) The bit operation (https://gist.github.com/sleemanj/059fce7f1b8087edfe7d7ef845a5d881) won't work for MAX31855. Instead this have to be used from Adafruit library double _AdafruitMAX31855::readCelsius(void) https://github.com/adafruit/Adafruit-MAX31855-library/blob/master/Adafruit_MAX31855.cpp
Response of MAX31855 is 32bit while response of MAX6675 is 16bit. It's because MAX31855 delivers it's own temperature aditional to the temperature of thermocouple. Also MAX31855 can handle negative temperatures (-270°C-1800°C) while MAX6675 handle 0°C to +700°C
Page 6 is the relevant page on MAX6675 Datasheet http://www.datasheetcatalog.com/datasheets_pdf/M/A/X/6/MAX6675.shtml
Page 10 is the relevant page on MAX31855 Datasheet http://www.datasheetcatalog.com/datasheets_pdf/M/A/X/3/MAX31855.shtml
However, both sensors can be implemented with the same code approach (without additional libraries) and a fork in reading function. Also multiple sensors are possible on same communication gpio's as long each sensor get it's own gpio for CS
I am also interested in this subject. I have the MAX31855 working in Home Assistant via MQTT. However I need to get the right data value to work in the climate component. I think it has something to do with value_template. Thanks in advance for any help.
@LakeCruiser
I have the MAX31855 working
using Tasmota ?
I have ordered both (not received yet) and put the things together in the meantime. Following code is untested but this way both Sensors could be implemented in one module without using any additional library.
`
void setup() { Serial.begin(115200); }
void loop() { // read MAX6675 uint16_t max6675_temp; max6675_temp = readCelsiusMAX6675(MAX6675_CS); Serial.print("MAX6675 Temperature: "); Serial.println(max6675_temp);
// read MAX31855 int32_t max31855_temp; max31855_temp = readCelsiusMAX31855(MAX31855_CS); Serial.print("MAX31855 Temperature: "); Serial.println(max31855_temp); delay(1000); }
double readCelsiusMAX6675(sensor_cs) { uint16_t v; v = spiread16(sensor_cs);
if (v & 0x4){
return NAN;
}
v >>= 3; return v*0.25; }
double readCelsiusMAX31855(sensor_cs) { int32_t v; v = spiread32(sensor_cs);
if (v & 0x7) { return NAN; }
if (v & 0x80000000) { // Negative value, drop the lower 18 bits and explicitly extend sign bits. v = 0xFFFFC000 | ((v >> 18) & 0x00003FFFF); } else { // Positive value, just drop the lower 18 bits. v >>= 18; }
double centigrade = v; // LSB = 0.25 degrees C centigrade *= 0.25; return centigrade; }
uint16_t spiread16(sensor_cs) { int i; uint32_t d = 0;
digitalWrite(sensor_cs, LOW); delay(1); digitalWrite(SPI_SCK, LOW); delay(1);
for (i=15; i>=0; i--) { digitalWrite(SPI_SCK, LOW); delay(1); d <<= 1; if (digitalRead(SPI_SO)) { d |= 1; } digitalWrite(SPI_SCK, HIGH); delay(1); } digitalWrite(sensor_cs, HIGH); //Serial.println(d, HEX); return d; }
uint32_t spiread32(sensor_cs) { int i; uint32_t d = 0;
digitalWrite(sensor_cs, LOW); delay(1); digitalWrite(SPI_SCK, LOW); delay(1);
for (i=31; i>=0; i--) { digitalWrite(SPI_SCK, LOW); delay(1); d <<= 1; if (digitalRead(SPI_SO)) { d |= 1; } digitalWrite(SPI_SCK, HIGH); delay(1); } digitalWrite(sensor_cs, HIGH); //Serial.println(d, HEX); return d; } `
Talk to me! Share details! Please!
@LakeCruiser
I'm asking you. You said in your previous post that you have that working with mqtt. My question is: do you have that working using Tasmota ?
No it is not with Tasmota. It's a modified sketch that I found here. https://github.com/dshokouhi/Home-AssistantConfig/blob/master/arduino/mqtt-smoker-probe-template/mqtt-smoker-probe-template.ino
I converted mine to the MAX31855 dual probe. It is discovered and displayed in Home Assistant but I can't get it to work with climate. I don't know how to share my HA cards or yaml views but I can paste section if you need them.
Sorry that i had done nothing on the driver. Had some really heart health issues. So had to take time and need some more with resting. After taht i will look again in it. If the driver is ready then ican test a lot....
Sorry that i had done nothing on the driver. Had some really heart health issues.
Get well soon and take your time. Health is more important than any driver.
Have anyone tried this library ? https://github.com/SirUli/MAX6675
The chips does not look to be much different.
I am also working on a project to control my fireplace and needed support for a thermocouple sensor that supports high temperatures. The MAX31855 seemed to be a very good solution for my problem so I wrote a driver and filed a PR (#4764). Currently the driver only supports one MAX31855 connected to 3 user configurable pins. Communication is currently only supported via embedded SW SPI (I will add HW-SPI later). I've done tests with a MAX31855 breakout board and a Sonoff Tasmota Basic module (with the new board layout as described in https://github.com/arendst/Sonoff-Tasmota/wiki/Sonoff-Basic). The JSON response includes both temperatures (probe and reference) and the errorcode reported by the chip (TC open, short to GND and short to VCC).
Closing this issue as it the PR made for this request has been merged into development. For reference please see PR https://github.com/arendst/Sonoff-Tasmota/pull/4764
How did you connect Sensor and MAX31855 to Sonoff Basic? Thank you.
Any chance to add support for thermocouple K via MAX31855 (very popular) ? There is already Adafruit library which works also with esp8266 so maybe it wont be a big problem ? https://github.com/adafruit/Adafruit-MAX31855-library
I know that now MAX31850 is supported which is 1-wire thermocouple amplifier but as far as i know it is not produced anymore or at least hard to buy.