The beauty of choice, but with it brings complexity and confusion.
There are several choices of temperature sensors available to the average consumer but which is right for your project and whats the difference between these sensors?
Well that’s what I hope to explain in this article. Lets start with a very general overview of the different types of temperature sensors that will be discussed here.
Thermistors – Available in NTC and PTC which will be discussed further in depth later in this article. These are very simplistic and fairly accurate sensors. They are cheap and very small which makes them great for getting into tight spaces. The code to use them is fairly simplistic once you find the math formula its just copy and paste.
Analog Sensor – Simple to interface and fairly accurate, cheaper than digital sensors but larger than thermistors.
Digital Sensor – 100% accurate but complex to interface with, if you don’t understand I2C or whichever bus communication protocol it relies on then this sensor can be very difficult to interface but the payoff is accuracy and the ability to interface multiple sensors on just 1 wire because each has a unique address. The specific amount of sensors that can be used on 1 wire is dependent on the manufacturer.
Thermistors are available in NTC and PTC configurations, think of this as positive and negative thermistors, one style will require a negative pull down resistor and will be read by the positive output while the other will require a positive pull up resistor and will be read by the negative output. The only benefit to using one style over the other is one may be easier to integrate into your project.
There are a few simply thermistor formulas floating around the net and your thermistor might require a little bit of tweaking to the math, I have noticed that certain batches have required a little tweaking to the math.
Arduino Playground includes some great code and a diagram used for interfacing Thermistors.
Thermistors are also available in different Ohm ratings just like a resistor since they are nothing more than a resistor that changes based on temperature, the most common is a 10k Thermistor and this is the value I often use. The different in values will determine how accurate the Thermistor is for a given temperature range, so if you plan to read temperatures close to room temperature (70 degress F) then you will like want a 10K Thermistor, if you plan to read temperatures closer to freezing you may want a different value.
Analog Temperature Sensors – I find these sensors to be much more accurate and easier to code. The biggest downsize compared to a Thermistor is the size, or price if size isn’t a concern for you.
Adafruit has a great article on interfacing an analog sensor and includes a diagram for wiring purposes which is incredibly easy to wire.
Here is another great article with plenty of pictures and schematics
Digital Temperature Sensors – Last on our list is the digital sensor, there are some common sensors such as the DS18B20 which uses a 1-wire interface. Most sensors will use the I2C bus to communicate with the microcontroller or sensors made by Dallas (Now Maxim) use the proprietary 1-Wire interface. This can be frustrating to get working for someone who is new to using bus communications.
The biggest benefit to using this type of sensor is the accuracy and the ability to add multiple sensors to 1 wire and easily gather a reading from a specific sensor.
The biggest downside to this sensor is the cost, they are often 2-3 times the cost of an analog sensor and several times the cost of a thermistor.
Here is a great guide to using the DS18B20 Temp Sensor with an Arduino, it includes diagrams and code.
Here is an article specifically on the 1-Wire interface bus from the Arduino Playground website
A couple other great references are the Arduino Wire Library page
And the main Playground page that covers interfacing with many types of hardware, sometimes you can get lucky and find your exact piece of hardware with working code examples and diagrams.