Difference between revisions of "Pico-1.28-Round-LCD-HAT"

From SB-Components Wiki

 
(18 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
<div class="row">
 
<div class="row">
 
   <div class="large-8 column">
 
   <div class="large-8 column">
== Pico 1.28" Round LCD HAT (Incomplete Wiki) ==
+
== Pico 1.28" Round LCD HAT ==
 
Pico 1.28” Round LCD HAT is a 1.28-inch display HAT with 240 x 240 resolution, 65K RGB colors, clear and colorful displaying effect, and a joystick, designed for the Raspberry Pi Pico to expand its engagement via SPI communication by providing a standard 40 pin Pico GPIO interface. The Pico 1.28" Round LCD HAT includes an integrated GC9A01 display driver and SPI interface, reducing the number of IO pins required. It features a 5-input joystick that is connected to the Pico 1.28” Round LCD HAT through a stackable GPIO connector header on the inside.
 
Pico 1.28” Round LCD HAT is a 1.28-inch display HAT with 240 x 240 resolution, 65K RGB colors, clear and colorful displaying effect, and a joystick, designed for the Raspberry Pi Pico to expand its engagement via SPI communication by providing a standard 40 pin Pico GPIO interface. The Pico 1.28" Round LCD HAT includes an integrated GC9A01 display driver and SPI interface, reducing the number of IO pins required. It features a 5-input joystick that is connected to the Pico 1.28” Round LCD HAT through a stackable GPIO connector header on the inside.
  
Line 20: Line 20:
 
</div>
 
</div>
 
   <div class="large-4 column">
 
   <div class="large-4 column">
[[File:PICO_128_LCD.png|thumb|left|alt=Pico 1.28 Round LCD HAT| Buy it From : ''[ Click Here]'']]
+
[[File:Pico_round_LCD.png|thumb|left|alt=Pico 1.28 Round LCD HAT| Buy it From : ''[https://shop.sb-components.co.uk/products/1-28-round-lcd-hat-for-pico Click Here]'']]
 
   </div>
 
   </div>
 
</div>
 
</div>
Line 44: Line 44:
 
== Installation ==
 
== Installation ==
 
==== MicroPython ====
 
==== MicroPython ====
 +
Before starting, Make sure you have the v1.15 version of Micropython installed on your Pico board.
 +
 
*  For running this HAT, you require these components :
 
*  For running this HAT, you require these components :
** Raspberry Pi Pico = 1
+
** Raspberry Pi Pico X 1
** Pico 1.28" Round LCD HAT = 1
+
** Pico 1.28" Round LCD HAT X 1
** USB Cable = 1
+
** USB Cable X 1
 +
 
 +
* Copy or clone code from Github.
 +
https://github.com/sbcshop/PICO-1.28-Round-LCD-HAT/
 +
 
 +
* Stack Pico 1.28 Round LCD HAT with Raspberry Pi Pico, Make sure USB symbol on LCD HAT should be on the same side as of PICO USB.
 +
 
 +
* Press and hold  '''BOOTSEL''' pin of Raspberry Pi Pico and connect the USB cable, it will create a drive as RPI-RP2.
 +
 
 +
* Now drag and drog/copy '''firmware.uf2''' file from firmware folder to RPI-RP2 Drive. It will reboot your raspberry pi pico.
 +
 
 +
* Open Thonny IDE and Choose interpreter as MicroPython (Raspberry Pi pico).
 +
[[File:Thonny-interpreter.PNG|600px]]
 +
 
 +
* Now you can run example codes from the '''Pico_Example_mpy''' folder in Thonny Ide. For example, Open the '''hello.py''' file in thonny and click on the green play button to run this example.
 +
[[File:Pico_Round_lcd_HAT_thonny.PNG]]
  
* Stack Pico 1.28 Round LCD HAT with Raspberry Pi Pico, MAke sure USB symbol on LCD HAT shuld be on same side of PICO USB.
+
It will print "Hello" on Round LCD. You can use the joystick to change the LCD color.
  
* Press and hold  '''BOOTSEL''' pin of Raspberry Pi Pico and connect USB cable, it will create a drive as RPI-RP2.
+
==== Working Example ====
 +
* This module was tested on Raspberry Pi Pico. You need to provide a SPI object and the pin to use for the DC pin of the screen.
  
* Now drag and drog/ copy '''firmware.uf2''' file from firmware folder to RPI-RP2 Drive. It will reboot your raspberry pi pico.
+
<source lang="python">
 +
import machine
 +
import gc9a01
 +
spi = SPI(1, baudrate=40000000, sck=Pin(10), mosi=Pin(11))
 +
tft = gc9a01.GC9A01(spi, 240, 240, reset=Pin(12, Pin.OUT), cs=Pin(9, Pin.OUT), dc=Pin(8, Pin.OUT), backlight=Pin(13, Pin.OUT), rotation=0)
 +
tft.init()
 +
</source>
  
*
+
 
 +
==== Functions and Arguments ====
 +
* <source inline>  gc9a01.GC9A01(spi, width, height, reset, dc, cs, backlight, rotation, buffer_size) </source>
 +
required arguments:
 +
<source>
 +
`spi` spi device
 +
  `width` display width
 +
  `height` display height
 +
</source>
 +
 
 +
optional args:
 +
<source>
 +
  `reset` reset pin
 +
  `dc` dc pin
 +
  `cs` cs pin
 +
  `backlight` backlight pin
 +
  `rotation` Orientation of display.
 +
  `buffer_size` 0= buffer dynamically allocated and freed as needed.
 +
 
 +
  Rotation | Orientation
 +
  -------- | --------------------
 +
    0    | 0 degrees
 +
    1    | 90 degrees
 +
    2    | 180 degrees
 +
    3    | 270 degrees
 +
    4    | 0 degrees mirrored
 +
    5    | 90 degrees mirrored
 +
    6    | 180 degrees mirrored
 +
    7    | 270 degrees mirrored
 +
</source>
 +
If buffer_size is specified it must be large enough to contain the largest bitmap, font character, and/or JPG used (Rows * Columns *2 bytes). Specifying a buffer_size reserves memory for use by the driver otherwise, memory required is allocated and free dynamically as it is needed. Dynamic allocation can cause heap fragmentation so garbage collection (GC) should be enabled.
 +
 
 +
'''This driver supports only 16bit colors in RGB565 notation.'''
 +
 
 +
* <source inline> GC9A01.on() </source>
 +
 
 +
Turn on the backlight pin if one was defined during init.
 +
 
 +
* <source inline> GC9A01.off() </source>
 +
 
 +
Turn off the backlight pin if one was defined during init.
 +
 
 +
* <source inline> GC9A01.pixel(x, y, color) </source>
 +
 
 +
Set the specified pixel to the given color.
 +
 
 +
* <source inline> GC9A01.line(x0, y0, x1, y1, color) </source>
 +
 
 +
Draws a single line with the provided color from (x0, y0) to (x1, y1).
 +
 
 +
* <source inline> GC9A01.hline(x, y, length, color) </source>
 +
 
 +
Draws a single horizontal line with the provided color and length in pixels. Along with vline, this is a fast version with reduced number of SPI calls.
 +
 
 +
* <source inline> GC9A01.vline(x, y, length, color) </source>
 +
 
 +
Draws a single horizontal line with the provided color and length in pixels.
 +
 
 +
* <source inline> GC9A01.rect(x, y, width, height, color) </source>
 +
 
 +
Draws a rectangle from (x, y) with corresponding dimensions
 +
 
 +
* <source inline> GC9A01.fill_rect(x, y, width, height, color) </source>
 +
 
 +
Fill a rectangle starting from (x, y) coordinates
 +
 
 +
Source code credit : https://github.com/russhughes/gc9a01_mpy
  
 
== Resources ==
 
== Resources ==
 +
<b> Github </b>
 +
* [https://github.com/sbcshop/PICO-1.28-Round-LCD-HAT Source Code]
 +
 +
<b> Datasheet </b>
 +
* [https://github.com/sbcshop/Round-LCD-HAT/blob/main/lib/GC9A01A%20Datasheet.pdf GC9A01 Datasheet]

Latest revision as of 10:48, 21 September 2021

Pico 1.28" Round LCD HAT

Pico 1.28” Round LCD HAT is a 1.28-inch display HAT with 240 x 240 resolution, 65K RGB colors, clear and colorful displaying effect, and a joystick, designed for the Raspberry Pi Pico to expand its engagement via SPI communication by providing a standard 40 pin Pico GPIO interface. The Pico 1.28" Round LCD HAT includes an integrated GC9A01 display driver and SPI interface, reducing the number of IO pins required. It features a 5-input joystick that is connected to the Pico 1.28” Round LCD HAT through a stackable GPIO connector header on the inside.

Features

  • Raspberry Pi Pico compatibility.
  • 4-wire SPI Communication.
  • Standard Raspberry Pi Pico 40 Pins GPIO.
  • 4 directions + attached band Central press button Joystick Control

  • Specifications

  • Operating Voltage - 3.3 V
  • Pixels - 240×240 resolution
  • Pixel Size - 0.135 × 0.135mm
  • Display Colour - 65K RGB
  • Display Driver - GC9A01
  • Pico 1.28 Round LCD HAT
    Buy it From : Click Here

    Pinout

    PICO 1.28" LCD HAT PICO Pins
    LCD DIN GP11
    LCD CLK GP10
    LCD DC GP8
    LCD CS GP9
    LCD RST GP12
    LCD BL GP13
    JOYSTICK UP GP18
    JOYSTICK DOWN GP20
    JOYSTICK LEFT GP21
    JOYSTICK RIGHT GP17
    JOYSTICK SELECT GP19

    Installation

    MicroPython

    Before starting, Make sure you have the v1.15 version of Micropython installed on your Pico board.

    • For running this HAT, you require these components :
      • Raspberry Pi Pico X 1
      • Pico 1.28" Round LCD HAT X 1
      • USB Cable X 1
    • Copy or clone code from Github.

    https://github.com/sbcshop/PICO-1.28-Round-LCD-HAT/

    • Stack Pico 1.28 Round LCD HAT with Raspberry Pi Pico, Make sure USB symbol on LCD HAT should be on the same side as of PICO USB.
    • Press and hold BOOTSEL pin of Raspberry Pi Pico and connect the USB cable, it will create a drive as RPI-RP2.
    • Now drag and drog/copy firmware.uf2 file from firmware folder to RPI-RP2 Drive. It will reboot your raspberry pi pico.
    • Open Thonny IDE and Choose interpreter as MicroPython (Raspberry Pi pico).

    Thonny-interpreter.PNG

    • Now you can run example codes from the Pico_Example_mpy folder in Thonny Ide. For example, Open the hello.py file in thonny and click on the green play button to run this example.

    Pico Round lcd HAT thonny.PNG

    It will print "Hello" on Round LCD. You can use the joystick to change the LCD color.

    Working Example

    • This module was tested on Raspberry Pi Pico. You need to provide a SPI object and the pin to use for the DC pin of the screen.
    import machine
    import gc9a01
    spi = SPI(1, baudrate=40000000, sck=Pin(10), mosi=Pin(11))
    tft = gc9a01.GC9A01(spi, 240, 240, reset=Pin(12, Pin.OUT), cs=Pin(9, Pin.OUT), dc=Pin(8, Pin.OUT), backlight=Pin(13, Pin.OUT), rotation=0)
    tft.init()


    Functions and Arguments

    • gc9a01.GC9A01(spi, width, height, reset, dc, cs, backlight, rotation, buffer_size)

    required arguments:

    `spi` spi device
      `width` display width
      `height` display height

    optional args:

    `reset` reset pin
      `dc` dc pin
      `cs` cs pin
      `backlight` backlight pin
      `rotation` Orientation of display.
      `buffer_size` 0= buffer dynamically allocated and freed as needed.
    
      Rotation | Orientation
      -------- | --------------------
         0     | 0 degrees
         1     | 90 degrees
         2     | 180 degrees
         3     | 270 degrees
         4     | 0 degrees mirrored
         5     | 90 degrees mirrored
         6     | 180 degrees mirrored
         7     | 270 degrees mirrored

    If buffer_size is specified it must be large enough to contain the largest bitmap, font character, and/or JPG used (Rows * Columns *2 bytes). Specifying a buffer_size reserves memory for use by the driver otherwise, memory required is allocated and free dynamically as it is needed. Dynamic allocation can cause heap fragmentation so garbage collection (GC) should be enabled.

    This driver supports only 16bit colors in RGB565 notation.

    • GC9A01.on()

    Turn on the backlight pin if one was defined during init.

    • GC9A01.off()

    Turn off the backlight pin if one was defined during init.

    • GC9A01.pixel(x, y, color)

    Set the specified pixel to the given color.

    • GC9A01.line(x0, y0, x1, y1, color)

    Draws a single line with the provided color from (x0, y0) to (x1, y1).

    • GC9A01.hline(x, y, length, color)

    Draws a single horizontal line with the provided color and length in pixels. Along with vline, this is a fast version with reduced number of SPI calls.

    • GC9A01.vline(x, y, length, color)

    Draws a single horizontal line with the provided color and length in pixels.

    • GC9A01.rect(x, y, width, height, color)

    Draws a rectangle from (x, y) with corresponding dimensions

    • GC9A01.fill_rect(x, y, width, height, color)

    Fill a rectangle starting from (x, y) coordinates

    Source code credit : https://github.com/russhughes/gc9a01_mpy

    Resources

    Github

    Datasheet