Hackster is hosting Hackster Holidays, Ep. 5: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 5 on Friday!
vinay y.n
Published © GPL3+

16X2 LCD Interfacing With Raspberry Pi

Interfacing the 16x2 LCD with Raspberry Pi using Adafruit CharLCD Library and Circuit Python Libraries.

BeginnerFull instructions provided2 hours990
16X2 LCD Interfacing With Raspberry Pi

Things used in this project

Hardware components

Raspberry Pi 3 Model B
Raspberry Pi 3 Model B
×1
Standard LCD - 16x2 White on Blue
Adafruit Standard LCD - 16x2 White on Blue
×1
Single Turn Potentiometer- 10k ohms
Single Turn Potentiometer- 10k ohms
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Raspbian
Raspberry Pi Raspbian

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free

Story

Read more

Schematics

Circuit Connection Diagram

Code

Simple Example code To display a message On LCD With Cursors Position Pointer

Python
import time
import board
import digitalio
import adafruit_character_lcd.character_lcd as characterlcd

# Modify this if you have a different sized character LCD
lcd_columns = 16
lcd_rows = 2

# Raspberry Pi Pin Config:
lcd_rs = digitalio.DigitalInOut(board.D26)
lcd_en = digitalio.DigitalInOut(board.D19)
lcd_d7 = digitalio.DigitalInOut(board.D27)
lcd_d6 = digitalio.DigitalInOut(board.D22)
lcd_d5 = digitalio.DigitalInOut(board.D24)
lcd_d4 = digitalio.DigitalInOut(board.D25)
lcd_backlight = digitalio.DigitalInOut(board.D4)

# Initialise the lcd class
lcd = characterlcd.Character_LCD_Mono(
    lcd_rs, lcd_en, lcd_d4, lcd_d5, lcd_d6, lcd_d7, lcd_columns, lcd_rows, lcd_backlight
)
lcd.cursor_position(0, 0)# coloumn,row
lcd.message = "HI,"
lcd.cursor_position(3, 0)# coloumn,row
lcd.message = "Hope you are"
lcd.cursor_position(0, 1)
lcd.message = "Seeing The Video"
time.sleep(5)
lcd.clear()
lcd.cursor_position(0, 0)# coloumn,row
lcd.message = "Raspberry Pi "
lcd.cursor_position(0, 1)# coloumn,row
lcd.message = "LCD Interfacing"
time.sleep(5)
lcd.clear()

Credits

vinay y.n

vinay y.n

26 projects • 45 followers
An electronic product engineer with 8 years of experience in the field. The passion for electronics began as a hobby 11 years ago.

Comments