Okay, now we have here the code that will the call okay, our downloaded library, uh liquid, crystal display and then from that we try to configure this slave address here and then the columns specifically on our lcd and then the rows and then the lcd init, the Initialization for the lcds we have said, and then the backlight to have a backlight on our lcd to set the cursor uh for this printing, so zero, zero, meaning the top uh left corner of our lcd would be that uh, the cursor or the starting point where It would be printing, okay, this hello world and then next one uh we try to set at the second row now this engineering part and then the lcd, the scroll is the useful function on our display with a certain delay of 100 milliseconds. So here is the output you will expect, since this is a mirror image on our camera, you will expect um from you will expect a different scrolling. Okay. However, the concept is there: okay, so, as you can see hello world and then part that is scrolling from left to right, based on my perspective, of course, okay, so uh continuing with this presentation example so lets try to use the to use now the temperature sensor, The dht22, so i have here the dht22 that we have discussed on our uh pass lecture. So this one is a temperature and then a humidity sensor with a four pins in it.

So we will be um on. As being said on our past presentation, we have just utilized the screen monitor to to know okay, what is the temperature and then the humidity of ambient or the environment uh? I am currently here now, okay, so with that we will be displaying that one on our lcd. So here is the connection. So, as you can see, we have now utilize it the connection for sda and then scl sda, specifically for um a4 and then scl is for a5, as shown on our past presentation. Okay, this one okay. So, as you can see, scl a5 sda a4 sda, a4 scl, a5. Okay, so we can. We have an option actually to utilize the this portion of our um, i arduino, are of our arduino were in at the last part that will become scl and then the second one will be the sda. So you can utilize that one. However, in this presentation uh just to make it a point that we can make use of another analog pins lets say, for example, you uh – you have utilized that one on another slave device, so you can use another analog pins here, uh now, just to demonstrate that We can use either this pins okay, as shown on this past presentation, this one, so we can use either distance or in the spin. Okay, depending on your microcontroller either one could be be utilized on your uh i2c communication.

So connect your arduino in the following manner. With the dht22, together with your um lcd display, as shown okay, so basically, the connection is a very straight forward, the same in connection with our previous one adhd22 and then the same again with the connection with respect to our hardware part on our i2c um lcd. The only difference is that, of course, on the software part okay uh were in, we will be integrating both of these both of the programming and then source codes. Is that on the hardware part this here, of course, the five volt supply and then the ground? Okay. So here is the code, so allow me to copy it initially and then we will be try. We will be explaining that one later on, okay, uh, creating another file and then copying Music, ctrl t to justify our coding and then press upload. Okay. Now it is important to have to watch our presentation about the adhd, since you will be including, of course, your library under the hd, as shown here. Okay, so basically to explain that code. We call our functions: okay, the lcd crystal i2c, and then we set our address as 3d6. This is important thats. Why we examine first the hardware part if it is soldered or on the softwares part, so just checked and then just run the code that i have presented the while back. So that will do it and then of course, this one just change this one into 16 by um two, since we will be using a 16 by okay and then another one uh.

This one is for the data pin for dht22 the same as we uh that we have used on our past presentation, uh, creating the issue calling that function. We open serial communication at 9, 600 votes the same, alright, the same rate as our software and hardware. We initialize the lcd, then the backlight, as shown here now we will be reading. Okay, this one is a function, the hd the 322, if you are using now um dht11 version earlier version of this one hd20. The adhd 22 is much accurate compared to the ht11. So the uh, the the solution, is that you need to change this one into 21, adhd.321 a2 to facilitate the connections. Okay and then the temperature also called the temperature and then the humidity with the following function: serial that creates just to verify on our serial monitor and then to counter check on the output of the lcd control check on the output of the lcd. This one is the following: syntaxes set the horizon at the beginning: okay, the upper left most part based on my perspective, and then we have just uh count. Okay, this, since we printed at our, we had printed here: okay, uh top uh top left, so just count. So that we can print the temperature so, as you can see zero one, two, three four five for the space and then six to incorporate the output for the um temperature. Next, one: okay, um we set now the uh.

This one xdf is the syntax for the degrees part: okay, the uh, the superscript uh, somehow zero on the degrees part of the temperature, so the degree celsius this one is syntax under the lcd, then for the c just count another. Since we are to expect an output of four okay from starting six, that will become ten major space and then that will become the um, the degree celsius now, okay and then next one we set the zero but the second row. We will be uh. We are done now with the first row. We have to proceed with the second row now the humidity just count another so zero, one, two, three, four, five: six for the space c7. We just input the output of our humidity and then we will expect to have the uh four for the numbers under the humidity plus one for the percentage, so basically seven plus um five that will become twelve okay for the percent. Okay, so thats it. So let us examine the output now first by a serial, monitor so tools and then uh serial monitor control shift m, so the output will be um temperature of 31 0.6 degrees celsius. The immediate is 78.50, so in our press presentation ive just not included the from the calculation from degrees to fahrenheit. I have stick on the uh coding in the degree celsius itself so now to verify the 31.6 and then the humidity, as shown here 78.

So you can easily see at the small screen the show as shown or allow me to stop this shading. So, as you can see, the temperature now is 31.70 degrees. The humidity is Music. 50 um. Sorry is 78. Okay, 78 percent, as shown here now again, if you want to uh utilize another um Music, just to counter check okay uh, if you want to utilize another uh, useful functions that we have learned from here. If you want to have a course over okay, you can include that one okay, you can display horizontal by simply uh, including lcd, that blink on your code. Okay, however, based on our application, it is enough that we can see the temperature when the ubds is okay. We do not want to scroll that one okay, however, it will depend upon your application. Okay, so, aside of you, we have discussed about the concept of interfacing a 16×2 adapter i2c lcd with a microcontroller controller, wherein we talked about the advantage of using the i2c lcd. Basically, the standard 16×2 character lcd requires us to have at least 12 connections, so that will equivalent to at least 12 wires of connection okay, so that is, we can consume a lot of digital, okay or analog pins, that we can gpio general purpose, input and output. Pins that we can utilize on other applications on our microcontroller and then to solve that one as a solution, we introduced the i2c adapter okay, we have incorporated that one at the back, a of our lcd so that we can facilitate the parallel communication into serial communication.

The drawbacks that it is much slower at least 12 times lower than the conventional standard lcd, but this that is not a problem on our application that we have presented to you now. It is not worthy to uh to tell you that that parallel communication is of course much faster okay to facilitate. Since, for example, you have the eight wires here, the transmitter and then it wires here at the receiver. Eight bits will be transmitted, so you can transmit it one simultaneously. Okay, this eight bits, for example, one zero zero one, zero zero. You transmit that one, the receiver directly at one. Second, however, with respect to serial communications, is you have only one wire, a transmitter and then receiver here, so that will entail another eight seconds. For example, okay to transmit transmit one received was one zero and so on. So that will be a slower version. However, the main advantage is, on the hardware part. Okay, as we have said, we are now using a lower connection or smaller connection. We use with the use of i2c lcd here. We have also demonstrated the basic use of the lcd module and finally display the temperature and humidity of an object with the hd22, so we have verified that one in actual via serial monitor and, of course, our lcd display as again shown here on our screens. So this formally ends our presentation under 16 by 2 character, i2c lcd display with the dht22.

https://www.youtube.com/watch?v=g6A_uwRql-k