Hi, welcome to another video tutorial from Robojax. my name is Ahmad Shamshiri.
In this tutorial we are going to learn how we can use this lm35, 3 pin
temperature sensor and display the temperature as Celsius Fahrenheit and
Kelivn on the LCD 1602 or LCD2004 using arduino. you can get the code for this by
clicking on the link below the video in the description which will take you to
www.Robojax.com/learn/arduino let's get started with this.
Presenting this tutorial from Canada
I've separate video introducing this lm35 with full detail on a specification
and how to use it and I have also separate video showing how to use this
LCD1602 or 2004 with just four wire because it has this I2C module
so make sure to use this separately download the library and make sure that
you are able to display a text on this. after that then run the code for this
and make sure that you are able to read the temperature and displayed on the
serial monitor. after that we are combining this
together. many time people ask question and I say I'm getting this error and it
seems that they have skipped the video so please watch this video follow the
instruction install the library and after this one then this will work fine.
Wiring Explained
now let me explain the wiring. the left end of lm35 is connected to pin 2 where
we have defined it as extra 5V inside the code you can change it you
can select any other pin you want. the metal pin is the output using green wire
it has been connected to analog 0 A0 and the right pin is a ground it has been
connected to the ground. for the LCD module we have four wires this pin from
this side it is ground that has been connected to ground of Arduino. the
second pin is VCC it has been connected using white wire to 5 volts. then we have
SDA using grey wire have been connected to analog A4 and SCL is connected
the last pin using this purple wire to analog 5 A5.
you can also connect it to this SDA and SCL accordingly. if you need the wiring
diagram for this it is available as part of my arduino course at udemy.com if you
want to learn arduino i have a best seller course on Udemy where you can
learn Arduino from ground up with hundreds of projects all course material
library codes wiring diagram everything available in one place the link for my
Arduino course is below this video in the description.
Code explained
now let me explain the code we are defining analog zero as an input pin and
then we are defining pin 2 for extra VCC (5V) for lm35 because we have only one
five volts and I did not want to use a breadboard. and then this 1,000
iterations is for then the same as the introduction video which takes 1000
measurement and gets it gives the average and this a lintel if i factor is
the 10mV/°C Celsius do not change it. this portion is for LCD
screen and this is the class of library and we are taking the class create an an
object called LCD and this is a I2C address for this module we
are passing it and if you don't know it here is how you get it. I will
provide you the code with I2C scanner this is a code I will provide
you just put it on a sketch upload it to the Arduino and then open
the serial monitor then you will read it if the wiring
everything is ok you will be able to see the I2C address. and it will
continuously print that for you. so that is 0X26 that is why I am using that
and 16 means 16 character and 2 means 2 line because here we have 1 2 3 up to 16
characters and we have 2 lines and that is the sample here either as Kelvin
Celsius or Fahrenheit. and I've given it two seconds before printing Fahrenheit.
at the same way this is a temperature this is assemble and you must pass it
inside a single code with capital C capital F or Fahrenheit and capital K
for Kelvin. and if you want to take some action based on temperature so this is
giving you the temperature and feel safe and you want to say F the temperature is
greater than 87 degrees do something so this is the opening and closing
for the condition and whatever action you want to take put it in here like
turning on a relay or fan or something so you can do the action here. if you
need the full explanation of this code it is available as part of my Arduino
course at udemy.com.
Demonstration
now let me demonstrate it now this is showing the room temperatures and I'm
using this heat gun to apply some heat on this
so the compressor is increasing have weakened future 55
and now it will cool down slowly 83 degrees and slowing down perfectly
working currently a live connected to five volts but let me connect it to 3.3
volts and see if it works so when I remove it it will read incorrect value
or zero so now I'm connecting it to 3.3 volts and let's see what we are reading
so still it's working. But manufacturer suggests that should be
connected to minimum of 4V. but still we are reading value I don't know
how accurate is when you connect it and 3.3 volts for that reason corrected to 5
volts
I would like to thank my Patrons from Patreon.com
Subtitle typed and corrected by Ahmad Shamshiri in Canada on July 21, 2020
I did my part to help you learn. Now it's your turn.
You can subscribe to my channel, thumb up 👍 the video and say "thank you" in the comment section.
The link to my PayPal account is below this video if you want to send me chase donation. Thank you.
thank you for watching the force how to use the lm35 with its CD 1602 to display
it and Celsius Fahrenheit and Kelvin if you learn something and found this
useful please thumb up 👍 as this will help my video in the search algorithm of
YouTube. if you have comment or question posted a comment section below I try to
answer and reply if you want to get updates of my upcoming videos make sure
to subscribe.
Extra Clips
value you have
if you want to learn Arduino I have a best seller course on udemy where you
can learn our dinner from ground up with hundreds of projects all course material
library codes wiring diagram everything available in one place the rain for
marina courses below this video in the description
capital C capital F or Fahrenheit and capital K for Kelvin and if you want to