2-Channel Thermostat 0-255°C

3,135

59

10

About: Hello. My name is Thomas. I love spending time in my workshop. Please check my Youtube channel. I hope you enjoy :)

Hello everyone, in this project I wanna show you how to make 2-Channel Thermostat. This project is based on Atmega 328P(Arduino Uno). My thermostat can measure temperature from 0 to 255 °C on 2 separate channels. In the future I am gonna convert my cnc machine to 3dprinter and use this thermostat to control temperatute of the extruder and the table.

I made video and step by step instruction how to make it.

So, let's go to work :)

Materials:

- Electrocnic parts
- Enclosure box
- Arduino
- Circuit board blanks

Tools:

- Soldering iron
- Tin
- Pliers
- Drill

Step 1: Watch the Video

Video will give you a good overview on how to create such a 2-Channel Thermostat. But the following steps will still contain some extra useful information.

Step 2: About Schematic

Schematic in eagle and pdf file you can download below.
How you can see Thermostat is based on Atmega 328P that same is used in Arduino Uno. Temperature is read from 100K thermistor (0-255°C) . There are 2 thermistors and 2 relays for heaters. Additionally I made two 12V outputs and two free outputs pins from aduino. This pins you can use to make any change in schematic. To power thermostat I used 12v transformer. To control thermostat I made 3 potentiometrs. Two to set temperatures and 1 to adjust hysteresis (from 0 to 9 °C). To set and read all values I used 16x2 LCD blue display.

Step 3: Make PCB

First you have to make PCB board. Template in Pdf and Eagle files to download in previous step. To make pcb I used toner transfer method. It is very easy and gives very good results. When excess of copper is removed, just drill the holes.

Step 4: Soldering Time

Now solder all electronic components to PCB and control board is ready :)

Step 5: Programming

Time to code. To move code to Atmega use this tutorial created by Arduino. I made 2 types of code. First 2-channel thermostat with hysteresis, and second only 1-channel with hysteresis. You can download code below.

Step 6: Encloser Box

To make front panel of box I used cnc machine. There are potentiometers, switches, display, leds and output connector.

Step 7: Assembly Everything Together

Now assembly all parts together. Connect wires. Attach transformer and relays. Screw pcb to bottom of box.

Step 8:

Now your 2-Channel Thermostat is completely finished :)


You did it!


Please subscribe my Youtube channel for more projects :)

Thomas Workshop Youtube channel


If you have any questions leave a comment below :)

