Do you want to find the right sensor for your DIY project based on the Arduino microcontroller? Well, finding the right sensor requires research and to facilitate this process, you’ll find all the info you need in this article. But if there’s one thing better in the DIY culture than theory it’s practice.
Temperature sensors are widely used to sense the temperature in an environment. They all function in a similar way, but have slightly different features. Based on these features, I’ll walk you through the best practice of choosing the right temperature sensor for your project with an Arduino microcontroller.
Whether you are already a champion of measuring the temperature and just want a little more information, or you are interested in digging deep into the Arduino temperature monitoring space, these 11 temperature sensors should cover all types of temperature sensors used in robotics and automation.
Temperature sensors comparison of numbers: DS18B20, LM35DZ, DHT11, Thermocouple Type-K, MLX90614, LM75, SHT15, TMP100, RHT03, TPA81, D6T MEMS
Because it matters what kind of project you’re looking for, I hope to have something listed that could help you:
fire fighting robot able to determine the source of fire and take action;
a mobile robot able to detect to monitor the temperature and send data via Bluetooth or Wi-Fi to a server and view the temperature details on a smartphone or a tablet;
a wireless sensor network in your home to take decisions and controls the heating and air conditioning unit;
an alarm system that senses the presence of a human;
Temperature sensors for hobbyists
The temperature sensors for hobbyists are cheap compared to the sensors on average, but they serve the same purpose – reading the temperature. Well, none of these sensors can eat the sun, but are ideal for homemade robotics and automation applications because they are easy to interface, accurate, and has a fast response time. After you place your finger on it, immediately the output of the sensor starts to rise.
In this section of the article, I’ll examine deeply the features, price, how to interface the sensor and the best applications for each sensor.
Temperature sensors for hobbyists (DS18B20, LM35DZ, TMP100, DHT11, RHT03 (DHT22), LM75)
The DS18B20 is a cheap digital temperature sensor with a price of only $3.95. The sensor is used in a wide variety of hobbyist applications for both beginner and others that are more experienced.
This sensor has 1-wire interface, which means that require only one pin to communicate with the microcontroller. More than that, it is designed with a unique serial number that allows you to interface more sensors on the same data bus.
The accuracy of the measurements is high because the sensor does not depend on the accuracy of the microcontroller to measure the analog signal. And because this sensor has a digital output, you will not get any signal degradation even over long distances.
The sensor is used in a large variety of applications including temperature sensing and monitoring robot, air temperature monitors, etc.
Note: The DS18B20 has a waterproof version designed to measure the temperature in wet condition. This sensor is jacketed with PVC, and all you know about interface and specifications remains the same.
This tutorial shows you how to wire the sensor with an Arduino UNO board and read the temperatures detected by the sensor. In the sketch is called the DallasTemperture library that helps you to use this sensor very easy: Arduino – One Wire Digital Temperature Sensor – DS18B20.
Sometimes I don’t believe that we can buy sensors at a price lower than a coffee. The LM35DZ is probably the cheapest temperature sensor in the DIY community. It has a price of only $1.57.
The sensor is calibrated directly in Celsius degrees, and the only functional mode is the analog output directly proportional to temperature.
This is the ideal sensor for Arduino projects because it can be powered directly with 5V from the Arduino’s power pin and has only three pins (one pin is for analog output and two for power supply).
With a sealed circuit, the sensor cannot be subjected to oxidation and is often used to measure the water temperature accurately. In general, the sensor is used for simple projects to display on an LCD the current temperature to advanced robots able to detect the fire in a room, warehouse or a forest.
In this tutorial, you find the scheme of the circuit with the circuit connection and the Arduino sketch to display the temperature detected by the sensor in Celsius and Fahrenheit degrees. To explore more the LM35DZ features, the Instructables user HarshV shows you how to build an automatic cooling system.
The TMP100 has three features that make it one of the best temperature sensors for DIY projects. The first feature is that the sensor supports an input voltage of 2.7V to 5.5V, which is opposed to the TMP102 sensor that needed an input voltage between 1.4V and 3.6V. The second feature is the two address pins that allow you to control up to eight sensors on a single I2C bus. The third important feature is its waterproof property that made it good to read the temperature in damp or dry location. Also, the sensor can be mounted on a horizontal deck or upside down.
When it leaves the Texas Instruments factory, the sensor is a tiny and compact chip that looks like a spider with six legs. To work more easily with the TMP100 sensor, I recommend you to use a breakout board. The DFRobot small breakout board with a built-in TMP100 sensor is a good option at a price of $11.55.
The same online store shows you in a tutorial how to interface the TMP100 breakout board with an Arduino clone and read the temperature detected.
At a price of $5.33, the DHT11 has cost/performance advantages and is a relatively cheap sensor to measure the temperature and humidity. It’s a sensor with an excellent quality but with a real downside since you can read the digital signal once every 2 seconds.
Otherwise, it’s fairly simple to embed the sensor in your project and to monitor the surrounding air.
The DHT sensor has two versions: DHT11 and DHT22. Both sensors are very good to measure the temperature and humidity, but the characteristics are different.
In comparison with DHT11, the DHT22 is good to measure the temperature from -40 to 125°C and has a higher accuracy than DHT11. But even it cannot read a large range of temperature, the DHT11 is smaller and less expensive than DTH22.
In this tutorial, you find information how to wire the sensor, install the DHT11 library and display on Arduino’s Serial Monitor the values generated by the sensor.
From reading to displaying the temperature on an LCD screen is a matter of minutes. If you want to try something other than a simple reading temperature application, you can try a system to check the temperature and humidity of a room and display the values recorded on an LCD display and a web page.
5. RHT03 (DHT22)
RHT03 (also known as SHT22) is a digital temperature and humidity sensor that comes calibrated and doesn’t require additional components to monitor the air in a room or warehouse. The sensor is easy to use with any Arduino microcontroller and has a price of $9.95.
Compared with its little brother DHT11, the DHT22 is more accurate and can read the temperature and humidity more than once every second or two.
This tutorial shows you every detail to interface and display the humidity and temperature recorded by the sensor.
LM75 is another very cheap digital sensor with a price of only $2.21. This sensor has two important features: it is inexpensive and designed as an I2C temperature chip.
The sensor is a surface mount device, and you need to solder wires onto it. It is a good sensor for hobbyists and students to learn how to monitor the temperature.
In this guide, you find an Arduino sketch to display the temperature recorded by the sensor.
Temperature sensors for automation & process control
Temperature sensors for automation and process control are expensive compared to hobbyists and temperature sensors on average, and are usually used to monitor the temperature in environments with great fluctuations or for precise data logging.
In this section of the article, I’ll examine deeply the features, applications and how to use each temperature sensor (SHT15, Thermocouple Type-K) for automation and process control with the Arduino microcontroller.
Temperature sensors for automation & process control (SHT15, Thermocouple Type-K)
SHT15 is a precise humidity and temperature sensor designed to work in environments with greater fluctuation in humidity and temperature. At a price of$41.95 on Robotshop, the sensor comes fully calibrated and with 2-wire digital interface.
In this tutorial, you will learn how to get the temperature and humidity recorded by the sensor.
8. THERMOCOUPLE TYPE-K
Most of the temperature sensors from this article cannot reach higher temperatures than 125 C degrees. The Thermocouple Type-K is different and works on higher operating temperature than most sensors.
Considering its features, it is expected to cost more than any other sensor. The truth is that the thermocouple is a simple combination of two sensitive metals and has a price of only $9.95.
It has a simple digital 2-wire interface and measure no more than 1 meter (around 3 feet). The sensor requires an amplifier such as MAX31855 that output a digital signal to the Arduino microcontroller.
Together with an Arduino board, the Type-K sensor can be used to measure the temperature in heaters and boilers, HVAC systems, etc.
The Adafruit tutorial shows you how to wire the Thermocouple with the MAX31855 amplifier and display the temperature detected by the sensor.
Temperature sensors for projects with special needs
DS18B20, TMP100, or DHT11 are usually a good option if you want to monitor the temperature in a room or outside in a forest and make you happy with your project. But what if you want to detect the movement or the number of persons in a room? In this category enters three of the special temperature sensors.
All the sensors included in this section of the article are used in special projects because works different and measure the temperature different from what we already know about classic temperature sensors.
Temperature sensors for projects with special needs (MLX90614ESF, TPA81, D6T MEMS)
The MLX90614ESF sensor senses the temperature by sending infrared light to remote objects. Because the sensor sends infrared waves, it can sense the temperature of an object without touching them physically. With a price of $19.95, the sensor is simple to use, has good accuracy and high resolution.
The sensor is designed for a wide range of applications and especially when is required to measure the temperature over a 90-degree field of view.
Communication with the MLX90614 is achieved through two methods of output: PWM and SMBus.
Here is an example demonstrating the use of MLX90614ESF sensor. It creates a basic application that allows you to view the infrared sensors at work.
The infrared sensor with built-in lens, paired with increasingly sophisticated module to measure the temperature of eight adjacent points simultaneously, could be capable of some very interesting things.
You can set it to detect the heat of a human body or a candle flame at a range of 2 meters (around 6 feet).
The sensor has a price of $105.44 and communicates with a development system through the I2C interface.
This tutorial covers the hardware and software setup required to connect the TPA81 sensor with a microcontroller. The sensor makes possible the temperature detection in a large variety of applications including the NAO humanoid robot that uses the TPA81 thermal sensor to detect the heat source.
11. D6T MEMS
Maybe you want something to happen when nobody’s home or you walk into a room, like to have the lights turned off or on. Operating on the infrared waves, you can see the DT6 sensor as the logical next step for monitoring an area, security or safety monitoring.
This little smarter sensor can count the number of people in a room, even if none of them moves.
The sensor has a price of $49.88 and communicates with the Arduino microcontroller via an I2C interface.
This PDF file will show you how to get the measurement values from the infrared sensor.
Not all temperature sensors are created equal and sometimes they can read high or low temperatures. If you don’t really know if it’s a sensor failure, you have to check below the most common failure mode of a temperature sensor.
1. Sensor heated by the electronics This is probably one of the most common errors when you use a sensor to monitor or detect the temperature. If the sensor is heated by the electronics, the sensor will not report the correct temperature. First step is to localize the heating or move the sensor outside the enclosure.
2. Library error When you use the Arduino to measure the temperature from the sensor, in the Arduino sketch is called a library compatible with the sensor. You have to be sure that the library from the sketch is the one that support the sensor type.
3. Temperature exceeds the max temperature This is one of the worst scenarios for a system that measure the temperature. Usually, the manufacturer writes in the datasheet of the sensor what happens if the temperature exceeds the maximum temperature supported by the sensor. In the worst case, when your sensor reached the maximum temperature, your chip might take an internal damage or might melt.
Tips: Always is good to choose a sensor that can support all the temperatures assumed to be measured. All the sensors explored in this article usually are more accurate when the temperature reaches the values from the middle of the range.
4. Correct conversion between Celsius and Fahrenheit You need to make the right conversion between Celsius to Fahrenheit or Fahrenheit to Celsius. In the datasheet from the manufacturer, you find the sensor information regarding measurements.
5. Heat conducted along the wire If your sensor is in contact with a wire, the wire can conduct a surprising amount of heat. The contact between the wire and sensor can be an issue, especially when you monitor the temperature along pipes.
6. Condensation in the morning Condensation in the morning can destroy your project or your expectations regarding the temperature measurements. The condensation appears in every morning when warm moist air meets the cooler dry air. In this case, the water vapors can condense on electronics in the same way it does on grass. Therefore, if you think that your project is exposed to condensation, you have to use materials that keep water vapor condensation from being a problem.