Difference between revisions of "1.14-lcd-breakout"

From SB-Components Wiki

 
(4 intermediate revisions by 2 users not shown)
Line 32: Line 32:
 
<tr> <td> GND </td> <td> Ground Supply </td></tr>
 
<tr> <td> GND </td> <td> Ground Supply </td></tr>
 
<tr> <td> VCC </td> <td> Power Supply 3.3V - 5V DC </td></tr>
 
<tr> <td> VCC </td> <td> Power Supply 3.3V - 5V DC </td></tr>
<tr> <td> DIN </td> <td> Serial Data Input / Outout </td></tr>
+
<tr> <td> DIN </td> <td> Serial Data Input / Output </td></tr>
 
<tr> <td> CLK </td> <td> Serial Clock </td></tr>
 
<tr> <td> CLK </td> <td> Serial Clock </td></tr>
 
<tr> <td> CS </td> <td> Chip select input pin ("Low" enable) </td></tr>
 
<tr> <td> CS </td> <td> Chip select input pin ("Low" enable) </td></tr>
Line 48: Line 48:
  
 
==== PICO RP2040 (MicroPython) ====
 
==== PICO RP2040 (MicroPython) ====
 +
 
*  For running this HAT, you require these components :
 
*  For running this HAT, you require these components :
 
** Raspberry Pi Pico X 1
 
** Raspberry Pi Pico X 1
Line 72: Line 73:
 
* Press and hold  '''BOOTSEL''' pin of Raspberry Pi Pico and connect the USB cable, it will create a drive as RPI-RP2.
 
* 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.
+
* Now drag and drop or copy and paste '''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).
 
* Open Thonny IDE and Choose interpreter as MicroPython (Raspberry Pi pico).
Line 113: Line 114:
 
</source>
 
</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.
+
If buffer_size is specified then 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 or else memory required for the data will be allocated dynamically as per the data size. Dynamic allocation can cause heap fragmentation so garbage collection (GC) should be enabled.
  
 
'''This driver supports only 16bit colors in RGB565 notation.'''
 
'''This driver supports only 16bit colors in RGB565 notation.'''

Latest revision as of 10:50, 21 September 2021

1.14" LCD Breakout

1.14 inch LCD Breakout is a 1.14-inch display breakout with a resolution of 240 135 pixels, 65K RGB colours, and a crisp and colorful showing effect, built specifically for cross-platform to broaden its involvement via SPI communication by including a GPIO header. The ST7789 Driver and SPI Interface are included in the 1.14 Inch LCD Breakout, reducing the number of IO pins required.

Features

  • 4-wire SPI Communication
  • Cross-Platform support
  • SPI Interface
  • 1.14 inch display
  • Voltage Level Shifter

Specifications

  • Operating Voltage - 3.3 V / 5V
  • Display Size - 24.91 × 14.86mm
  • Pixels - 240×135 resolution
  • Pixel Size - 0.1101 × 0.1035mm
  • Display Colour - 65K RGB
  • Display Driver - ST7789
  • Voltage Level Shifter - TXB0108PWR
1.14 Round LCD Breakout
Buy it From : Click Here

Pinout

1.14" LCD Breakout Description
GND Ground Supply
VCC Power Supply 3.3V - 5V DC
DIN Serial Data Input / Output
CLK Serial Clock
CS Chip select input pin ("Low" enable)
DC Display data / Command selection pin
DC='1': Display data.
DC='0': Command data
RST Reset Pin. Initialize the chip with a low input
BL Blacklight Control. High: Blacklight on Low: Blacklight off.

Installation

Arduino

If you are using Arduino Ide, you can use the above library.

PICO RP2040 (MicroPython)

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

https://github.com/sbcshop/1.14-LCD-Breakout

  • Connect 1.14 inch LCD breakout with Raspberry Pi Pico as shown in the below pinout.
1.14" LCD Breakout PICO Pins
VCC 3.3V / 5V
GND GND
LCD DIN GP11
LCD CLK GP10
LCD DC GP8
LCD CS GP9
LCD RST GP12
LCD BL GP13
  • 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 drop or copy and paste 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.

114 LCD thonny code.PNG

It will print "Hello World!" on LCD.

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 st7789
spi = SPI(1, baudrate=40000000, sck=Pin(10), mosi=Pin(11))
tft = st7789.ST7789(spi, 135, 240, reset=Pin(12, Pin.OUT), cs=Pin(9, Pin.OUT), dc=Pin(8, Pin.OUT), backlight=Pin(13, Pin.OUT), rotation=3)
tft.init()


Functions and Arguments

  • st7789.ST7789(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` 0-0 degrees, 1-90 degrees, 2-180 degrees, 3-270 degrees
  `buffer_size` 0= buffer dynamically allocated and freed as needed.

If buffer_size is specified then 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 or else memory required for the data will be allocated dynamically as per the data size. Dynamic allocation can cause heap fragmentation so garbage collection (GC) should be enabled.

This driver supports only 16bit colors in RGB565 notation.

  • ST7789.on()

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

  • ST7789.off()

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

  • ST7789.pixel(x, y, color)

Set the specified pixel to the given color.

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

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

  • ST7789.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.

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

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

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

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

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

Fill a rectangle starting from (x, y) coordinates

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

Resources

Github