Share

    Recommendations

    • Big and Small Contest

      Big and Small Contest
    • First Time Author

      First Time Author
    • Toys Contest

      Toys Contest

    10 Discussions

    0
    None
    peter__s

    1 year ago

    Thanks. Nice project.

    Please put in the designation and values of all used parts to the parts list.

    I have not found at least the values of the temp sensors.

    Perhaps they are the 10k/100k resistors included with 3D printer extruder.

    Right?

    What is the Onewire.h library included for?

    5 replies
    0
    None
    Thomas Workshoppeter__s

    Reply 1 year ago

    I upgraded parts lists. Yes this is a 100K thermistor that same like in 3d printer extruder. You are right Onewire.h library is completely unnecessary, I just forgot to delete this line.

    0
    None
    peter__sThomas Workshop

    Reply 1 year ago

    Hi,

    for a number of thermistors their tables can be found here:

    https://searchcode.com/codesearch/view/100150731/

    Please another pointer: what are P1 and P2 connected to?

    Would you make the complete schematic of the whole unit please?

    I'v walked trough the f*** Eagle schematic the code and your video.

    Probably can build the unit now. But it could have been a little less hard ;-)

    0
    None
    peter__speter__s

    Reply 1 year ago

    I have shortended and commented the code a little.

    The single channel version:

    CODE

    // 2-Punkt-Temperaturregler fuer 3D Drucker (Extruder/Bed) mit LCD

    // mit Potis einstellbare Werte fuer Temperatur(en) und Hysterese

    // Ein-Aus-Schaltung der Heizung(en) mit Relais

    // ADC1 Thermistor Eingang

    // ADC2 Thermistor Eingang

    // ADC3 Table-Temperatur Sollwert

    // ACD4 Temperatur-Hysterese Wert

    // ADC5 Extruder-Temperatur Sollwert

    #include <LiquidCrystal.h>

    #define THERMISTOR_1_PIN 2 // Thermistor1-Eingang

    #define NUMTEMPS1 20

    LiquidCrystal lcd(2, 3, 4, 5, 6, 7); // LCD, Daten im 4-Bit Modus + 2*Steuersignal

    byte degr[8] = { // "Grad"-Zeichen fuer das LCD definieren

    0b01110,

    0b10001,

    0b10001,

    0b01110,

    0b00000,

    0b00000,

    0b00000,

    0b00000

    };

    int hysterese = 0; // Datentyp und Startwert setzen

    int pot1 = 0; // Datentyp und Startwert setzen

    // Temperatur-Tabelle fuer den Thermistor

    // andere Werte-Tabellen hier: https://searchcode.com/codesearch/view/100150731/

    short temptable1[NUMTEMPS1][2] = {

    {1, 841},

    {54, 255},

    {107, 209},

    {160, 184},

    {213, 166},

    {266, 153},

    {319, 142},

    {372, 132},

    {425, 124},

    {478, 116},

    {531, 108},

    {584, 101},

    {637, 93},

    {690, 86},

    {743, 78},

    {796, 70},

    {849, 61},

    {902, 50},

    {955, 34},

    {1008, 3}

    };

    void setup()

    {

    pinMode(9, OUTPUT); // PB1, Relais Steuerleitung auf Ausgang setzen

    pinMode(8,OUTPUT); // PB0, Relais Steuerleitung auf Ausgang setzen

    lcd.createChar(0, degr); // Grad-Zeichen definieren

    lcd.begin(16, 2);// LCD initialisieren mit Anzahl der Zeilen und Spalten des verwendeten LCD

    }

    void loop() // Hauptprogramm

    {

    pot1 = analogRead(A5); // Spannung vom Poti "Temperatur" einlesen

    pot1 = map(pot1, 0, 1023, 0, 255); // Werte-Bereich umsetzen

    hysterese = analogRead(A4); // Spannung vom Poti "Hysterese" einlesen

    hysterese = map(hysterese, 0, 1023, 0, 9); // Werte-Bereich umsetzen

    int rawvalue1 = analogRead(THERMISTOR_1_PIN); // Thermistor , Spannung am Eingang ADC1 lesen

    int celsius1 = read_temp1();

    lcd.setCursor(0,0); // Temperatur Istwert an LCD senden

    lcd.print("Istwert: ");

    lcd.print(celsius1);

    lcd.print ((char)0);

    lcd.print("C");

    lcd.setCursor(14,0); // Wert fuer Hysterese an LCD senden

    lcd.print("H");

    lcd.print (Hysterese);

    lcd.setCursor(0,1); // Temperatur Sollwert an LCD senden

    lcd.print("Sollwert: ");

    lcd.print(pot1);

    lcd.print ((char)0);

    lcd.print("C");

    delay(50);// Verzögerung 50ms fuer Anzeige

    if (pot1 < 100){// Position fuer Cursor korrigieren

    lcd.setCursor(12,1);

    lcd.print(" ");

    }

    else{}

    if (pot1 < 10){// Position fuer Cursor korrigieren

    lcd.setCursor(11,1);

    lcd.print(" ");

    }

    else{}

    if (celsius1 < 100){// Position fuer Cursor korrigieren

    lcd.setCursor(9,0);

    lcd.print(" ");

    }

    else{}

    if (celsius1 < 10){// Position fuer Cursor korrigieren

    lcd.setCursor(8,0);

    lcd.print(" ");

    }

    else{}

    if (pot1 > celsius1 + (hysterese/2)){// Heizung-Relais einschalten

    digitalWrite(8,HIGH);

    }

    else{}

    if (pot1 < celsius1 - (hysterese/2)){// Heizung-Relais ausschalten

    digitalWrite(8,LOW);

    }

    else{}

    }

    int read_temp1()// Subroutine read_temp1

    {

    int rawtemp1 = analogRead(THERMISTOR_1_PIN);

    int current_celsius1 = 0;

    byte i;

    for (i=1; i<NUMTEMPS1; i++)

    {

    if (temptable1[i][0] > rawtemp1)

    {

    int realtemp1 = temptable1[i-1][1] + (rawtemp1 - temptable1[i-1][0]) * (temptable1[i][1] - temptable1[i-1][1]) / (temptable1[i][0] - temptable1[i-1][0]);

    if (realtemp1 > 255)

    realtemp1 = 255;

    current_celsius1 = realtemp1;

    break;

    }

    }

    if (i == NUMTEMPS1)

    current_celsius1 = 0;

    return current_celsius1;

    }

    0
    None
    Thomas Workshoppeter__s

    Reply 1 year ago

    P1 and P2 are totally free pins. I made them becouse maybe someone will change something in schematic and will need some pins. I drew all electronic connections in my thermostat: Step 2,"Full 2 Channel Thermostat Eagle.pdf ". So about program, I know it isn't perfect, I am not good programmer but working pretty well:)

    0
    None
    peter__sThomas Workshop

    Reply 1 year ago

    It's nice having some spare pins for later use, isn't it?

    Regarding the CODE. If desired I could change the comments using english language. But these days it so easy asking Google for a translation. Anyway, if one really needs it drop me a line.

    Folks, have a merry christmas and a happy new year.

    Keep hacking.

    0
    None
    Maxamed Jaamac

    2 years ago

    nice project with detailed instruction! What type of CNC machine are you using? just curious about cuz it seemed small. Thanks for sharing the project.

    1 reply

    I am using diy cnc machine. It is unfortunately small machine but working pretty good.