A Raspberry Pi LCD library for the widely used Hitachi HD44780 controller.
Project description
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 I2C 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.
No external dependencies (except the RPi.GPIO library, which comes preinstalled on Raspbian) are needed to use this library.
Setup
You can install RPLCD directly from PyPI using pip:
$ sudo pip install RPLCD
If you want to use I2C, you also need smbus:
$ sudo apt install python-smbus
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 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
You can find the documentation here: https://readthedocs.org/projects/rplcd/
Testing
Interactive Test Script
To test your LCD, please run the lcdtest.py 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
TC2004A-01 Data Sheet: http://www.adafruit.com/datasheets/TC2004A-01.pdf
HD44780U Data Sheet: http://www.adafruit.com/datasheets/HD44780.pdf
License
This code is licensed under the MIT license, see the LICENSE file or tldrlegal for more information.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file RPLCD-1.0.0.tar.gz
.
File metadata
- Download URL: RPLCD-1.0.0.tar.gz
- Upload date:
- Size: 24.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a741fa9358c12456a74719ce08143444acd1ececaf9fccc69fa9765446cef289 |
|
MD5 | 275c2039bf465b3c4ddad180b90ea287 |
|
BLAKE2b-256 | cfad25c9427e4eb9994551bb391cabb8d9ddc9bc5fdceafa19dd859137df6848 |
File details
Details for the file RPLCD-1.0.0-py2.py3-none-any.whl
.
File metadata
- Download URL: RPLCD-1.0.0-py2.py3-none-any.whl
- Upload date:
- Size: 33.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab932f61959f2c80316331e0b6d00da238056fd3e15eeaa0613c6f2e8b084f1a |
|
MD5 | b1b589d344ea76d87a88aab3c479125f |
|
BLAKE2b-256 | b861916392283077e22e734abc45349c50576f59a9bfc652db5f845b4b386304 |