Introduction: Interfacing LCD With Arduino on Tinkercad

The code in this article is written for LCD’s that use the standard Hitachi HD44780 driver. If your LCD has 16 pins, then it probably has the Hitachi HD44780 driver. These displays can be wired in either 4 bit mode or 8 bit mode. Wiring the LCD in 4 bit mode is usually preferred since it uses four less wires than 8 bit mode. In practice, there isn’t a noticeable difference in performance between the two modes. In this tutorial, I’ll connect the LCD in 4 bit mode.

Step 1: What You Need

For this tutorial you will need:

1.Arduino uno

2.Breadboard or PCB

3.LCD 16x2

4.Potentiometer

Step 2: LCD Pinout and Connections With Arduino

Here’s a diagram of the pins on the LCD I’m using. The connections from each pin to the Arduino will be the same, but your pins might be arranged differently on the LCD. Be sure to check the datasheet or look for labels on your particular LCD:

Also, you might need to solder a 16 pin header to your LCD before connecting it to a breadboard. Follow the diagram below to wire the LCD to your Arduino:

Rs pin (RS) - 1

Enable (E) - 2

D4 - 4

D5 - 5

D6 - 6

D7 - 7

The resistor in the diagram above sets the backlight brightness. A typical value is 220 Ohms, but other values will work too. Smaller resistors will make the backlight brighter.


The potentiometer is used to adjust the screen contrast. I typically use a 10K Ohm potentiometer, but other values will also work.

Step 3: Programming the Arduino

All of the code below uses the LiquidCrystal library that comes pre-installed with the Arduino IDE. A library is a set of functions that can be easily added to a program in an abbreviated format.

In order to use a library, it needs be included in the program. Line 1 in the code below does this with the command #include . When you include a library in a program, all of the code in the library gets uploaded to the Ardunio along with the code for your program.

Now we’re ready to get into the programming! I’ll go over more interesting things you can do in a moment, but for now lets just run a simple test program. This program will print “Welcome to my class” to the screen then after some delay " New way of learning" and at the end " Arduino class by Mudit jain" where my name will blink . Enter this code into the tinkercad code area and start the simulation.

Step 4: Code

For more interesting projects connect with me on:

Youtube:https://www.youtube.com/channel/UCTS10_CRYJhT-vb9-pvKzzg

Facebook page: https://www.facebook.com/techeor1/

Instagram: https://instagram.com/official_techeor?igshid=uc8l10avryni

#include<LiquidCrystal.h>

LiquidCrystal lcd (1,2,4,5,6,7);
void setup()
{ lcd.begin(16,2);
lcd.setCursor(5,0);
lcd.print("WELCOME");
lcd.setCursor(3,1);
lcd.print("TO MY CLASS");
delay(2000);
lcd.setCursor(5,0);
lcd.print("New Way");
lcd.setCursor(3,1);
lcd.print("Of Learning");
delay(2000);
lcd.clear();
}
void loop()
{
lcd.setCursor(2,0);
lcd.print("Arduino class");
lcd.setCursor(2,1);
lcd.print("By MUDIT JAIN");
delay(500);
lcd.clear();
lcd.setCursor(2,0);
lcd.print("Arduino class");
delay(500);
}

Step 5: Code and Circuit Diagram Explained Fully:

If you are a beginner then it might help you a lot because I have explained the circuit diagram and code in brief. You will learn how to print something on the 16*2 LCD and brief about lcd.setCursor command.

GOOD LUCK.