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).
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 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
Documentation
You can find the documentation here: https://readthedocs.org/projects/rplcd/
Testing
Test Scripts
To test your 20x4 display, please run the test_20x4.py script and confirm/verify each step with the enter key. If you don’t use the standard wiring, make sure to add your pin numbers to the CharLCD constructor in test_20x4.py.
To test a 16x2 display, proceed as explained above, but use the test_16x2.py script instead.
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.
The module RPLCD/enum.py is (c) 2004-2013 by Barry Warsaw. It was distributed as part of the flufl.enum package under the LGPL License version 3 or later.
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-0.9.0.tar.gz
.
File metadata
- Download URL: RPLCD-0.9.0.tar.gz
- Upload date:
- Size: 26.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bdac58f0b0401471689c8a0761f1fa96425e30e8b28ef665e47c89eea1417eff |
|
MD5 | edc7f592c233a6f1841c81e276b9d2e7 |
|
BLAKE2b-256 | 7ddad2a1be6d7b4b4c880607c6bd108e69ff25f3dee3d3209997ceb4e8b503e4 |
File details
Details for the file RPLCD-0.9.0-py2.py3-none-any.whl
.
File metadata
- Download URL: RPLCD-0.9.0-py2.py3-none-any.whl
- Upload date:
- Size: 29.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c915b2791a91d129db197740e05e8f751f1d93fb51ba4ff6a9009ec9accaf3e4 |
|
MD5 | 812b489dca0d1aa8e58d5f3e4591c9d9 |
|
BLAKE2b-256 | ed40a3cbce842f6dcc7022339031b68b9df0140e3288d12188d79b1fac00d820 |