Stufin
Home Quick Cart Profile

20x4 LCD Display Module (Blue)

Buy Now on Stufin

Pin Configuration

  • 20x4 LCD Display Module (Blue) Pinout Documentation
  • The 20x4 LCD Display Module (Blue) is a popular IoT component used for displaying text and characters in various applications, including robotics, automation, and embedded systems. This documentation provides a detailed explanation of the pins on the module, along with a step-by-step guide on how to connect them.
  • Pinout:
  • The 20x4 LCD Display Module has 16 pins, which can be divided into three categories: Power, Data, and Control.
  • Power Pins:
  • 1. VCC (Pin 1): Positive power supply pin (typically 5V)
  • Connect to a 5V power source or a voltage regulator output.
  • 2. GND (Pin 2): Ground pin
  • Connect to the ground of the power source or the system's ground plane.
  • Data Pins:
  • 3. DB0 (Pin 3): Data bit 0
  • Connect to a microcontroller's data bus or a peripheral device's data output.
  • 4. DB1 (Pin 4): Data bit 1
  • Connect to a microcontroller's data bus or a peripheral device's data output.
  • 5. DB2 (Pin 5): Data bit 2
  • Connect to a microcontroller's data bus or a peripheral device's data output.
  • 6. DB3 (Pin 6): Data bit 3
  • Connect to a microcontroller's data bus or a peripheral device's data output.
  • 7. DB4 (Pin 7): Data bit 4
  • Connect to a microcontroller's data bus or a peripheral device's data output.
  • 8. DB5 (Pin 8): Data bit 5
  • Connect to a microcontroller's data bus or a peripheral device's data output.
  • 9. DB6 (Pin 9): Data bit 6
  • Connect to a microcontroller's data bus or a peripheral device's data output.
  • 10. DB7 (Pin 10): Data bit 7
  • Connect to a microcontroller's data bus or a peripheral device's data output.
  • Control Pins:
  • 11. RS (Pin 11): Register Select pin
  • Connect to a microcontroller's digital output or a peripheral device's control signal.
  • When RS is low (0), the LCD is in instruction mode. When RS is high (1), the LCD is in data mode.
  • 12. RW (Pin 12): Read/Write pin
  • Connect to a microcontroller's digital output or a peripheral device's control signal.
  • When RW is low (0), the LCD is in write mode. When RW is high (1), the LCD is in read mode.
  • 13. EN (Pin 13): Enable pin
  • Connect to a microcontroller's digital output or a peripheral device's control signal.
  • EN is used to latch data onto the LCD's internal registers.
  • 14. BLK (Pin 14): Backlight pin
  • Connect to a power source or a switching device to control the backlight.
  • 15. BLA (Pin 15): Backlight Anode pin
  • Connect to the positive terminal of the backlight LED.
  • 16. BLK (Pin 16): Backlight Cathode pin
  • Connect to the negative terminal of the backlight LED.
  • Connection Structure:
  • To connect the 20x4 LCD Display Module, follow this step-by-step structure:
  • 1. Connect VCC (Pin 1) to a 5V power source or a voltage regulator output.
  • 2. Connect GND (Pin 2) to the ground of the power source or the system's ground plane.
  • 3. Connect the data pins (DB0-DB7, Pins 3-10) to a microcontroller's data bus or a peripheral device's data output.
  • 4. Connect the control pins (RS, RW, EN, Pins 11-13) to a microcontroller's digital outputs or peripheral devices' control signals.
  • 5. Connect the backlight pins (BLK, BLA, BLK, Pins 14-16) to a power source, switching device, or the backlight LED's terminals.
  • Remember to consult the datasheet and user manual of the specific microcontroller or peripheral device you are using to ensure correct pin connections and configuration.

Code Examples

20x4 LCD Display Module (Blue) Documentation
Overview
The 20x4 LCD Display Module (Blue) is a character-based liquid crystal display (LCD) module that can display up to 20 characters per line and 4 lines in total. It is a popular display module for various microcontroller and embedded system projects. This module is based on the HD44780U controller/driver, which is a widely used controller for alphanumeric LCD displays.
Technical Specifications
Display Type: STN (Super-Twist Nematic) positive transmissive
 Display Size: 20 characters x 4 lines
 Character Font: 5x8 dots
 Viewing Angle: 45
 Operating Temperature: -20C to +70C
 Storage Temperature: -30C to +80C
 Power Supply: 5V
 Interface: 8-bit or 4-bit parallel interface
 Backlight Color: Blue
