# Temperature With Max6675

**URL:** <https://discourse.nodered.org/t/temperature-with-max6675/608>\
**Category:** General\
**Created:** [4 June 2018 18:28 UTC](https://discourse.nodered.org/t/temperature-with-max6675/608 "2018-06-04T18:28:03Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![MarcoGaspar](https://avatars.discourse-cdn.com/v4/letter/m/e36b37/32.png) [@MarcoGaspar](https://discourse.nodered.org/u/MarcoGaspar)\
**Post date:** [4 June 2018 18:28 UTC](https://discourse.nodered.org/t/temperature-with-max6675/608/1 "2018-06-04T18:28:03Z")

</div>

Hello,

It’s possible to have Temperature With Max6675 in node-red?

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [4 June 2018 19:17 UTC](https://discourse.nodered.org/t/temperature-with-max6675/608/2 "2018-06-04T19:17:37Z")

</div>

Can you tell us a little more about your system? What interface does the Max6675 have?

---

<div class="post-metadata">

**Author:** ![MarcoGaspar](https://avatars.discourse-cdn.com/v4/letter/m/e36b37/32.png) [@MarcoGaspar](https://discourse.nodered.org/u/MarcoGaspar)\
**Post date:** [4 June 2018 19:41 UTC](https://discourse.nodered.org/t/temperature-with-max6675/608/3 "2018-06-04T19:41:18Z")

</div>

Actualy i use max6675 with arduino.

> **[adafruit/MAX6675-library](https://github.com/adafruit/MAX6675-library)**
>
> Arduino library for interfacing with MAX6675 thermocouple amplifier - adafruit/MAX6675-library

  

> **[MAX6675.pdf](https://datasheets.maximintegrated.com/en/ds/MAX6675.pdf)**
>
> 513.08 KB

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [4 June 2018 19:47 UTC](https://discourse.nodered.org/t/temperature-with-max6675/608/4 "2018-06-04T19:47:56Z")

</div>

If you want to send the data to the Pi, I would use MQTT. Put a broker on the Pi and then set up the arduino to publish the date and in node-red, subscribe to the topic and you are good to go.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [4 June 2018 19:51 UTC](https://discourse.nodered.org/t/temperature-with-max6675/608/5 "2018-06-04T19:51:02Z")

</div>

No need for the Arduino… - interesting thread here - including useful tips on wiring etc…  
[https://www.raspberrypi.org/forums/viewtopic.php?t=145568](https://www.raspberrypi.org/forums/viewtopic.php?t=145568)

---

<div class="post-metadata">

**Author:** ![MarcoGaspar](https://avatars.discourse-cdn.com/v4/letter/m/e36b37/32.png) [@MarcoGaspar](https://discourse.nodered.org/u/MarcoGaspar)\
**Post date:** [4 June 2018 21:00 UTC](https://discourse.nodered.org/t/temperature-with-max6675/608/6 "2018-06-04T21:00:28Z")

</div>

I already have max6675 working with pi but it’s possible to use it with node-red?

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [4 June 2018 23:22 UTC](https://discourse.nodered.org/t/temperature-with-max6675/608/7 "2018-06-04T23:22:42Z")

</div>

Well, first off just try calling the python program using an exec node (or the node-red-node-daemon may be better if its a long running program)

Otherwise you are probably into raw SPI code which some nodes may support but probably a steep curve.

---

<div class="post-metadata">

**Author:** ![Golimar89](https://avatars.discourse-cdn.com/v4/letter/g/e19b73/32.png) [@Golimar89](https://discourse.nodered.org/u/Golimar89)\
**Post date:** [24 October 2018 17:06 UTC](https://discourse.nodered.org/t/temperature-with-max6675/608/8 "2018-10-24T17:06:51Z")

</div>

Hey guys,

I have a C++ Code for reading the Max6675 Module. Now I like to use the wiring Pi libary in Node Red, what exists there, and changed the code into javascript. But still there are some errors in the code. Maybe with the help with you guys we can build a function node to use this code to read out the Max6675.

The C+ code is based on the follow link:  
[http://www.bristolwatch.com/rpi/geany.htm](http://www.bristolwatch.com/rpi/geany.htm)

My actual code in node red function is: (Comments are in German sry for that)

// MAX6675.c liest die Temperatur des Thermoelemnts Typ K aus

// Hier sind die verbundenen PIN-Anschlüsse einzutragen  
// nach WiringPi Labelling, für Bild siehe Anleitung  
var CLK = 14  
var DBIT = 13 // SO  
var CS = 10

//Einzubindene Bibliotheken für die Kommunikation mit dem Pi

var wpi = require('wiring-pi');

// Methoden zur Temperaturmessung deklariert  
var start = 0;  
var SENSOR\_VALUE = 0;  
var Ctemp, Ftemp;

function main() {

while(start \< 3) {

if (wpi.wiringPiSetup () == -1) //Zugriff auf die Bibliothek wiringPi  
exit (1) ;

wpi.pinMode(CLK, OUTPUT); // Deklarierung des In- bzw. Outputs  
wpi.pinMode(DBIT, INPUT); // der einzelnen Variablen bzw. Pins  
wpi.pinMode(CS, OUTPUT);

wpi.digitalWrite(CS, HIGH); // mit High wird der Wert auf 1 gesetzt  
wpi.digitalWrite(CLK, LOW); // mit Low wird der Wert auf 0 gesetzt

SENSOR\_VALUE = Thermal\_Couple\_Read();  
if (SENSOR\_VALUE == -1) {  
printf ("No sensor connected. \n");  
}  
else {

```
printf ("Wert %d: ", start+1);
printf ("S= %d;", SENSOR_VALUE);
Ctemp = SENSOR_VALUE * 0.25; //Umrechnungswert in Grad Temperatur
printf ("C= %4.2f; ", Ctemp);
Ftemp = (Ctemp * 9 / 5) + 32; //Umrechnung in Fahrenheit
printf ("F= %4.2f; \n", Ftemp);

```

}  
delay(10000), // In Millisekunden angegeben, also 10 Sekunden warten  
start++; // Inkrementiert den start wert

}

return 0;  
}

function Thermal\_Couple\_Read() {

var value = 0;  
// init Sensor  
wpi.digitalWrite(CS, LOW);  
delay(2);  
wpi.digitalWrite(CS, HIGH);  
delay(200);

/\* Liest den Chip aus und gibt den Rohtemperaturwert wieder  
Stellt den CS Pinausgang auf 0 und

- erlaubt die Auslesung des Konvertierungsprozesses\*/

wpi.digitalWrite(CS, LOW);  
/\* Bit 15 ist wirkungslos, daher wird dieser übergangen\*/  
wpi.digitalWrite(CLK, HIGH);  
// delay(1);  
wpi.digitalWrite(CLK, LOW);

/\*  
Liest die Bits 14-3 vom MAX6675 für die Temperatur  
Schleife zum Lesen der einzelnen Bits  
und Speichern des finalen Wertes \*/

var i;  
for (i = 14; i \>= 0; i--) {  
wpi.digitalWrite(CLK, HIGH);  
// delay(1);  
value += digitalRead(DBIT) \<\< i;  
wpi.digitalWrite(CLK, LOW);  
}

// Überprüfen ob der Bit D2 auf 0 oder 1 ist, wenn 1 dann kein Sensor  
if ((value & 0x04) == 0x04) return -1;  
// Ausgabe des Endwertes  
return value \>\> 3;  
}
