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
Sir, can I use a DS 18B20 temperature sensor module, instead of the analog temperature sensors mentioned in the video?
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
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
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.
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
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
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.
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. 😀
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!
@mbogelund Same here with firefox and mint. It appears to be placeholders for the code that was supposed to accompany the article.