Gracias EGRAL, un gusto
Estoy basicamente intentando leer temperatura con el siguiente codigo para implementarlo en el PID. pero no logro que lea correctamente.
Este codigo pertenece a ELECTRONOOBS
Algo tengo mal en el codigo o en la conexieon
/* Max6675 Module ==> Arduino
-
CS ==> D10
-
SO ==> D12
-
SCK ==> D13
-
Vcc ==> Vcc (5v)
-
Gnd ==> Gnd */
//LCD config
#include <Wire.h>#include <LiquidCrystal_I2C.h> //If you don't have the LiquidCrystal_I2C library, download it and install itLiquidCrystal_I2C lcd(0x27,20,4); //sometimes the adress is not 0x3f. Change to 0x27 if it dosn't work.
/* i2c LCD Module ==> Arduino
-
SCL ==> A5
-
SDA ==> A4
-
Vcc ==> Vcc (5v)
-
Gnd ==> Gnd */
#include <SPI.h>
#define MAX6675_CS 10#define MAX6675_SO 12#define MAX6675_SCK 13
void setup() {lcd.init();lcd.backlight();
// Serial.begin (9600);}
void loop() {float temperature_read = readThermocouple();lcd.setCursor(0,0);lcd.print("TEMPERATURE");lcd.setCursor(7,1);lcd.print(temperature_read,1);delay(1000);
//Serial.print(temperature_read);// Serial.println("ºC");}
double readThermocouple() {
uint16_t v;pinMode(MAX6675_CS, OUTPUT);pinMode(MAX6675_SO, INPUT);pinMode(MAX6675_SCK, OUTPUT);
digitalWrite(MAX6675_CS, LOW);delay(1);
// Serial.print(v);// Serial.println("ºC");
// Read in 16 bits,// 15 = 0 always// 14..2 = 0.25 degree counts MSB First// 2 = 1 if thermocouple is open circuit// 1..0 = uninteresting status
v >>= 3;v |= shiftIn(MAX6675_SO, MAX6675_SCK, MSBFIRST);
digitalWrite(MAX6675_CS, HIGH);if (v & 0x4)
{// Bit 2 indicates if the thermocouple is disconnectedreturn NAN;}
// The lower three bits (0,1,2) are discarded status bitsv >>= 3;
// The remaining bits are the number of 0.25 degree (C) countsreturn v*0.25;}
Saludos
En martes, 2 de septiembre de 2025, 14:55:16 GMT-3, ENGRAL via Arduino Forum notifications@arduino.discoursemail.com escribió:
| ENGRALSeptember 2 |
Hola @elmogote
Aquí te copio un video que puede ser de tu interés:
Registro de temperatura con termopar K, MAX6675, OLED y ESP32 (Micropython)