Skip to main content

A Raspberry Pi LCD library for the widely used Hitachi HD44780 controller.

Project description

Join the chat at https://gitter.im/RPLCD/Lobby Build Status PyPI Version PyPI Wheel PyPI Python Versions Dependencies License

A Python 3/2 Raspberry PI Character LCD library for the Hitachi HD44780 controller. It supports both GPIO (parallel) mode as well as boards with an I²C port expander (e.g. the PCF8574 or the MCP23008).

This library is inspired by Adafruit Industries’ CharLCD library as well as by Arduino’s LiquidCrystal library.

For GPIO mode, no external dependencies (except the RPi.GPIO library, which comes preinstalled on Raspbian) are needed to use this library. If you want to control LCDs via I²C, then you also need the python-smbus or smbus2 library. If you want to control the LCD with pigpio, you have to install the pigpio library.

If you’re trying to get started with RPLCD, you should probably read the docs :)

Photo of 20x4 LCD in action

Setup

You can install RPLCD directly from PyPI using pip:

$ sudo pip install RPLCD

If you want to use I²C, you also need either the smbus or smbus2 library:

$ sudo apt install python-smbus
or
$ sudo pip install smbus2

RPLCD will first try to use smbus if available and if not, fall back to smbus2.

You can also install the library manually without pip. Either just copy the scripts to your working directory and import them, or download the repository and run python setup.py install to install it into your Python package directory.

Features

Implemented

  • Simple to use API

  • Support for both 4 bit and 8 bit modes

  • Support for both parallel (GPIO) and I²C connection

  • Support for custom characters

  • Support for backlight control circuits

  • Built-in support for A00 and A02 character tables

  • Python 2/3 compatible

  • Caching: Only write characters if they changed

  • No external dependencies (except RPi.GPIO, and python-smbus or smbus2 if you need I²C support)

Wishlist

These things may get implemented in the future, depending on my free time and motivation:

  • MicroPython port

Supported I²C Port Expanders

  • PCF8574 (used by a lot of I²C LCD adapters on Ali Express)

  • MCP23008 (used in Adafruit I²C LCD backpack)

  • MCP23017

Documentation

Testing

Interactive Test Script

To test your LCD, please run the rplcd-tests script with the testsuite target.

Unit Tests

There are also unit tests. First, install dependencies:

pip install -U -r requirements-dev.txt

Then run the tests:

py.test -v

Coding Guidelines

PEP8 via flake8 with max-line-width set to 99 and E126-E128,C901 ignored:

flake8 --max-line-length=99 --ignore=E126,E127,E128,C901 RPLCD/lcd.py

Resources

License

This code is licensed under the MIT license, see the LICENSE file or tldrlegal for more information.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

RPLCD-1.2.1.tar.gz (24.9 kB view details)

Uploaded Source

Built Distribution

RPLCD-1.2.1-py2.py3-none-any.whl (33.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file RPLCD-1.2.1.tar.gz.

File metadata

  • Download URL: RPLCD-1.2.1.tar.gz
  • Upload date:
  • Size: 24.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.2

File hashes

Hashes for RPLCD-1.2.1.tar.gz
Algorithm Hash digest
SHA256 c94b1eccf622d8d678bc3f5941fd491eccbf9257d5b157ac7f840a49010cd8ce
MD5 46408c020c6e46f303630bd5f2bfac55
BLAKE2b-256 1f59f8b976878a866dba94b14dc80e4e330ef14543d0b8c83b02e751feb70b7d

See more details on using hashes here.

File details

Details for the file RPLCD-1.2.1-py2.py3-none-any.whl.

File metadata

  • Download URL: RPLCD-1.2.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 33.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.2

File hashes

Hashes for RPLCD-1.2.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 c9a8994147804209f70efebf7670afbcf400fa3a555736a2dea0781683b77378
MD5 2ba15cfe29cfa550d92841c09192c5a1
BLAKE2b-256 89c995c1e2007d2c652b1a08bdaef6b988b36b9665a0d6ade7bcaadcd8278167

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page