Connecting LCD Screen (16×2) to RaspberryPi and displaying temperature, IP and more #3 RaspoElectro

In this post, I will be using the RPi.GPIO library and Python to control the LCD.The LCD used in this post is based on Hitachi HD44780 LCD controller. Although the LCD has 16 pins available for interfacing, using the 4 bit mode only 6 GPIO pins are required (RS,E,D4,D5,D6,D7).

RaspoElectro03

NOTE : I’m not using Adafruit library because it is useless.

What you Will Learn:

  • How to connect 16×2 LCD (HD44780 or others) to GPIO pins.
  • Basics of electronic circuit.
  • Complex Python & Shell coding to display and clear messages from LCD.
  • Calling system variables using python and displaying them on LCD

What you need:

  • Raspberry Pi configured with the GPIO library
  • 16×2 LCD (HD44780)
  • Potentiometer
  • 16 jumper wires (Male-Male)
  • GPIO Cobbler
  • Breadboard

Wiring Structure

 LCD Pin    Pi Pin
01  <>  GPIO 06 (-ve)
02  <>  GPIO-02 (+5v)
03  <>  Contrast adjustment (Middle of potentiometer)
04  <>  GPIO-26
05  <>  GPIO-06
06  <>  GPIO-24
07   –   NOT USED
08   –   NOT USED
09   –   NOT USED
10   –   NOT USED
11  <>  GPIO-22
12  <>  GPIO-18
13  <>  GPIO-16
14  <>  GPIO-12
15  <>  GPIO-02 (+5V)
16  <>  GPIO-06 (-ve)

pinlayoutboard

For Pi pin structure in detail, checkout in my post #1 Raspo Elecro

Python Code/Script

Python code requires proper indent

Dowload Python code “RaspoElectro03.py” & “ip.sh

Code execution Demonstration

Leave a Reply

Your email address will not be published. Required fields are marked *