This library is compatible with standard Character LCDs such as:
Installing from PyPI¶
On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally from PyPI. To install for current user:
pip3 install adafruit-circuitpython-charlcd
To install system-wide (this may be required in some cases):
sudo pip3 install adafruit-circuitpython-charlcd
To install in a virtual environment in your current project:
mkdir project-name && cd project-name python3 -m venv .venv source .venv/bin/activate pip3 install adafruit-circuitpython-charlcd
This driver depends on:
I2C & SPI displays also depend on:
Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle.
Character_LCD class interfaces a predefined Character LCD display with CircuitPython.
import board import digitalio import adafruit_character_lcd.character_lcd as character_lcd
You must define the data pins (
D7) in your code before using the
If you want to have on/off
backlight functionality, you can also define your backlight as
lcd_backlight. Otherwise, the backlight
will always remain on. The following is an example setup.
lcd_rs = digitalio.DigitalInOut(board.D7) lcd_en = digitalio.DigitalInOut(board.D8) lcd_d7 = digitalio.DigitalInOut(board.D12) lcd_d6 = digitalio.DigitalInOut(board.D11) lcd_d5 = digitalio.DigitalInOut(board.D10) lcd_d4 = digitalio.DigitalInOut(board.D9) lcd_backlight = digitalio.DigitalInOut(board.D13)
You must also define the size of the CharLCD by specifying its
lcd_columns = 16 lcd_rows = 2
After you have set up your LCD, we can make the device by calling it
lcd = character_lcd.Character_LCD_Mono(lcd_rs, lcd_en, lcd_d4, lcd_d5, lcd_d6, lcd_d7, lcd_columns, lcd_rows, lcd_backlight)
To verify that your pins are correct, print a hello message to the CharLCD:
lcd.message = "Hello\nCircuitPython"
Custom character example with
create_char() is provided within /examples/
API documentation for this library can be found on Read the Docs.
For information on building library documentation, please check out this guide.
Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.
Table of Contents¶
- Standard LCD 16x2 + extras - white on blue
- Adafruit Standard LCD 20x4 + extras - white on blue
- Adafruit Character LCDs
- Adafruit i2c / SPI character LCD backpack
- Adafruit RGB backlight negative LCD 16x2 + extras - RGB on black
- Adafruit RGB LCD Shield Kit w/ 16x2 Character Display
- Adafruit RGB Positive 16x2 LCD+Keypad Kit for Raspberry Pi
- Adafruit RGB Negative 16x2 LCD+Keypad Kit for Raspberry Pi