hi welcome to an Arduino step-by-step course by Robojax
in this lecture we are going to use bmp 280 barometric pressure and temperature sensor
to display temperature on lcd 1602 and then we are going to use this lcd 204 with 4 lines and
20 character to display the temperature pressure and altitude all in one screen
here is the wiring for bmp280 temperature sensor with lcd-602
because we need to share I square sig ports this a4 and 5 between this temperature sensor and lcd
screen I’m using breadboard the portion of it I’ve cut it so this is the edge of the breadboard a5
have been connected that's scl that's a clock pin have been connected to the side that has red line
and sda have been connected to the other side that has blue line using the blue blue wire and for the
lcd we have connected scl the clock to the clock pin which is this one and sda have been connected
to the sda pin which is connected to a4 for this one as well sda have been connected on that side
scl clock have been connected on this side now this port is shared between these two
and we can have 128 different modules on the same bus this vcc have been connected to 5 volts
and ground have been connected using a black wire to the ground
for this vcc of this module this has been connected to 3.3 volts and ground have been
connected using the orange wire to the ground and let me explain the wiring from a5 I have connected
using this green wire to the side that is red and from a4 using a blue wire I’ve connected it to
this port so this side is now sda and this side is scl or clock for this module when the sensor
is at the top the pins are from the left that is vcc have been connect connected to 3.3 volts
ground is orange have been connected to the ground and this red is connected to clock
on this side and the brown is the sda which have been connected to the blue side
for the lcd black is a ground this has been connected to the ground
white is vcc or 5 volts it has been connected to 5 volts the grays sda have been connected on
this side and the purple is scl or clogged which have been connected on the left side
first connect both modules and
upload this I square c scanner that I have provided you with the link after uploading open it
and as you can see it shows two addresses I know zero seven sixes for this module and now 3f is
this address if you're not sure just disconnect it and you will see that one of them will disappear
and 3f disappear so this address for this one is 3f
I’ve updated the code with 3f let me explain the code now from here this portion has not changed
and I’ve added this section from lcd
and as you can see here the wire have been included there so we remove this wire here which
was from lcd and this is the library for the lcd you have to include it as I have shown you before
and the address that I’ve just scanned have been entered here and I’m using now
16 character and two line the 1602 module we will change it and we will see it with a 2004 as well
inside the setup I have removed the serial monitor information lcd.begin for our lcd this is for the
backlight this is for clear this is the setting the cursor at line zero character zero and this is
to check if the module has started working or initialized if not this means if not
we say lcd print and then we print this error on the lcd and we will keep the system awaiting at
this point if this does not happen then we print bmp to et test this section is initial settings
sampling setting which we do not touch inside the loop because this continuously reads the value we
have to first clear it lcd dot clear this will clear the screen we set the cursor at zero zero
line zero character zero that's character zero line zero and parenthesis
text and this section is responsible for printing the Celsius at this section from here to here
all the Celsius value is printed with this first we set the cursor outline character 0 of line 1
at this point if you forgot that's line 0 that line 1 and we use get temp c this will get the
Celsius this value up to here and then we set the cursor again at using the set cursor we set it at
character five line one that's zero one two three four five and then we print two two three as a
character which will print this degree symbol and then we go to the sex after that and we print c
this section is responsible for printing the Fahrenheit as before I’ve also left one space here
because that was six and now we go to eight that is seven we go to eight
and we print the Fahrenheit then we go to fourteen at this point print the degree symbol and then we
go to 15 and print f and then we wait one second and the loop continues like that
and here is the demonstration of bmp280 temperature sensor and barometric pressure
I apply some heat and as you can see that temperature has increased to 36 the room
temperature is at the moment around 21 degrees it will be decreasing slowly
upright heat gun and as you can see it's 107 with three digits for Fahrenheit and 40 degrees Celsius
the temperature is slowly dropping
now let me explain the code that displays the text on this twenty zero four twenty
character four line the first thing that I did was I updated the I square c
address and I put 20 character for line the rest of the code is exactly the same
and portion of the code is responsible for printing this
temperature in Celsius this line the whole line so we print the text at character 0 line 1
and then we go to the character 13 and print the temperature in Celsius
then we go to character 18 print this degree symbol and then we print c as character 19
character 0 character 90. and this line is responsible for printing the pressure we go line
character 0 line 2 that's 0 1 2 we are in line 2 we print the text at character 10 we print the
pressure this one and we go as character 15 and print pa this portion is responsible for altitude
we go to line 0 and character 0 line 3 we are here and then we print the altitude this text
we go to character 10 and print this altitude and we go to character 15 again and print the m
once again let me apply some heat
and as you can see the temperature increased to 40 and something and decreased back
the pressure is the same
this was how to use bmp bmp280 barometric pressure and temperature sensor with lcds 1602
and 2004 thank you for watching please make sure to subscribe by clicking at the subscribe button
in here thank you thank you for watching tutorial from Robojax if you learned 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 please post it at the comment section below
I try to answer and reply and don't forget subscribe so you get updates on my upcoming videos