Pinout
The 20x4 LCD Display Module (Blue) has a 16-pin interface, with the following pinout:
VCC (Pin 1): 5V power supply
 GND (Pin 2): Ground
 VEE (Pin 3): Contrast adjustment voltage ( typically connected to GND or VCC)
 RS (Pin 4): Register Select (High for data, Low for instruction)
 R/W (Pin 5): Read/Write (High for read, Low for write)
 EN (Pin 6): Enable (High to enable, Low to disable)
 D0-D7 (Pins 7-14): 8-bit data bus
 BLA (Pin 15): Backlight Anode (connected to 5V or 3.3V for backlight on)
 BLK (Pin 16): Backlight Cathode (connected to GND for backlight on)
Code Examples
### Example 1: Basic 4-Line Display using Arduino
In this example, we will connect the 20x4 LCD Display Module (Blue) to an Arduino Uno board and display a simple 4-line message.
```cpp
#include <LiquidCrystal.h>
// Define the LCD pins
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
// Create an instance of the LiquidCrystal class
LiquidCrystal_I2C lcd(rs, en, d4, d5, d6, d7);
void setup() {
  // Initialize the LCD
  lcd.begin(20, 4);
}
void loop() {
  // Display a 4-line message
  lcd.setCursor(0, 0);
  lcd.print("Hello, World!");
  lcd.setCursor(0, 1);
  lcd.print("Line 2: This is a test");
  lcd.setCursor(0, 2);
  lcd.print("Line 3: LCD Display Module");
  lcd.setCursor(0, 3);
  lcd.print("Line 4: 20x4 Blue Backlight");
  
  delay(1000);
}
```
### Example 2: Interactive Menu using Raspberry Pi (Python)
In this example, we will connect the 20x4 LCD Display Module (Blue) to a Raspberry Pi and create an interactive menu using Python.
```python
import RPi.GPIO as GPIO
import time
# Define the LCD pins
lcd_rs = 7
lcd_en = 8
lcd_d4 = 25
lcd_d5 = 24
lcd_d6 = 23
lcd_d7 = 18
# Set up the GPIO pins
GPIO.setmode(GPIO.BCM)
GPIO.setup(lcd_rs, GPIO.OUT)
GPIO.setup(lcd_en, GPIO.OUT)
GPIO.setup(lcd_d4, GPIO.OUT)
GPIO.setup(lcd_d5, GPIO.OUT)
GPIO.setup(lcd_d6, GPIO.OUT)
GPIO.setup(lcd_d7, GPIO.OUT)
# Initialize the LCD
def lcd_init():
  GPIO.output(lcd_rs, 0)
  GPIO.output(lcd_en, 0)
  time.sleep(0.05)
  GPIO.output(lcd_en, 1)
  time.sleep(0.05)
  GPIO.output(lcd_en, 0)
  lcd_send_byte(0x33)
  lcd_send_byte(0x32)
  lcd_send_byte(0x28)
  lcd_send_byte(0x0C)
  lcd_send_byte(0x01)
# Send a byte to the LCD
def lcd_send_byte(byte):
  bit = bin(byte)[2:].zfill(8)
  for i in range(8):
    if bit[i] == '1':
      GPIO.output([lcd_d4, lcd_d5, lcd_d6, lcd_d7][i], 1)
    else:
      GPIO.output([lcd_d4, lcd_d5, lcd_d6, lcd_d7][i], 0)
  GPIO.output(lcd_en, 1)
  time.sleep(0.05)
  GPIO.output(lcd_en, 0)
# Send a string to the LCD
def lcd_send_string(string):
  for char in string:
    lcd_send_byte(ord(char))
# Initialize the LCD
lcd_init()
# Display an interactive menu
while True:
  lcd_send_string("Menu:")
  lcd_send_string(" 1. Option 1")
  lcd_send_string(" 2. Option 2")
  lcd_send_string(" 3. Option 3")
  lcd_send_string(" 4. Exit")
  
  # Read user input (e.g., using a keypad or button)
  # and update the menu accordingly
  time.sleep(1)
```
Note: These examples are just a starting point, and you may need to modify the code to suit your specific requirements. Additionally, you may need to add additional libraries or modules depending on your development environment.