Introduction: 2-Channel Thermostat 0-255°C

Picture of 2-Channel Thermostat 0-255°C

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

Picture of 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

Picture of 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

Picture of Soldering Time

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

Step 5: Programming

Picture of 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

Picture of 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

Picture of Assembly Everything Together

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

Step 8:

Picture of

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 :)

Comments

peter__s (author)2016-12-20

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?

Thomas Workshop (author)peter__s2016-12-20

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.

peter__s (author)Thomas Workshop2016-12-20

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 ;-)

peter__s (author)peter__s2016-12-20

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;

}

Thomas Workshop (author)peter__s2016-12-21

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:)

peter__s (author)Thomas Workshop2016-12-21

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.

Maxamed Jaamac (author)2016-12-17

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.

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

AXR AMAR (author)2016-12-14

Cool..! it looks like pro

Thomas Workshop (author)AXR AMAR2016-12-15

Thanks :)

About This Instructable

2,693views

58favorites

License:

Bio: Hello. My name is Thomas. I love to spend time in my workshop. Please check my Youtube channel. I hope you enjoy :)
More by Thomas Workshop:Fidget Spinner - Wrench Spinner Fidget Spinner - Wrench SpinnerWooden Wolf Paw Pendant, Keychain or Wall Decoration
Add instructable to: