Measuring Temperatu...
 
Notifications
Clear all

Measuring Temperature with Arduino - 5 Sensors

15 Posts
7 Users
2 Reactions
1,886 Views
(@dronebot-workshop)
Workshop Guru Admin
Joined: 5 years ago
Posts: 1111
Topic starter  

Today I’ll show you five different temperature sensors that you can easily use with an Arduino.

Article with code samples: https://dbot.ws/tempsense

We have measured temperature in previous Arduino projects, usually using the trusty DHT11 temperature and humidity sensor. For non-critical applications, it certainly works and has the added advantage of also reading humidity.

But there are many other temperature sensors you can use with an Arduino, all of them fairly inexpensive. Many of these sensors offer improved performance over the DHT22 (and its cousin the DHT11).

Today we'll start with the DHT22 and use an Adafruit library to get it working quickly. Then we’ll move on to some other temperature sensors:

The AM2320, a similar device to the DHT22 that uses the I2C bus to communicate.

The TMP36 and LM35 precision temperature sensors. These devices output a calibrated linear analog voltage to represent temperature.

And a real high-precision sensor, the MCP9808 module from Adafruit.

Here is what you can expect to see today:

00:00 - Introduction
02:18 - DHT22
08:37 - AM2320
13:27- TMP36 & LM35
21:09 - MCP9808

There is an article on the website with the schematics and the code I used, although most of the examples are included with the Adafruit libraries.

"Never trust a computer you can’t throw out a window." — Steve Wozniak


   
Quote
Sumanta
(@sumanta)
Member
Joined: 4 years ago
Posts: 197
 

Sir, can I use a DS 18B20 temperature sensor module, instead of the analog temperature sensors mentioned in the video?


   
ReplyQuote
codecage
(@codecage)
Member Admin
Joined: 5 years ago
Posts: 1046
 

@sumanta

Not using the procedures in the above video.  Although Adafruit has some suggestions on where to fine the libraries you would need to utilize this one-wire digital thermometer.  Adafruit doesn't have a detailed tutorial, but they do have a link to libraries.  Use this link:  Adafruit DS18B20

Read the "Description" and notice the link at the bottom of that to the libraries needed. 

SteveG


   
ReplyQuote
Sumanta
(@sumanta)
Member
Joined: 4 years ago
Posts: 197
 

@codecage

Okay. But my  DS18B20 looks something like this:-

ds18b20 module 800x800

It's not one wired.


   
ReplyQuote
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 

@sumanta

Posted by: @sumanta

@codecage

Okay. But my  DS18B20 looks something like this:-

ds18b20 module 800x800

It's not one wired.

Google is your friend - There are plenty of examples using this sensor.

    ds18b20


   
Sumanta reacted
ReplyQuote
codecage
(@codecage)
Member Admin
Joined: 5 years ago
Posts: 1046
 

@sumanta

But it is considered a 1-wire communications device even though you see 3 pins.  Power, ground, and the 1-wire communications pin.  If you look closely at the link to the Adafruit DS18B20 in my post above you'll see that the cable on that device actually has 3 wires at the end of it.

As @frogandtoad said, Google is your friend.

SteveG


   
ReplyQuote
Sumanta
(@sumanta)
Member
Joined: 4 years ago
Posts: 197
 
Posted by: @codecage

you'll see that the cable on that device actually has 3 wires at the end of it.

Yeah, I saw that. But my sensor has a different look. That's what I want to tell.


   
ReplyQuote
codecage
(@codecage)
Member Admin
Joined: 5 years ago
Posts: 1046
 

@sumanta

OK, I understand what you are trying to tell me now.  If your device is a DS18B20 it is just packaged differently than the one that Adafruit is displaying, but the libraries they are pointing you to are what you may need to work with your device.  The video and instruction that Bill has done will not work for the DS18B20.

SteveG


   
ReplyQuote
TheOutlander
(@theoutlander)
Member
Joined: 4 years ago
Posts: 79
 

After blinking the LED, my first Arduino project was temp sensing with DS18B20 following instructions on Google (our friend). Second project was with DHT11 sensor, same friend helped.

@sumanta you are on the right path. 

"Hardware eventually fails. Software eventually works." - Michael Hartung


   
ReplyQuote
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 

@sumanta

Posted by: @sumanta
Posted by: @codecage

you'll see that the cable on that device actually has 3 wires at the end of it.

Yeah, I saw that. But my sensor has a different look. That's what I want to tell.

As noted by @codecage, there are only three wires, and of those three wires... only one of them is used for the signal.  You can virtually use the code examples and libraries from the link I provided to you earlier.

Cheers.


   
ReplyQuote
Sumanta
(@sumanta)
Member
Joined: 4 years ago
Posts: 197
 

@codecage

Okay. That's what I wanted to confirm. Thanks for the reply. 🙂 


   
ReplyQuote
Sumanta
(@sumanta)
Member
Joined: 4 years ago
Posts: 197
 
Posted by: @theoutlander

After blinking the LED, my first Arduino project was temp sensing with DS18B20 following instructions on Google (our friend). Second project was with DHT11 sensor, same friend helped.

@sumanta you are on the right path. 

@theoutlander These projects are really interesting and fun. 😀 


   
ReplyQuote
Sumanta
(@sumanta)
Member
Joined: 4 years ago
Posts: 197
 

@frogandtoad

Okay. Now I have understood. Thanks for the link. 🙂 


   
ReplyQuote
mbogelund
(@mbogelund)
Member
Joined: 5 years ago
Posts: 24
 

When I look at the article web page accompanying this video, I see some inserted text like the following:

<INSERT DHT_UNIFIED_SENSOR SKETCH>

various places in the article, instead of the referred sketches. I think something is broken in the article. Could you please have a look into this?

My browser is Chrome - Version 88.0.4324.150 (Official Build) (64-bit) - on Ubuntu Linux.

Thanks!

 


   
ReplyQuote
Centari
(@centari)
Member
Joined: 5 years ago
Posts: 44
 

@mbogelund  Same here with firefox and mint.  It appears to be placeholders for the code that was supposed to accompany the article. 


   
mbogelund reacted
ReplyQuote