PCF8574 I2C LCD | Connecting an LCD Display to Arduino using I2C Adapter | I2C LCD Display

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Hello friends welcome to a fresh new episode of our Channel RG Innovations if you have not subscribed already please subscribe to our Channel click on the Bell button and select all to get all future notifications of our video uploads in today's video we are going to discuss about how to connect an LCD display module with Arduino using an i2c LCD adapter in one of my previous videos I have shown how you can connect the LCD display directly with Arduino it took a lot of wiring and many IO pins of the Arduino I will share the link of the video in the I button and also in the description you can check the video from there but today we will use the it2 interface which will take only two pins of the Arduino leaving many resources free for connecting other peripherals so let us start and see all the details step by step I request you not to skip the video because I'll discuss many important details throughout the video first let us look at the LC display we have two type of LCD displays with us one is 16x2 that means two lines or two rows and 16 characters per line another is 20 by4 that means four lines or four rows and 20 characters per line you can see here are so many pins to connect if we do not use an i2c adapter so I'm not wasting time by soldering the pins of an i2c adapter in the LCD display I have already soldered it into two of the LCD displays and we will use one of these modules for the Practical demonstration now let us look into the i2c LCD adapter see at the heart of the adapter is an 8bit IO expander chip PCF 8574 this chip converts the i2c data from an Arduino into the parallel data required for an LCD display the board also includes a tiny trim pot for making precise adjustment to the displays contrast there is a jumper on the board that provides power to the backlight to control the intensity of the backlight you can just remove the jumper and apply external voltage to this header pin leveled LED for now we are connecting the jumper now every i2c device has an i2c address if you have multiple devices on the same i2c bus you may need to set a different i2c address for the LCD adapter to avoid conflicting with another i2c device for this purpose the adapter comes with three solder jumper pads you can see here a z A1 and A2 these three jumper pads are there the address is set when a jumper is shorted with a blob of solder and important point to note here is that several companies including Texas instrument and nxp semiconductors manufacture the same PCF 8574 cheap and the i2c address of your LCD depends on the cheap manufacturer because there are three address inputs that can take on two states either high or low 2 to the^ 3 or eight different combination or addresses are possible all three address inputs are pulled High using onboard pullup resistors if your adapter has Texas Instruments pcf8574 chip this gives the PCF 8574 a default it2 address of 0 x27 when you short a solder jumper here you pull the address input low if you were to short all three jumpers the address will be 0x20 so the range of possible addresses spans from 0x20 to 0 x27 you can set a different ITC address according to the chart that we are going to show next the first eight combinations are showing Texas Instruments PCF 8574 chips i2c address combinations and the second group is showing nxp's PCF 8574 chips i2c address combinations you can clearly see by soldering which jumpers we can get which address you can take a screenshot of this and save for your reference now if your i2c adapter is nxp's PCF 8574 then it gives the module a default i2c address of 0 x3f when you short a solder jumper you pull the address input low and if you short all the jumpers the address would be 0 x38 so the range of all possible addresses spans from 0 x38 to 0 x3f you can set a different ITC address according to the chart that we have just shown so the i2c address of your LCD is most likely 0 x27 or 0 x3f we can also find the i2c address of a device using Arduino we will see that later in this Tut tutorial now let us see the i2c LCD display pinout the i2c LCD display has only four pins the following is the pinout at the top there is the ground pin it is connected to the negative power supply then the VCC pin it is the positive power supply pin connected to 5vt Output of the Arduino or an external 5vt power supply then SDA is the serial ITC data pin and SC the serial i2c clock pin now how to wear the i2c LCD display to an Arduino connecting an i2c LCD is much simp simpler than connecting a standard LCD you only need to connect four pins two for the data and clock and two for the power supply let us have a look at the circuit diagram you can see the i2c LCD adapter is soldered with the LCD display and only four wires from the Arduino has been connected with the adapter the red color is the VCC the black color is the ground the orange color is the SDA and the purple color is the sdl so only four wires from the Arduino can drive and LCD display display may it be a 16x2 display or it is a 20 by4 LCD display only four Wares is connected with the Arduino so let's have a look at the Practical demonstration let us start connecting it with an Arduino here is our i2c LCD module and here is our Arduino so we will begin with connecting the VCC pin so we are connecting the VCC pin with the arduinos 5 volt pin then we are connecting the ground pin of the I2 to CCD to the ground pin of the Arduino then we will connect the SDA pin of the I2 LCD to analog pin 4 which is also the SDA pin of the Arduino and we will connect the SC pin to the analog pin five of the Arduino which is the PIN of the Arduino note that each Arduino board has different i2c pins that must be connected correctly on Arduino board with R3 layout the SDA and clocks are the analog pins A4 and A5 respectively as we have connected there are also SC and SDA pin separately given near to the ARF pin you can also connect to there now we need to adjust the lcd's contrast our LCD is already connected with the Arduino now we will give power to the Arduino so that the LCD also Powers up now we will connect it with the computer with the pressure of the USB cable the Arduino is moving we need to keep it fixed here now this is the trim Port by which we can adjust the contrast of the LCD so let us see if we adjust the potentiometer we can see a visible line here but as there is no text printed to the LCD there is nothing being displayed only the first line of the LCD so we can adjust the contrast of the LCD by adjusting the potentiometer now we have to install the library for the i2c device we need a library called Liquid Crystal i2c I have given the link of the library you can download it from the description section and you can use that the library allows you to control ITC displays using various functions to install the library unzip the library copy the unzip folder and paste it in the library folder in the Arduino folder inside my documents now how to find the i2c address of this i2c adapter as previously stated the i2c address of your LCD depends on the manufacturer if your LCD has a PCF 8574 chip from the Texas Instruments its it2 address is 0 x27 if it has a PCF 8574 chip from nxp its i2c address is 0 x3f but if you are not sure what's your lcd's i2c address you can run a simple ITC scanner sketch that scans your ITC bus and Returns the address of each it device it finds I have given that Arduino sketch also for download load the ITC scanner sketch into your Arduino ID after you have uploaded the sketch launch the serial monitor at 9,600 w you should see the i2c address of your i2c LCD display please keep a note of this address you will need it in later examples so let's go to the Arduino sketch and we will run the ITC scanner and see and find what is the ITC address of our ITC adapter we are moving on to the screen so here is our ITC scanner sketch we will upload it into our Arduino so first selecting Arduino youo com 3 and we will upload the sketch uploading done now we will open the serial monitor you can see ITC scanner scanning ITC device found at address 0 x3f so our ITC adapter address is 0 x3f now we are closing the serial Monitor and we are opening The Taste sketch for a Hello World program for printing a hello world to the LCD this is our sketch to print a hello world in the LCD first we have included a wire. h Library it is included in the arduin installation and then we have included the library Liquid Crystal it2 C.H I have given a link for download of this library now we have declared an object of liquid Crystal type its name is LCD then we have given the address of the i2c and then given the size of the LCD we are now working with a 16x2 LCD so we have given size 16 and two then in the setup section we have initialized the LCD then turned on the LCD backlight then we have set the cursor position to three 0 three means here it is the column and this is the row so at the first row marked with zero and three is the fourth column then we have printed hello world into the LCD then again we have set cursor to the position one and one that means the second row and the second column there we have print RG Innovations so program is this simple now we will upload it it into the Arduino and see what happens into the LCD display we are pressing upload while the program loads we are moving to the camera you see the display has come but it is very faint so we need to adjust the potentiometer to adjust the contrast so we are adjusting the contrast and at a point of time the display will be very bright yes now you can see the display is very bright and in this way we can print anything into the LCD display by using r2c just using simple two data wires this is our first program with an LCD which prints the hello world and RG Innovations now in the Arduino sketch we have used very few functions of the Liquid Crystal library now we will discuss few more functions of the same Library so that we can use them in our programs these are few other useful functions that we can use one is LCD doome this function positions the cursor in the upper left of the LCD without clearing the display LCD do blink function displays a blinking block of 5 by8 pixels that means one block of character in The at the position to which the next character will be written LCD do no blink function turns off the blinking LCD cursor LCD do cursor function displays an underscore line at the position to which the next character will be written LCD do no cursor function hides the LCD cursor LCD do scroll display right function Scrolls the content of the display one space to the right if you want the text to scroll continuously you have to use this function inside a for Loop LCD do scroll display left function Scrolls the content of the display one space to the left similar to the above function use this inside a for Loop for continuous scrolling LCD do no display function turns off the LCD display without losing the text currently shown on it LCD do display function turns on the LCD display after it's been turned off with no display this will restore the text and cursor that was on the display so this was the basic use of an i2c adapter with an LCD display using an Arduino you can use any version of Arduino but please check before that what is the and SDF pin of the Arduino before connecting so with this information we conclude here today if you have any more question or confusion please feel free to ask me in the comment I'll definitely try to answer all your comments and if you like the video please hit the like button and do not forget to subscribe our Channel RG Innovations we will meet again in a new video till then bye-bye Take Care thank you for watching have a nice time
Info
Channel: RG Innovations
Views: 431
Rating: undefined out of 5
Keywords: How to connect LCD with Arduino, Library of LCD Display, PCF8574 I2C LCD, PCF8574 I2C Expander for LCD Display, I2C LCD Display with Arduino, Easy LCD Display with Arduino, What is PCF8574, I2C Address of LCD Display, No Display in 1602 / 16x2 LCD Display, No Display in 2004 / 20x4 LCD Display
Id: SHORUnKgpKE
Channel Id: undefined
Length: 13min 13sec (793 seconds)
Published: Sun May 12 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.