Skip to main content

A Python driver for the GC9D01 round LCD display on Raspberry Pi

Project description

GC9D01 Display Driver for Raspberry Pi

This project provides a Python driver for the GC9D01 round LCD display, designed to work with Raspberry Pi. It includes a library file (GC9D01.py) and a test script (displaytest.py) to demonstrate basic functionality.

Hardware Requirements

  • Raspberry Pi (any model with GPIO pins)
  • GC9D01 round LCD display
  • Appropriate connections between the Raspberry Pi and the display

Software Requirements

  • Python 3
  • CircuitPython libraries (adafruit_blinka, adafruit_circuitpython_busdevice)

Installation

  1. Clone this repository or download the gc9d01_library folder.

  2. Install the required libraries:

    pip3 install adafruit-blinka adafruit-circuitpython-busdevice
    

Wiring

Connect your GC9D01 display to the Raspberry Pi as follows:

GC9D01 Pin Raspberry Pi Pin GPIO Number Description
VCC Pin 17 3.3V Power
GND Pin 20 GND Ground
SCL Pin 23 GPIO 11 SPI0 SCLK
SDA Pin 19 GPIO 10 SPI0 MOSI
CS Pin 24 GPIO 8 SPI0 CE0
DC Pin 22 GPIO 25 Data/Command
RST Pin 18 GPIO 24 Reset

Note:

  • The pin numbers refer to the physical pin numbers on the Raspberry Pi GPIO header.
  • You can change the pin assignments in the displaytest.py file if needed, but make sure to update your wiring accordingly.
  • Ensure that your Raspberry Pi is powered off when connecting or disconnecting the display to avoid potential damage.

Usage

  1. Import the GC9D01 module in your Python script:

    import gc9d01_library
    

    Alternatively, you can import the GC9D01 class directly:

    from gc9d01_library import GC9D01
    
  2. Set up the SPI and control pins:

    import board
    import busio
    import digitalio
    
    spi = busio.SPI(clock=board.SCK, MOSI=board.MOSI)
    cs = digitalio.DigitalInOut(board.CE0)
    dc = digitalio.DigitalInOut(board.D25)
    rst = digitalio.DigitalInOut(board.D24)
    
  3. Create a display object:

    display = gc9d01_library.GC9D01(spi, dc, cs, rst)
    

    Or, if you imported the class directly:

    display = GC9D01(spi, dc, cs, rst)
    
  4. Use the display methods to draw on the screen:

    display.fill_screen(0xFFFF)  # Fill screen with white
    display.draw_pixel(80, 80, 0xF800)  # Draw a red pixel at (80, 80)
    

Running the Test Script

To run the provided test script:

  1. Ensure your display is correctly connected to the Raspberry Pi.

  2. Run the following command in the terminal:

    python3 displaytest.py
    

This will cycle through different colors on the display.

Available Methods

  • fill_screen(color): Fill the entire screen with a single color
  • draw_pixel(x, y, color): Draw a single pixel at the specified position
  • display_image(image_data): Display a full-screen image

Colors are represented in 16-bit RGB565 format.

Package Structure

The library is structured as follows:

gc9d01_library/
    __init__.py
    GC9D01.py
    displaytest.py

The __init__.py file allows the library to be imported as a Python package.

Troubleshooting

  • If the display doesn't work, double-check your wiring connections.
  • Ensure that SPI is enabled on your Raspberry Pi (raspi-config > Interface Options > SPI).
  • Check that you have the latest version of the required libraries installed.

Contributing

Feel free to contribute to this project by submitting issues or pull requests.

License

This project is open source and available under the MIT License.

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

gc9d01_library-0.1.3.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

gc9d01_library-0.1.3-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file gc9d01_library-0.1.3.tar.gz.

File metadata

  • Download URL: gc9d01_library-0.1.3.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for gc9d01_library-0.1.3.tar.gz
Algorithm Hash digest
SHA256 6e96081d3bfe57583a41116ea942f176eb5534c49fd17ba38e95fbdd3ba0a6c7
MD5 9a338e5c1aabf2898b5c40773fc182c3
BLAKE2b-256 9a53b4b1a21db7b8426a1d84b6a566f201bb4c93be8f36a28937c807ea3b82bf

See more details on using hashes here.

File details

Details for the file gc9d01_library-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for gc9d01_library-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 39c8c46952edff1e7595aba809cd5d9b3f726143b4f60fdf6f30544d1517e17f
MD5 75ca3cefd7b1482a24d8cf9de09a9002
BLAKE2b-256 422b01bda5d6f5803c8526449cf850407dc5dd0ab62b120f35ace0b4ab69bce0

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