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.1.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

gc9d01_library-0.1.1-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gc9d01_library-0.1.1.tar.gz
  • Upload date:
  • Size: 6.6 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.1.tar.gz
Algorithm Hash digest
SHA256 f8cc217d62c326d76e8dc85dccfa6e16c0411e8d71729f57f82b067c5a51be65
MD5 75cc0278177edd37afba887d4404ad87
BLAKE2b-256 a575d5bcbd69514d4fec82fec1971bd78dd56b3bbe4a183c5d502ff33ff3f7f5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gc9d01_library-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c91f87f65693de66543b1fe4142548efde38a93daa3e4ae5968f5be656492f7e
MD5 845343feaefc1e9083ad524482b53c69
BLAKE2b-256 fcfc9bd404de9481bafd06b85c5b87779ffcd044aca1e89f2a85d20ca31ec013

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