10-inch I-Series for Android with Android Open Source (2.0) - 10 inch touch display
Arduinoboard
By precisely controlling the electric current to different sections (or pixels) of the liquid crystals, the LCD can selectively allow or block light in specific areas. This creates the images, numbers, or text you see on the screen.
D0-D7 (Data Lines) are the eight pins that carry the actual data or commands to the LCD. In 8-bit mode, all eight pins are used (D0-D7). In 4-bit mode, only the upper four (D4-D7) are used, and the lower four (D0-D3) are left unconnected.
Try experimenting with these functions in your own code to see how they work. They’ll help you create more interactive and dynamic displays for your projects!
The brains behind these displays is a special chip called the Hitachi HD44780 controller. This chip does all the complicated work of sending the right signals to control the liquid crystals and manages what gets displayed on the screen.
Inside every LCD, there’s a backlight that provides a steady source of light. The special liquid crystals are sandwiched between two layers of polarized glass.
Remember that we’ve already connected the power, ground, and contrast adjustment pins in our earlier setup. With these additional connections, your LCD is now fully wired to the Arduino and ready to display messages once we upload some code!
Finally, in the loop section, we display our custom character using the write() function. We tell it which character to display by passing the memory slot number:
CGRAM, however, is volatile memory, so it loses its data when power is removed. This memory is flexible and lets you store custom dot patterns that aren’t part of the built-in set. For instance, you can design your own symbols, icons, or unique characters for your project. However, CGRAM has limited space – only 64 bytes total. On a standard 5×8 pixel LCD, this means you can only store 8 custom characters (since each character needs 8 bytes). If you’re using a 5×10 pixel LCD, you can only store 4 custom characters because each one needs more memory.
The example sketch below prints “Hello World” to the LCD. Go ahead and try out the sketch first, and then we’ll break it down in detail.
You might think that we need to connect all eight data pins on the LCD to send information to it. But here’s a cool thing: HD44780-based LCDs are smart enough that we can talk to them using just four data pins instead of eight! This is called “4-bit mode” (using four pins) instead of “8-bit mode” (using all eight pins). This trick saves us four Arduino pins that we can use for other parts of our project!
I2cdisplay
A Liquid Crystal Display (LCD) works by carefully controlling light using liquid crystals to create images or text on your screen.
In the loop() function, we call lcd.scrollDisplayLeft(), which moves the entire display content one space to the left. By repeating this with a short delay between each scroll, the message appears to move smoothly across the screen.
A (Anode) and K (Cathode) power the backlight LED that illuminates the display. The anode connects to positive voltage (usually 5V) and the cathode to ground. Sometimes a resistor is added to limit the current and protect the backlight LED, unless your LCD already has a built-in resistor.
Next, we need to adjust the contrast so you can actually see the characters. Connect a 10K potentiometer to the display: one side goes to 5V, the other side to GND, and the middle pin (the wiper) connects to LCD pin 3.
GIGADisplay
ArduinoLCD
To connect the LCD in 4-bit mode, you’ll only need six Arduino pins total: RS, EN, and the four data pins (D7, D6, D5, and D4). Here’s how to connect them:
One of the best things about using these displays in your projects is how easily you can swap them out. If you decide you want a different size or color LCD, you can replace it without having to rewire everything. While you might need to make small changes to your code, the wiring will remain the same!
Next, we create an object of the LiquidCrystal class by providing the pin numbers connected to the LCD’s RS (Register Select), EN (Enable), and four data pins (D4, D5, D6, D7) as parameters. This object lets us control the LCD.
RS (Register Select) determines whether the data sent to the LCD is interpreted as a command or as character data.When RS = 0: The LCD treats the data as a command (like “clear the screen” or “move the cursor”).When RS = 1: The LCD treats the data as actual characters to display (like letters or numbers).
In 8-bit mode, all 8 data pins (D0 through D7) are used. This allows a full byte (8 bits) of information to travel to the LCD all at once. It’s like sending an entire word in one go, which makes communication faster. The downside? You need to connect all 8 pins, which uses up more of your Arduino’s limited I/O pins.
While the Serial Monitor is a handy way to debug and display data, it’s not always the most convenient or portable solution. That’s where character LCDs come in! These simple screens are perfect for displaying real-time data, system statuses, or just giving your project a personal touch.
The good news is that HD44780 LCDs allow you to create up to 8 custom characters of your own design! As we learned earlier in this tutorial, each character on the LCD is displayed using a small grid of pixels arranged in a 5×8 pattern (5 pixels wide by 8 pixels tall). To create your own character, you’ll need to decide which of these tiny dots should be turned on and which should be off.
Character LCDs are specially designed to display letters, numbers, and symbols. A 16×2 character LCD, for example, can show 16 characters across each line, with two lines total.
The light first passes through the first polarized glass layer, then through the aligned liquid crystals which twist the light to a specific angle. The second polarized glass layer then either lets this twisted light pass through or blocks it, depending on the twist angle.
Sometimes you may want to display special characters that aren’t part of the standard alphabet or numbers – for example, symbols like a smiley face, a degree symbol (°) for temperature readings, or fun icons like hearts, music notes, or arrows.
In 4-bit mode, only 4 data pins (D4 through D7) are used. When you send information, each byte gets split into two smaller chunks (called “nibbles”) that travel one after another. It’s like breaking a word in half and sending it in two trips. This is a bit slower since the data is sent in two parts instead of all at once, but you only need half as many pins on your Arduino.
Once you’ve designed your character by setting up this array, you can use the createChar() function to store your custom character into the LCD’s CGRAM (Character Generator RAM), which is a special memory area designed just for holding custom characters.
If you have a message that is longer than 16 characters, or you want to create a scrolling marquee effect, you can use the scrollDisplayLeft() or scrollDisplayRight() functions in a loop to move the text across the screen.
To sum it up: 8-bit mode is faster but hungry for pins, while 4-bit mode is slightly slower but saves precious pins for other parts of your project. For most simple projects, the speed difference isn’t noticeable, which is why 4-bit mode is more commonly used.
Creating custom characters has never been easier! We’ve developed a helpful tool called the Custom Character Generator. See the blue grid below? You can click on any pixel to turn it on or off, and as you do this, the code for your character is automatically created right next to the grid. You can copy this code directly into your Arduino sketch.
First, connect the Arduino’s 5V and GND pins to the breadboard power rail, and carefully plug your LCD into the breadboard.
Whether you’re a total beginner or just brushing up, we’ll guide you step-by-step. So grab your Arduino, your LCD, and a handful of jumper wires—let’s light up some pixels!
In the setup section of the code, we use the createChar() function to store our custom character in the LCD’s memory. This function needs two pieces of information: A number between 0 and 7 (which tells the LCD which of the eight available memory slot to use) and the name of the array that contains our character design.
In the loop function, we use the print() function to display the text “Hello world!” on the LCD. Remember that you need quotation marks (" ") around any text strings. However, quotation marks aren’t necessary when printing numbers or variables.
Each line represents one row of pixels, starting from the top of the character. The “0b” at the beginning just tells Arduino this is a binary number (made of 0s and 1s). Each 0 means “pixel off” and each 1 means “pixel on.” If you look carefully at the pattern, you can see how the 1s form the shape of a heart!
The sketch begins by including the LiquidCrystal library, which is essential for controlling LCD displays based on the Hitachi HD44780 driver. This library comes pre-installed with the Arduino IDE.
In summary, CGROM is read-only with fixed character patterns that can’t be changed, while CGRAM is writable, allowing you to create and save custom characters whenever you need them.
If you look very closely at the screen, you’ll notice small rectangular boxes for each character position. Inside each of these rectangles is a grid of 5×8 tiny dots or pixels. These pixels light up in different patterns to form different letters, numbers, or symbols.
In this tutorial, we’ll walk you through hooking up a 16×2 character LCD to your Arduino. And don’t worry—if you have a different size like 16×1, 16×4, or even 20×4, the basic steps and ideas we’ll cover here will work for those too.
Arduinodevelopment board
The main difference between 4-bit and 8-bit modes in a character LCD is how information travels from your Arduino (or other microcontroller) to the LCD screen.
E (Enable) is used to tell the LCD when to read the data lines (D0-D7). To make the LCD accept the data on its data pins, you briefly pulse this pin from HIGH to LOW, which tells the LCD to latch the data into its memory.
R/W (Read/Write) determines whether you’re sending data to the LCD or getting data from it:When RW = 0: You’re in Write mode, sending information to the LCD.When RW = 1: You’re in Read mode, getting information from the LCD.Most of the time, we only need to send information to the LCD, so the RW pin is usually pulled LOW (0) permanently.
In this example, we print a message that is 19 characters long (“Scrolling Text Demo”) to the LCD. Since the display can only show 16 characters at once, only the first 16 characters will be visible initially.
ESP32-S3Arduino
The possibilities for what you can create are almost endless! You could make arrows, simple animals, game characters, weather symbols, or any small icon you can fit in the 5×8 grid. The only limitation is that the LiquidCrystal library only lets you use eight custom characters at one time. But don’t worry – eight different custom characters are still plenty to make your project unique and interesting!
Arduinominima
Some LCDs come with a built-in resistor for the backlight—you might see it on the back of the LCD near pin 15. This resistor protects the backlight from getting too much power. If your LCD doesn’t have this resistor (or if you’re not sure), it’s safer to add one yourself between 5V and pin 15. A 220-ohm resistor works well, though it might make the backlight a little dim. For the best brightness, you can check the LCD’s datasheet to find the maximum backlight current and calculate the perfect resistor value.
After including the LiquidCrystal library and setting up the LCD object, the code defines special arrays for our custom characters. Each array has exactly 8 bytes, and each byte controls one row of dots in our 5×8 character grid.
ArduinoIDE
To create your custom character, you first need to make an 8-byte array in your code. Each byte in this array represents one horizontal row in your character, starting from the top row and going down to the bottom row. For each byte, you’ll use the bits (the 1s and 0s in binary) to indicate which pixels should be ON (1) and which should be OFF (0). Only the first 5 bits of each byte are used since the character is 5 pixels wide.
After printing the first message, we want to move to the second line to print another message. We use setCursor(0, 1) to do this. The first number (0) means the far left column, and the second number (1) means the second row. (Remember, in programming we often start counting from 0, not 1, so row 0 is the first row, and row 1 is the second row!)
Character LCDs come in many different sizes and color combinations. You can find them in formats like 16×1, 16×4, or 20×4. They also come in different color options such as white text on a blue background or black text on a green background, plus many others!
Before we dive into the hookup and example code, let’s explore the pinout of a standard character LCD, which has 16 pins:
V0 controls the contrast of the LCD screen. It’s usually connected to the middle pin of a potentiometer, with the other two ends of the potentiometer connected to 5V and ground. When you turn the potentiometer, it changes the voltage at V0, which adjusts the contrast.
CGROM is non-volatile memory, which means it keeps its data even when power is turned off. It stores predefined dot patterns for standard ASCII characters, such as letters, numbers, and common symbols. When you instruct the LCD to display an “A” on the screen, the LCD controller looks up the dot pattern for “A” in its CGROM and displays it. This makes showing regular characters super quick and easy!
As the text scrolls, characters that move off the left edge disappear, and blank spaces appear on the right side of the screen. If you want the message to continuously loop, you would need to add code that reprints the message periodically.
The LCD actually needs power in two different places: one connection powers the LCD display itself (pins 1 and 2), and another powers the backlight (pins 15 and 16). Connect pins 1 and 16 of the LCD to GND (ground), and connect pins 2 and 15 to 5V.
All Hitachi HD44780 driver-based LCDs have two types of memory: CGROM (Character Generator Read-Only Memory) and CGRAM (Character Generator Random Access Memory).
In the setup function, we call two important functions. The first function is begin(). This initializes the interface to the LCD screen and specifies the dimensions (columns and rows) of the display. Since we’re using a 16×2 LCD, we use 16 and 2 as the values. If you had a different size LCD, like a 20×4, you would use 20 and 4 instead.
When electricity flows through these liquid crystals, they change their alignment. This alignment affects how light passes through them.
If everything is wired correctly and you’ve adjusted the contrast properly with the potentiometer, you should see “Hello world!” on the first line of your LCD and “LCD Tutorial” on the second line.
That’s it for the basic setup! Now, power up your Arduino. You should see the backlight glow up, and as you slowly turn the potentiometer knob, you’ll start to see the first row of rectangles appear on the screen. These rectangles are where characters will show up. If you can see those rectangles clearly, congratulations—your LCD is working perfectly and is ready for you to display text!