Follow Us

A look at various temperature sensors for your Arduino projects

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

DHT11 moduleDHT11 Module with Cable for Diy Kit$0.90
BMP280 sensor BMP280 Digital Barometric Pressure Altitude Sensor $0.60
TMP36 sensorTMP36 sensor$1
LM35D sensorLM35D analog temperature sensor$1.10
LM75 Temperature SensorLM75 Sensor Module Temperature Sensor$0.80
TMP102 Digital Temperature SensorTMP102 Digital Temperature Sensor$1.43
DS18B20 Temperature SensorDS18B20 Temperature Sensor Module$1.01
SHT30 Digital Output Temperature and Humidity SensorSHT30 Digital Output Temperature and Humidity Sensor$2.10
MCP9808 temperature Sensor ModuleMCP9808 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 :


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 :



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 :



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 :



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 :



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 :



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 :


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 :



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 :



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


Selecting an Arduino board and some shields for only $30

I was recently asked to recommend a variety of arduino shields and boards for someone who wished to start learning but with a budget of only $30. Here are the boards and modules that I picked then I will explain some rationale and why I didn’t pick some of the other shields and boards that are available

First of all the boards and shields – all of these come from Aliexpress. i have checked Amazon, Ebay, Banggood, Dx and others and for me in the UK you cannot beat Aliexpress – you may have to wait a few weeks to get the parts, if that’s an issue buy from a local source in your country but you cannot beat the prices that I see. I also did not pick the cheapest price I found and these do not include shipping which is very cheap. Also I did not look for one vendor so these would be multiple deliveries – you can look for a single source if you desired.

I got these for under $25- so a little leeway with shipping and price changes.

UNO R3 MEGA328P CH340 CH340G for Arduino UNO R3 + USB CABLE$2.91Arduino Uno
Rich Shield + IR Remote$5.66Rich Shield
UNO Shield Ethernet Shield$4.58Ethernet Shield
LCD Keypad Shield For Arduino$2.60LCD Keypad Shield
V5 Sensor Shield Expansion Board Shield$2Sensor Shield
Clock Shield$5.24Clock Shield

So there you go, first of all some of the shields I didn’t pick and decisions I made with the list above

I decided to avoid one of the all in one kits that contain breadboards, components and sensors – these kits are good but I wanted a simple and easy experience of simply plugging in a shield to an Arduino without worrying about poor connections, correct polarity of components, reading values of components like resistors and some of the other minor issues that can occur.

We did not pick any shields that required any external components, there are many excellent motor shields but you obviously need a motor and a key thing here – you need an external power supply for the motor. I looked at the relay shield but again without external components. There are prototyping shields you can buy but again you need extra components to fully use these.

I did not select any niche shields – this is a shield for me like a Neopixel shield, MP3 shield or a CANbus shield to name a couple of examples. They are very good but slightly limited in what you can do with them. The MP3 shield ideally needs an SD card and a display for example to make it more useful.

With a limited budget we obviously ruled out any expensive shield – a Yun shield is great but at over $20 its a little costly if you are on a  tight budget.

Arduino Uno

You can pick up an Arduino Uno clone like the one in the image below for under $3, you can obviously pick up a mega for a few extra dollars but I would start with an Uno just to get you up and running.

I have never had a problem with a clone board – this one comes with a USB cable, in case you do not have one.

Rich Shield

In my opinion the best shield for beginners – you can pick up the Uno above and this for under $10 and that would be a great start for learning.

Full of useful components like a DHT11, display, LEDs, buttons, ldr, buzzer and even an EEPROM that you can see in the picture above. A great shield and this one even comes with a  basic IR remote to use the IR receiver.

This is a great shield for a great price

Ethernet Shield

This is the most basic way to connect to the net or set up a basic webserver for controlling sensors. You need a wired network connection but its a very easy shield to use with many examples online and many built into the Arduino IDE

Now you may prefer a wireless shield if you do not have a network connection, in that case there is a CC3000 and ESP8266 shield but these cost a little more

LCD Keypad shield

A nice, basic introduction to working with an LCD. This shield also contains a few buttons that you can use. Many examples online and you can then expand in the future to connect sensors and displays the values on the LCD or upgrade to a more advanced shield.

