
Heute zeige ich dir zur Abwechslung mal ein kleineres Projekt. 🙂 Ich nutze in diesem Projekt einen Arduino um verschiedene Temperaturen in meinem 3D-Drucker zu überwachen. Beispielsweise die Treibertemperatur vom Board (X/Y/Extruder), aber auch die Temperatur des Netzteils und Coldend.
Nun gut fangen wir an!
Was du alles Brauchst:
– Arduino
– LCD Display
– Thermistor(en) (hier B3950)
– Widerstände (hier 100K)
– Lochrasterplatine
– JT-Stecker
– Jumper-Kabel
– Lötkolben
– 3D-Drucker um Rahmen zu drucken

Im folgenden Bild befassen wir uns mit dem anschließen des Thermistors. der Thermistor wird an + sowie A0 (Analogeingang) angeschlossen. Zusätzlich schließen wir dann noch den Widerstand parallel zu A0 an GND an.

Ihr könnt nun die Schaltung beliebig erweitern. Ich habe das 4 mal gemacht, da mein LCD 4 Zeilen hat.


Untenstehend findest du den Code für den Arduino. Ich weise ausdrücklich darauf hin das ich mir sämtliche Parameter aus dem Internet zusammengesucht habe und es sicher aus Programmierer-Sicht einfacher zu lösen wäre. Aber gut, es funktioniert und erfüllt seinen Zweck 😀
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd = LiquidCrystal_I2C(0x27, 20, 4);
//in “20, 4” ändern wenn 20x04 benutzt wird
#include <math.h> //loads the more advanced math functions
void setup() { //This function gets called when the Arduino starts
Serial.begin(115200); //This code sets up the Serial port at 115200 baud rate
lcd.init();
lcd.backlight();
delay(250);
//lcd.noBacklight();
//delay(1000);
//lcd.backlight();
// delay(1000);
lcd.setCursor(5, 0); //Position Text
lcd.print("Hypercube"); // Text beim Start
lcd.setCursor(5, 1); //Position Text
lcd.print("Evolution"); // Text beim Start
lcd.setCursor(1, 2); //Position Text
lcd.print("Temp.ueberwachung"); // Text beim Start
delay(5000); //anzeigedauer
lcd.clear();
}
int Thermister(int RawADC) { //Function to perform the fancy math of the Steinhart-Hart equation
double Temp;
Temp = log(((10240000/RawADC) - 10000));
Temp = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * Temp * Temp ))* Temp );
Temp = Temp - 273.15; // Convert Kelvin to Celsius
//Temp = (Temp * 9.0)/ 5.0 + 32.0; // Celsius to Fahrenheit - comment out this line if you need Celsius
return int(round(Temp));
}
void loop() { //This function loops while the arduino is powered
int val; //Create an integer variable
int temp; //Variable to hold a temperature value
val=analogRead(0); //Read the analog port 0 and store the value in val
temp=Thermister(val); //Runs the fancy math on the raw analog value
lcd.setCursor(0, 0);
lcd.print(" Cold-End : "); //Bezeichnung für Sensor eingeben
lcd.print(temp); // Temperaturausgabe
lcd.print("\xDF""C "); // Text hinter temp
//delay(500); //Wait one second before we do it again
val=analogRead(1); //Read the analog port 1 and store the value in val
temp=Thermister(val); //Runs the fancy math on the raw analog value
lcd.setCursor(0, 1);
lcd.print(" Driver XY: "); //Bezeichnung für Sensor eingeben
lcd.print(temp);
lcd.print("\xDF""C "); // Text hinter temp
// delay(500); //Wait one second before we do it again
val=analogRead(2); //Read the analog port 1 and store the value in val
temp=Thermister(val); //Runs the fancy math on the raw analog value
lcd.setCursor(0, 2);
lcd.print(" Extruder : "); //Bezeichnung für Sensor eingeben
lcd.print(temp);
lcd.print("\xDF""C "); // Text hinter temp
//delay(500); //Wait one second before we do it again
val=analogRead(3); //Read the analog port 1 and store the value in val
temp=Thermister(val); //Runs the fancy math on the raw analog value
lcd.setCursor(0, 3);
lcd.print(" Netzteil : "); //Bezeichnung für Sensor eingeben
lcd.print(temp);
lcd.print("\xDF""C "); // Text hinter temp
delay(1000); //Wait one second before we do it again
}
Sollte jemand Lust haben den Code etwas zu verfeinern bzw. zu verbessern, schickt mir einfach ne Mail mit dem Code und ich werde ihn hier aktualisieren.

Fazit nach 1 Monat in Betrieb: die Werte schwanken doch sehr bei dem Aktualisierungsintervall. von 500ms.
– Vielleicht hat jemand einen Tipp wie man den Code so anpassen könnte das er einen Durchschnitt aus den letzten 5 Messwerten nimmt?