I have used many temperature sensors in my time using Arduino’s and other microcontrollers, in this article let's look at some of the options that are available, we will also have links to example code or articles of the sensors we have picked out.
This is a table of the sensors that we will cover
Name | Link | Cost |
DHT11 module | DHT11 Module with Cable for Diy Kit | $0.90 |
BMP280 sensor | BMP280 Digital Barometric Pressure Altitude Sensor | $0.60 |
TMP36 sensor | TMP36 sensor | $1 |
LM35D sensor | LM35D analog temperature sensor | $1.10 |
LM75 Temperature Sensor | LM75 Sensor Module Temperature Sensor | $0.80 |
TMP102 Digital Temperature Sensor | TMP102 Digital Temperature Sensor | $1.43 |
DS18B20 Temperature Sensor | DS18B20 Temperature Sensor Module | $1.01 |
SHT30 Digital Output Temperature and Humidity Sensor | SHT30 Digital Output Temperature and Humidity Sensor | $2.10 |
MCP9808 temperature Sensor Module | MCP9808 temperature Sensor Module | $1.78 |
Now let’s look at the sensors
DHT11 and DHT22 and others
These are very common sensors made by Aosong, there is very good support for them with a few libraries and examples available for them online. There are several variations some add an I2C interface on the end, some are in different cases and there are other slight differences between them. Quite a slow sensor to use in the fact that you need to give it a couple of seconds between readings, I’ve also found it to be not quite as accurate as others but it is low cost with the DHT11 coming in at $0.55
Example : http://www.arduinolearning.com/learning/basics/dht11-sensor-example.php
BMP180 and BMP280 and others
I could have added the evergreen BM085 in here as well as others, these sensors by Bosch Sensortech also have the added bonus of being able to measure barometic pressure and altitude. There are many shields, modules, libraries and examples for these sensors and they are easy to work with and reliable. You can still get the BMP085 and BMP180 online although they are not recommended for new designs they still work well. The prices vary and you can pick up a BMP180 for only $0.40 (yep, you read that correctly)
Examples : http://www.arduinolearning.com/code/bmp180-barometric-pressure-sensor-example.php
TMP36
An analog sensor with a wide range of operating voltage ranges between 2.7 and 5.5 making it ideal for many microcontrollers and its easy to use simply requiring 5v, Gnd and an analog pin with your arduino. You read in this analog value and withs imple calculations you can work out the temperature. A sensor will cost about $0.80
Example : http://www.arduinolearning.com/code/arduino-tmp36-example.php
LM35
A bit like the TMP 36 but its a little cheaper and has better accuracy . This is an analog temperature sensor which is calibrated in celsius, its easy to use with plenty of code examples available. The device can measure negative temperatures but that means that you will need to be able to read negative voltages. It has a wider operating voltage range than the TMP36 and it also has slightly better accuracy. You can pick up a module for about $1, an individual sensor will cost you slightly less
Example : http://www.arduinolearning.com/code/lm35-temperature-sensor.php
LM75
Another I2C temperature sensor that has a readily available module and there are libraries available for the arduino making it easy to work with. It can be powered from 3 to 5.5v and the address system means that 8 devices can be connected by setting a specific address to the chip. You can get a module for $0.80, so another excellent low cost option.
Example : http://www.arduinolearning.com/code/arduino-lm75-temperature-sensor-example.php
TMP102
The tmp102 is another common sensor but be careful as this one is 1.4 to 3.6v powered, don’t connect 5v to this. This does mean you may need to use a level convertor with the sensor, we typically buy a module as the part is difficult to work with otherwise as its a SOT563 package. This is priced around the $1.40 mark or lower
Example : http://www.arduinolearning.com/code/arduino-and-tmp102-digital-sensor-example.php
DS18B20
This sensor works slightly different from some of the others on the list as it is a one-wire interface. This means that only needs one data wire to communicate with an arduino or other microcontroller. Each device has a unique serial number which means in theory you can connect multiple devices to an Arduino and refer to them via the serial number which is useful for temperature monitoring systems say indoors or outdoors. You can get a simple module for under $1 and there is also a version which has leads attached and is in the format of a waterproof probe
Example : http://www.arduinolearning.com/learning/basics/ds18b20-temperature-sensor.php
SHT21 and SHT30 and others
The SHT family by sensiron is a commonly used collection of temperature and humidity sensors, one of the most commonly used is the SHT30. Again these devices are easy to use with very good library support, code examples and simple little modules for the Arduino. One of these will cost you about $1.80. Other members of the family like the SHT21 are also common and like the newer SHT31 they work just as well with an abundance of resources online, its up to you which you pick you will struggle to see any real performance difference.
Example : http://www.arduinolearning.com/code/arduino-sht31-module.php
MCP9808
Another temperature sensor that will not break the bank is the MCP9808 by microchip it can measure temperatures between -20°C and +100°C with ±0.5°C accuracy, you can power this from 2.7 to 5.5v meaning a wide range of microcontrollers can use this device and not just an Arduino, which is handy if like me you use a wide range of them. Again there are several libraries and examples available online and the sensor comes in at under $0.80 for a module
Example : http://www.arduinolearning.com/code/mcp9808-digital-temperature-sensor-example.php
Conclusion
There are many sensors available, there are quite a few I haven’t even touched on in this article that we have examples for on this website but I would plump for the following two
SHT30 – This gives you temperature and also humidity readings at a good price and I have tested this with many microcontrollers and had no problems, the SHT21 also works just as well.
BMP280 – This sensor gives you barometic pressure and altitude as well and I have tested this again on multiple microcontrollers and it works fine. If you have a BMP180 module or want to buy one of them that is OK as well, you will not see any difference.
For my usage I have never really had any issue with readings from these, the accuracy is more than adequate for my needs