There are more advanced shields that have TFT displays but these cost a few more dollars and I have had problems with getting libraries to work, the LCD shield is very easy to use

Sensor shield

OK, this is actually only useful if you want to connect external sensors and modules, it makes it easier to connect these using female to female dupont cables

If you don’t plan on ever using other sensors or modules – you will not need this and can remove it from the list

Clock shield

Another shield which is aimed at beginners, this one actually was designed to be a clock/alarm.

As you can see from the image above it contains a few components that are very useful for beginners – a display, buzzer, buttons, ntc thermistor and an RTC. So you can create a few experiments with this shield as well as a clock/alarm or timer



You can see what I picked – I think this is great for beginners and you can complete a good amount of experiments with  an Arduino before you delve into more complex shields, sensors and prototyping.


Arduino and VEML6040 color sensor example

VEML6040 color sensor senses red, green, blue, and white light and incorporates photodiodes, amplifiers, and analog / digital circuits into a single chip using CMOS process.

With the color sensor applied, the brightness, and color temperature of backlight can be adjusted base on ambient light source that makes panel looks more comfortable for end user’s eyes. VEML6040’s adoption of FiltronTM technology achieves the closest ambient light spectral sensitivity to real human eye responses.

VEML6040 provides excellent temperature compensation capability for keeping the output stable under changing temperature. VEML6040’s function are easily operated via the simple command format of I2C (SMBus compatible) interface protocol. VEML6040’s operating voltage ranges from 2.5 V to 3.6 V.



An I2C device



Again we use a library –

This example worked just fine


#include "Wire.h"
#include "veml6040.h"

VEML6040 RGBWSensor;

void setup() {
if(!RGBWSensor.begin()) {
Serial.println("ERROR: couldn't detect the sensor");

* init RGBW sensor with:
* - 320ms integration time
* - auto mode
* - color sensor enable

RGBWSensor.setConfiguration(VEML6040_IT_320MS + VEML6040_AF_AUTO + VEML6040_SD_ENABLE);

Serial.println("Vishay VEML6040 RGBW color sensor auto mode example");
Serial.println("CCT: Correlated color temperature in \260K");
Serial.println("AL: Ambient light in lux");

void loop() {
Serial.print("RED: ");
Serial.print(" GREEN: ");
Serial.print(" BLUE: ");
Serial.print(" WHITE: ");
Serial.print(" CCT: ");
Serial.print(" AL: ");




Open the serial monitor - this is what I saw



VEML6040 Breakout Vishay RGBW Sensor Module


VEML6075 ultraviolet light sensor and Arduino example

The VEML6075 senses UVA and UVB light and incorporates photodiode, amplifiers, and analog / digital circuits into a single chip using a CMOS process. When the UV sensor is applied, it is able to detect UVA and UVB intensity to provide a measure of the signal strength as well as allowing for UVI measurement.

The VEML6075 provides excellent temperature compensation capability for keeping the output stable under changing temperature. VEML6075’s functionality is easily operated via the simple command format of I2C (SMBus compatible) interface protocol. VEML6075’s operating voltage ranges from 1.7 V to 3.6 V.


Shopping List


AmountPart Type
1UNO R3 CH340G/ATmega328P, compatible for Arduino UNO







Again we use a library  –


#include <VEML6075.h>
VEML6075 UV;
void setup()
Serial.begin(38400); //Begin Serial
UV.begin(); //Begin the UV module
void loop()
Serial.print("UVA = ");
Serial.print(UV.GetUVA()); //Get compensated UVA value
Serial.print(" UVB = ");
Serial.println(UV.GetUVB()); //Get compensated UVB value





Open the serial monitor – this is what I saw

UVA = 0.00 UVB = 3.00
UVA = 0.00 UVB = 0.00
UVA = 0.00 UVB = 1.00
UVA = 0.00 UVB = 2.00
UVA = 0.00 UVB = 1.00
UVA = 0.00 UVB = 3.00
UVA = 0.00 UVB = 1.00
UVA = 0.00 UVB = 1.00