Hi, Welcome to Robojax. My name is Ahmad Shamshiri from Canada.
In this video we are going to see how we can use this
1602 LCD which has 16 characters and 2 rows with I2C module using
these four wires only. So we can print text. The code for this project will be
available by clicking at the link at the description you can get it or you can go
directly visiting Robojax.com Let's get started
Hardware Explained
so the module is liquid crystal display or LCD has 16 characters
by 2. So 16 characters in two lines so we have 1 2 3 up to 16 and then another 16
so that's why it's called 1602 so 16 and then 2 and this display has tons of wires to
connect if we don't use the i2c module. So this I2C modulus is specifically designed
for this one. So this module has 4 pins . because I2C can work
with the 2 wires. So we have VCC and then we have a ground and then we have SDA (data) and
the SCL (the clock ) so we need only two wires needed
and then the power. The power will be supplied also to the LCD the only
thing that you need is to when you receive the package if it's not solder
you just solder that it here and then you plug it in but if you are installing it
in a device or something that make sure that you just saw that it with a very
little header out if you are not installing or anything doesn't matter so
this can sit properly - can we solder it that this way. Now I'm
going to solder this to prepare it for this tutorial.
I want to make sure that this is inserted fully and then just apply some
solder here so that when it's done I will apply all for the end
now the rest will be very easy
Now this has been soldered. At this point of I2C module we have the address
here A0, A1, A2 so this is not soldered this point can be soldered together so
this is not so that all of them are 0 so we can select combination of soldering
in terms of digital so this is 0 0 and then also making we can make it 1 so
this can be 0 and this this can be 1 and these two are 0 and so forth here here
are the values so if everything is 0
then we have 27(addresses) the order is like this a
A2 is 0, A1 is 0 and A0 is 0 so and then if we have only a
0 is 1 then this address will be 0 X 26
0 x mean hex value of 26 and so forth. So all these are the all combinations so up
to this 3 which is 15 different values this jumper is here to control the LED
if you don't want this one to be ON you can just leave it and you can see it's
very dark but let me change the intensity at the maximum intensity it
looks like this Wiring Explained
So let me explain how you connect this. This this module has 4 wires:GND, VCC
SDA and SCL The SDA is data pin, SCL is the clock. This will be connected
accordingly here so the VCC so the VCC is connected this
is the VCC connected to 5V the GND is connected to the GND and
these two wires are so the clock (SCL) connected to A5 and the data (SDA) is
connected to A4
some are the Arduinos might have here SCL and SDA so make sure if you have it you
can directly connected I just connected the hell because it worked in both case
Downloading the library
I will provide the link so you can come here and download the library also this
library will be provided directly on robojax.com so you can get it in
case it's changed or move so once you arrive at this page just click clone and
click on the select a location I'm going inside the download and then library and
then saving it after it's finished just go open it so however you use edge or
Firefox so this is the files now right-click you can get 7-zip which is
free from www.7zip.org extract it here, it will create a folder with the same name
there's a file so right click copy and then go to Arduino folder wherever you
you installed it maybe you installed in Program
files (C:\program files") program file\Arduino. Mine is
here so anyway you will see this structure and inside that library just
go here somewhere or the empty spot just right click and Paste it it some
somewhere under here on here right click paste right-click and select paste so
this will be the folder with all the files
Open file by clicking as follow
Let me explain the code now. The wire is for communication
purpose of I2C and this is the main library that does the job for us and
then we create here using this type we create an object LCD 0x27 is the
address for this purpose of working with
address has created a separate video. the link is below.
that explains everything but for majority of I2C the address is 0x27
So if you type that it will work. 16 if number of characters 2 is number
of rows so I believe you will not change that and inside the setup so we say LCD
begins so this is an object we just say LCD and then the method began will
initialize it so then we say set a backlight backlight it will be on after
that then inside the loop we say "clear" this loop every time we run it will
clear it and then we type 1 text so we say LCD dot print and then inside the
double quote we put our text whatever you want to print. To print on the next line we
say set cursor at (0, 1), 0 mean the character character 0 at the beginning
of the line and 1 mean second row because the rows start with 0 so 0 to 1
and then LCD print this text will go at this address and then we wait 500
millisecond or less and it goes and continuous like that so if you are
reading the value from a sensor from something else or a voltage or pressures
or temperature whatever so your loop will go here you get the value and then
put it here and it will be printed for you. Now let's open the cursor blink
example
"blinking cursor" so here is for the cursor blank we use LCD.blank as you can
see the cursor will blink like that and when there is no blank and you can see
there is no blank it will be just aligned so blank and no blank so you
either use no blink or you use blank so this screen uses a while loop to just
display that which is part of the example. Let's open another example
go to file->example> scroll to the Crystal Library and then
custom character with this custom characters they've created Bell, North
Clark, heart, duck and all those for each there is a hex value that represents the
how the text is being drawn on the screen so here is an example that
somebody has created this battery so empty and full battery for this
character too and here is the map of the each character on this device and these
are the hex values so actual each character has one two three four each
character has five dots by eight dots so and here the battery have been drawn
like that and these are 1 1 1 and the greens are 0 so what 0 1 1 1 0 so for
this you have to send 0x2 draw that one and next and next and so forth so all
these value will draw this battery shape somebody else has created this map that
you can see all these characters that if you need them you just click here and
here is a value if you want to parent 5 so this is the hex value for all of them
so so you will send 0 1 F, 0 1 18 and so forth
this example prints the special characters with all of this so here are
the characters that that code prints it goes from 10 hex to 20 hex here are the
values that were being printed and so on 30 to 40 these are the values 40 to 50
these are the values these are all hex values 50 to 60 uppercase yen sign and
lower case 60 to 70 and as you can see it continues like that with arrow
so it tries to get all the ASCII characters a little present now you can
see some Japanese character that you can see
from E to F
and now you see these shapes 0 to 10 these are the heart and all the things
that have been drawn so this was introduction to this 1602 LCD thank you
for watching please thumb up the video please subscribe and also share if you
have any question please posted at the comments I appreciate it
and I will try my best to answer it I will have a lot of other videos using
this LCD with different applications so please follow up