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


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


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

<p>Thanks. Nice project.</p><p>Please put in the designation and values of all used parts to the parts list.</p><p>I have not found at least the values of the temp sensors.</p><p>Perhaps they are the 10k/100k resistors included with 3D printer extruder.</p><p>Right?</p><p>What is the Onewire.h library included for?</p>
<p>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.</p>
<p>Hi,</p><p>for a number of thermistors their tables can be found here:</p><p><a href="https://searchcode.com/codesearch/view/100150731/" rel="nofollow">https://searchcode.com/codesearch/view/100150731/</a></p><p>Please another pointer: what are P1 and P2 connected to?</p><p>Would you make the complete schematic of the whole unit please?</p><p>I'v walked trough the f*** Eagle schematic the code and your video.</p><p>Probably can build the unit now. But it could have been a little less hard ;-)</p>
<p>I have shortended and commented the code a little.</p><p>The single channel version:</p><p>CODE</p><p>// 2-Punkt-Temperaturregler fuer 3D Drucker (Extruder/Bed) mit LCD</p><p>// mit Potis einstellbare Werte fuer Temperatur(en) und Hysterese</p><p>// Ein-Aus-Schaltung der Heizung(en) mit Relais</p><p>// ADC1 Thermistor Eingang</p><p>// ADC2 Thermistor Eingang</p><p>// ADC3 Table-Temperatur Sollwert</p><p>// ACD4 Temperatur-Hysterese Wert</p><p>// ADC5 Extruder-Temperatur Sollwert</p><p>#include &lt;LiquidCrystal.h&gt;</p><p>#define THERMISTOR_1_PIN 2 // Thermistor1-Eingang</p><p>#define NUMTEMPS1 20</p><p>LiquidCrystal lcd(2, 3, 4, 5, 6, 7); // LCD, Daten im 4-Bit Modus + 2*Steuersignal</p><p>byte degr[8] = { // &quot;Grad&quot;-Zeichen fuer das LCD definieren</p><p> 0b01110,</p><p> 0b10001,</p><p> 0b10001,</p><p> 0b01110,</p><p> 0b00000,</p><p> 0b00000,</p><p> 0b00000,</p><p> 0b00000</p><p>};</p><p>int hysterese = 0; // Datentyp und Startwert setzen</p><p>int pot1 = 0; // Datentyp und Startwert setzen</p><p>// Temperatur-Tabelle fuer den Thermistor </p><p>// andere Werte-Tabellen hier: <a href="https://searchcode.com/codesearch/view/100150731/" rel="nofollow"> https://searchcode.com/codesearch/view/100150731/</a></p><p>short temptable1[NUMTEMPS1][2] = { </p><p> {1, 841},</p><p> {54, 255},</p><p> {107, 209},</p><p> {160, 184},</p><p> {213, 166},</p><p> {266, 153},</p><p> {319, 142},</p><p> {372, 132},</p><p> {425, 124},</p><p> {478, 116},</p><p> {531, 108},</p><p> {584, 101},</p><p> {637, 93},</p><p> {690, 86},</p><p> {743, 78},</p><p> {796, 70},</p><p> {849, 61},</p><p> {902, 50},</p><p> {955, 34},</p><p> {1008, 3}</p><p>};</p><p>void setup()</p><p>{</p><p> pinMode(9, OUTPUT); // PB1, Relais Steuerleitung auf Ausgang setzen</p><p> pinMode(8,OUTPUT); // PB0, Relais Steuerleitung auf Ausgang setzen</p><p> lcd.createChar(0, degr); // Grad-Zeichen definieren </p><p> lcd.begin(16, 2);// LCD initialisieren mit Anzahl der Zeilen und Spalten des verwendeten LCD</p><p>}</p><p>void loop() // Hauptprogramm</p><p>{</p><p> pot1 = analogRead(A5); // Spannung vom Poti &quot;Temperatur&quot; einlesen</p><p> pot1 = map(pot1, 0, 1023, 0, 255); // Werte-Bereich umsetzen</p><p> hysterese = analogRead(A4); // Spannung vom Poti &quot;Hysterese&quot; einlesen</p><p> hysterese = map(hysterese, 0, 1023, 0, 9); // Werte-Bereich umsetzen</p><p> int rawvalue1 = analogRead(THERMISTOR_1_PIN); // Thermistor , Spannung am Eingang ADC1 lesen</p><p> int celsius1 = read_temp1();</p><p> lcd.setCursor(0,0); // Temperatur Istwert an LCD senden</p><p> lcd.print(&quot;Istwert: &quot;);</p><p> lcd.print(celsius1);</p><p> lcd.print ((char)0);</p><p> lcd.print(&quot;C&quot;);</p><p> lcd.setCursor(14,0); // Wert fuer Hysterese an LCD senden</p><p> lcd.print(&quot;H&quot;);</p><p> lcd.print (Hysterese);</p><p> lcd.setCursor(0,1); // Temperatur Sollwert an LCD senden</p><p> lcd.print(&quot;Sollwert: &quot;);</p><p> lcd.print(pot1);</p><p> lcd.print ((char)0);</p><p> lcd.print(&quot;C&quot;);</p><p> delay(50);// Verz&ouml;gerung 50ms fuer Anzeige</p><p> if (pot1 &lt; 100){// Position fuer Cursor korrigieren</p><p> lcd.setCursor(12,1);</p><p> lcd.print(&quot; &quot;);</p><p> }</p><p> else{}</p><p> if (pot1 &lt; 10){// Position fuer Cursor korrigieren</p><p> lcd.setCursor(11,1);</p><p> lcd.print(&quot; &quot;);</p><p> }</p><p> else{}</p><p> if (celsius1 &lt; 100){// Position fuer Cursor korrigieren</p><p> lcd.setCursor(9,0);</p><p> lcd.print(&quot; &quot;);</p><p> }</p><p> else{}</p><p> if (celsius1 &lt; 10){// Position fuer Cursor korrigieren</p><p> lcd.setCursor(8,0);</p><p> lcd.print(&quot; &quot;);</p><p> }</p><p> else{}</p><p> if (pot1 &gt; celsius1 + (hysterese/2)){// Heizung-Relais einschalten</p><p> digitalWrite(8,HIGH);</p><p> }</p><p> else{}</p><p> if (pot1 &lt; celsius1 - (hysterese/2)){// Heizung-Relais ausschalten</p><p> digitalWrite(8,LOW);</p><p> }</p><p> else{}</p><p>}</p><p>int read_temp1()// Subroutine read_temp1</p><p>{</p><p> int rawtemp1 = analogRead(THERMISTOR_1_PIN);</p><p> int current_celsius1 = 0;</p><p> byte i;</p><p> for (i=1; i&lt;NUMTEMPS1; i++)</p><p> {</p><p> if (temptable1[i][0] &gt; rawtemp1)</p><p> {</p><p> 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]);</p><p> if (realtemp1 &gt; 255)</p><p> realtemp1 = 255;</p><p> current_celsius1 = realtemp1;</p><p> break;</p><p> }</p><p> }</p><p> if (i == NUMTEMPS1)</p><p> current_celsius1 = 0;</p><p> return current_celsius1;</p><p>}</p>
<p>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,&quot;Full 2 Channel Thermostat Eagle.pdf &quot;. So about program, I know it isn't perfect, I am not good programmer but working pretty well:)</p>
<p>It's nice having some spare pins for later use, isn't it?</p><p>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.</p><p>Folks, have a merry christmas and a happy new year.</p><p>Keep hacking.</p>
<p>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. </p>
<p>I am using diy cnc machine. It is unfortunately small machine but working pretty good.</p>
<p>Cool..! it looks like pro</p>
<p>Thanks :)</p>

About This Instructable




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:Wooden Wolf Paw Pendant, Keychain or Wall Decoration 3D Printer - Working Area 40x40x40cm Your Own Branding Iron 
Add instructable to: