[HELP] Controlling temp using Arduino UNO and Thermistor

Hello Folks,

I have these three items:
(1) Arduino UNO
(2) Thermistor (Part Number 104GT-2), Range: -80 to 300 C, 100 Kohm
(3) Resistor - 100 Kohm
(4) 12V, 40W Ceramic Cartridge Heater

I want to use this heater for up to 200 C and measure that temperature using this thermistor. Finally, I want also control the temperature. That means, there will be a pre-set value (say, 150 C) and my Arduino will measure the temperature and when the temp goes down to 150C heater will be activated. Similarly, when temp goes up beyond 150C, heater will be de-activated.

This is just my idea. If anyone has better and simple way to measure & control the temperature please help me.

NB. Please note that my thermistor has resistance of 100 Kohm, not only 10 Kohm. I mention this, because I think 10 kohm version is more common. Early reply would be highly appreciated.

You will need a suitable relay or MOSFET in order to control the heater cartridge.For regulation you can either use on/off regulating or use a PID regulator

Hello nilton61,
Thanks for your reply. Can you please provide me any link on any example or tutorial of using MOSFET/Relay, PID Regulator with Arduino UNO??? Thanks again.

try googling:
arduino temperature controller

Although I personally dislike the use of relays, this would probably be a situation where you'd want to use one. You'll definitely want to upsize the current on it, as if it has any kind of motor on there you'll end up with a current spike every time it turns out. Just a basic search on DigiKey led me to this guy. At $1.50, it will handle up to 10A at 250VAC or at 24VDC.

Activating the relay is as simple as applying 5VDC across the coil and the other side will activate, allowing your heater to turn on.

The thermistor will work to measure temperature but typically I've seen them used as a crude way to limit current in an application. What you would need to do to get a thermistor to work is create a voltage divider and read the voltage across the thermistor. Once you have the voltage, do some math to determine the resistance, and then use the data sheet to map that resistance to a temperature, at which point you can make a decision regarding the heater.

You may be better off with a thermocouple, as instead of changing resistance due to temperature, it will create a very small voltage. Running this voltage through an op-amp would give you a value you could read and again, make a decision regarding the heater.

The PID control that the other poster mentioned refers to a Proportional Integral Derivative controller. While there's nothing inherently wrong with measuring a temperature, turning the heater on if it's too cold, and off if it's too warm, you will run in to issues where you basically turn off and on all of the time to maintain that temperature, and you'll forever oscillate around your desired temperature. With a relay being a mechanical device, you'll eventually burn it out(not for a long long time, but it will burn out eventually).

PID control is essentially a way of using calculus to dampen that oscillation and allow the temperature controller to behave less erratically. Unfortunately, I've seen it utilized in LabVIEW before, however I'm not quite sure off of the top of my head to perform an integral or derivative in Arduino C(I'm sure it's possible, it's just too late for me to be trying to think that through). You can read more about it here, and maybe somebody out there has done PID with arduino before, I'm just not able to say one way or another.

Long story short, it all depends on you and the scope of your project. If it's something where you're trying to warm your van or whatever in the winter, I'd say throw a relay and thermistor on it and forget any kind of fancy control system and call it a day. If you're trying to incubate a chicken egg(or whatever) and accurate temperature is more of a necessity, well of a sudden the straight on off system doesn't look so good, and you'll want something slightly more accurate than a thermistor.

Hello Mastrofski,
Thank you very much for your reply. I have used and successfully measured the temperature using 104GT-2 thermistor. So, the measurement part is okay now.

And, this is about the extruder of 3D printing, so I need good control on temperature. Now I plan to use MOSFET to control (on/off) the cartridge heater and PID to get desired temperature.

I have explored the Arduino PID library page, this blog on PID and some others. But still I have few confusion and hope someone can help me resolve the issues.
(1). "PID controller" is just a program/sketch. Not a hardware. Am I right?
(2). If I am right about above question, then I only need to buy a suitable MOSFET. Isn't it?

I also need the spec of MOSFET for my case. I see someone has used "IRLML0030 N-Channel MOSFETs" here. Do I need any "MOSFET Driver" like TC4427 FET driver?

FYI, my temperature will be in the range of 230C. And my thermistor can measure between -80C to 300C. And my cartridge heater runs at 12VDC, 40W.

Eagerly waiting for suggestions please. Thank you very much.

Correct. A PID is merely a process to control a particular system, in your case temperature controller. It can be used for many applications and implemented in many different ways(Like I mentioned in my previous post, I've seen it utilized in LabVIEW). In your situation, it will just be a function or library or whatever that you'll be using.

Unfortunately, my MOSFET skills are lacking, I wasn't the most attentive student when my devices course was going over them., and some of their properties always confused me That being said, this link seems to have a pretty straightforward schematic for them. Since you're using it,it seems like it'd be pretty easily implemented. Particularly, the fourth diagram down regarding a switch controlling a lamp seems to be of interest. Your Vin would be a simple matter of writing a pin High and Low, and your load would be attached as in the circuit.

That being said, I just opened up Horowitz and Hill's The Art of Electronics, and they have the same type of configuration. Attach the ground of your load to the drain, ground the source, and then apply a voltage to the gate.

As far as sizing the FET, you'll need something that can handle the current draw of your heater. As a rough estimate, it's pulling about 4 Amps, but bear in mind that any inductive load will pull more inrush current.(eg. if it has a blower, you'll need to upsize it, if it's just a resistive heater, there's not as much cause of concern). At any rate, I'd recommend getting a FET that will handle 5A(25% over current draw), but if there's a negligible price difference between going higher, definitely go higher(personally I'd just go with 10A so I could breathe easy all the time). You'll also need to make sure that the VGS will switch with a 5v signal.

Unfortunately I'm not familiar enough with the FETs you listed to speak intelligently, but hopefully I've provided enough guidance where you can steer yourself in the right direction.

EDIT:
I saw this thread on the forums and thought that it may help with your situation.