LCD screen part ii

LCD screen part ii

Hello guys, welcome back to my blog. Today we are going to talk about the second part of the LCD screen control article. We talked about the first part of this topic in a previous article. Click the link and read it. In that article, several wires had to be used to control the LCD screen. We also had to prepare the circuit for that. Putting this into a project is a very difficult task. This required the use of six digital pins from the Arduino. Okay, today we will talk about how to do this task using four pins. That is, this LCD can be controlled by four wires. For that, we need the I2C module only.

What is an I2C module?

I2C is a communication protocol. It is called Inter-Integrated Circuit. This communication method uses an accelerometer, gyroscope, magnetometer, and RTC module and this method is also used to communicate between two Arduino boards. This I2C module has four pins. The VCC and GND pins in this sensor are used to power this module and  SDA and SCL pins are using i2c communication. This SDA pin must be connected to the SDA or A4 pins on the Arduino board and the SCL pin connected to the SCL or A5 pin.

Let’s do this in practice. The required components are as follows.

Disclosure: These Amazon links are Affiliate links. As an Amazon Associate, I earn from qualifying purchases.

Step 1

Let us identify these components.

Step 2

Connect these components as follows. First, solder the i2c module to the LCD screen.

Step 3

Look at this code.

#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C dis(0x27, 16, 2);
void setup() {
  dis.init();
  dis.backlight();
}
 
void loop() {
  dis.setCursor(3, 0);
  dis.print("SriTu Tech");
}

First, you need to include the i2c library. Click the link and download it. Include it into the Arduino IDE using the steps below.

#include <LiquidCrystal_I2C.h>

After, we must create an object for this library. This code object name is “dis”. Then must include the i2c address and display size in the parentheses.

LiquidCrystal_I2C dis(0x27, 16, 2);

Next, we need to start the LCD and turn on the backlight.

void setup() {
  dis.init();
  dis.backlight();
}

After that, we need to select the print location.

dis.setCursor(3, 0);

Now we can print what we want. Use a double-quote for that.

 dis.print(“SriTu hobby”);

Step 4

Now, select the board and port. After, click the upload button.

The following is another project done by the above code. This code uses three functions. You can run this code by removing the forward-slash one by one.

  • The complete program of this project – Download
/*LCD display control using two wires.
  created by the SriTu Tech team.
  Read the code below and use it for any of your creation
*/
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C dis(0x27, 16, 2);
uint8_t heart[8] = {0x0, 0xa, 0x1f, 0x1f, 0xe, 0x4, 0x0};
 
void setup() {
  dis.init();
  dis.backlight();
  dis.createChar(1, heart);
}
 
void loop() {
  //welcome();
  //End();
}
void welcome() {
  dis.setCursor(2, 0);
  dis.print("HELLO GUYS!");
 
  for (int a = 0; a < 16; a++) {
    dis.setCursor(a, 1);
    dis.write(1);
    delay(500);
  }
  dis.clear();
  dis.setCursor(1, 0);
  dis.print("WELCOME TO LCD");
  dis.setCursor(0, 1);
  dis.print("TUTORIAL");
  for (int i = 8; i < 16; i++) {
    dis.setCursor(i, 1);
    dis.print(".");
    delay(500);
  }
  dis.clear();
}
void End() {
  dis.clear();
  dis.setCursor(0, 0);
  dis.print("THANKS FOR");
  dis.setCursor(0, 1);
  dis.print("WATCHING");
  for (int i = 10; i < 16; i++) {
    dis.setCursor(i, 0);
    dis.print(".");
    delay(500);
  }
  for (int i = 8; i < 16; i++) {
    dis.setCursor(i, 1);
    dis.print(".");
    delay(500);
  }
  dis.clear();
  dis.setCursor(0, 0);
  dis.print("PLEASE SUBSCRIBE");
  dis.setCursor(0, 1);
  dis.print("MY CHANNEL");
  for (int a = 10; a < 16; a++) {
    dis.setCursor(a, 1);
    dis.print(".");
    delay(500);
  }
}

OK. enjoy this project. The full video guide is below. We will meet in the next post. Have a good day.

LCD screen part ii

Leave a Comment

Your email address will not be published. Required fields are marked *

Shopping Cart
Select your currency
USD United States (US) dollar
EUR Euro
Scroll to Top