top of page
Writer's picturePoornima Mani

Interfacing 16*2 LCD with Raspberry Pi using an I2C backpack.

Updated: Sep 29

This article will teach you How to interface a 16*2 LCD with #RaspberryPi using an #I2C module. The process is very simple and can be used for various projects on which you will be working in the future. The article provides you with a step by step guide on "What all components will be required?", "how to connect the LCD with #RaspberryPi?" and working explanation.


List:

The list provides all the hardware and software components that will be required for the interfacing.



Hardware -


1. #RaspberryPi: #RaspberryPi is a single-board microcomputer which utilizes the SoC, DDR RAM memory, ethernet port, USB host, and micro HDMI on it. It provides the opportunity to interact with the outside world and using its processing power in a compact board at a low cost. In this application, we have used the Python IDE to simplify it.


Raspberry Pi

2. LCD Display- 16*2: This is a versatile electronic module that can display 16 characters per line (this module has 2 such lines). It is cheap and easy to use. Keep reading to know about the implementation.

LCD Display

3. #I2CBackpack/Module: This is a general-purpose bi-directional I/O port expander which is used to convert 8-bit data from I2C serial to 8-bit parallel. A major advantage of this module is that it requires only 2 GPIO lines and hence saves a lot of hardware resources.

I2CBackpack/Module


4. USB Cable for power supply: This cord is used to temporarily connect the #RaspberryPi to the power supply.

USB Cable for power supply

5. Male - Female Jumper wires: As simple as it looks, these are used to connect ends without soldering. While male wired have protruding pins to plug into things, female jumpers are the ends that are used to plug into.

Male - Female Jumper wires

Software-


1. SSH Terminal: SH Terminal is used in this project to connect the #RaspberryPi to the terminal of another computer.

SSH Terminal


2. Python IDE: How does this #RaspberryPi actually work? Programming is done in an IDE (Integrated Development Environment) is a platform where we can write code, run and test the working.


Python IDE

Circuit:


The current address of the I2C module is 0x27. The black wire shown in the circuit is the connection of the ground terminal and the red being Vcc (5V). Though there are multiple pins for ground, the idea is to make the circuit tidy and use the closest supply pin. The SDA and SCL at pin3 and pin5 respectively are responsible for data communication.

What goes where?

  1. RPi Pin 2 - 5V Power

  2. RPi Pin 3 - SDA

  3. RPi Pin 5 - SCL

  4. RPi Pin 14 - Ground



Code:


Initially, all the necessary time modules are imported and 'mylcd' is used as a reference.

Inside the while loop, enter the text messages to be displayed. The function used is lcd_display_string where the parameters are the string to be displayed, line number, and row number respectively.

The sleep function is used to provide a delay in the display and the clear function is used to empty the LCD screen.



Note: Convert the file in python-format(.py) to run the above Main code successfully.


Working:


Ensure that the wiring is proper and adjust the lighting using the trimmer on the I2C module. Once the circuit is implemented, enable the I2C interface so that the code can be run. As we power on, the LCD starts flashing with the message that has been programmed into the #RaspberryPi.

Smart Lighting System with Raspberry Pi


Check the output from the images displayed below.

The #I2Cmodule used with the 16*2 LCD saves a lot of wires and makes the circuit less complex. Also, you get to learn the process of #I2C communication while interfacing LCD with #RaspberryPi.


Check the Project Working video here - Interfacing LCD with Raspberry Pi using I2C Backpack

Video By - Sai Parimal

Learn Electronics. (June 17, 2020). Interfacing LCD with Raspberry Pi using I2C Backpack.

See Also:


This circuit can be utilized in many bigger projects such as control panels, smart radios, hospital monitoring systems, etc. In fact, you could come up with an even better idea and make use of this circuit in your hobby projects as well.


Check these out:

Keep learning, keep growing!





Order Electronics Projects


Want us to guide you through your project or make the project for you? Click on the button below or reach out to us via Call/WhatsApp at (+91) - 7600948607


You can -


  • Order Basic Electronics Projects

  • Order Embedded Systems Projects

  • Order IoT Projects

  • Order FPGA Projects

  • Order VLSI Projects

  • Order Image Processing Projects

  • Order Matlab Projects

  • Order TinkerCAD Projects

  • Order Proteus Projects


Click on the button below to fill out the project inquiry form -





Create Various Projects


Check out our Free Arduino Projects Playlist - Arduino Projects 

Check out our Free Raspberry Pi Projects Playlist - Raspberry Pi Projects 

Check out our Free TinkerCAD Projects Playlist - TinkerCAD Projects 

Check out our Free IoT Projects Playlist - IoT Projects 

Check out our Free Home Automation Projects Playlist - Home Automation Projects 

Check out our Free NodeMCu Projects Playlist - NodeMCu Projects 


Follow us -


Please do follow us i.e. #learnelectronicsindia to get daily updates about new blogs, videos, courses, products, offers, competitions, quizzes, and Internship Opportunities.




441 views2 comments

Related Posts

See All

2 Comments


Anushka Gupta
Anushka Gupta
Aug 01, 2023

This blog is a game-changer! I've struggled with LCD interfacing before, but Learn Electronics India's approach made it feel like a walk in the park. I'm grateful for the valuable insights shared in this article.

Like

ashitanarvekar2002
Jul 17, 2023

Informative and concise! LearnElectronics India always delivers quality content.

Like
bottom of page