Team1 display

From Sketching with Hardware at LMU Wiki
Jump to navigation Jump to search

Waveshare 1.28inch LCD Module[edit]

The 1.28inch LCD Module is a display, that can be used to show the time, images, etc. Using the included library, there are simple commands to display characters or geometric shapes that can then represent a clock or any other kind of drawing.

Specifications and Pinout[edit]

Specifications[edit]

  • Operating voltage: 3.3V/5V
  • SPI interface
  • IPS LCD display
  • GC9A01 controller
  • 240 (H)RGB x 240(V) resolution
  • Φ32.4mm display size
  • 0.135(H)x 0.135(V)mm pixel size
  • Overall size of 40.4 × 37.5(mm) Φ37.5(mm)

Pinout[edit]

  • VCC
  • GND
  • DIN: Data In
  • CLK: Clock
  • CS: Chip Select
  • DC: Data command pin
  • RST: Reset
  • BL: Backlight

Advantages and Disadvantages[edit]

Advantages[edit]

  • Good size: Φ37.5(mm)
  • Lightweight: 10g
  • Flat design
  • SPI interface
  • Comes with install guide and code examples

Disadvantages[edit]

  • Does not work with Raspberry Pi Pico
  • "Just" a LCD display. Similar ones have OLED
  • Many wires needed

Instruction[edit]

In this example an Arduino Uno was used to power the display. Other options would be a Respberry Pi or a STM32.

Wiring and Setup[edit]

You can use a breadboard to achieve these connections or you simply connect the LCD display to your Arduino Uno using additional wires with solid tips. Make sure you have downloaded the Arduino IDE.

Wiring[edit]
  • VCC to 5V
  • GND to GND
  • DIN to Pin 11
  • CLK to Pin 13
  • CS to Pin 10
  • DC to Pin 7
  • RST to Pin 8
  • BL to Pin 9

After wiring, use this download link (Download me) to get the library that is used for this LCD display. Unzip the file and open the Arduino folder as we are using the Arduino Uno device. Next, choose the folder with the correct display size. In this example we are using the 1.28inch display. Therefore, the correct folder is "LCD_1inch28". Inside this folder you will find an INO-File with the title "LCD_1inch28". Just double click this file to open it in the Arduino IDE.

As you can see in this file, there are many commands to draw lines, circles, or letters on the display. In each of these commands, you are able to set the position on the canvas (first four arguments) as well as the color, thickness, and filling of the pixels (last three arguments). You can also upload stored images with the Paint_DrawImage function or write some letters on the display with Paint_DrawString_EN.

 1 #include <SPI.h>
 2 #include "LCD_Driver.h"
 3 #include "GUI_Paint.h"
 4 #include "image.h"
 5 
 6 void setup()
 7 {
 8   Config_Init();
 9   LCD_Init();
10   LCD_SetBacklight(1000);
11   Paint_NewImage(LCD_WIDTH, LCD_HEIGHT, 0, BLACK);
12   Paint_Clear(BLACK);
13 
14   Paint_DrawCircle(120,120, 120, BLUE ,DOT_PIXEL_2X2,DRAW_FILL_EMPTY);
15   Paint_DrawLine  (120, 0, 120, 12,GREEN ,DOT_PIXEL_4X4,LINE_STYLE_SOLID);
16   Paint_DrawLine  (120, 228, 120, 240,GREEN ,DOT_PIXEL_4X4,LINE_STYLE_SOLID);
17   Paint_DrawLine  (0, 120, 12, 120,GREEN ,DOT_PIXEL_4X4,LINE_STYLE_SOLID);
18   Paint_DrawLine  (228, 120, 240, 120,GREEN ,DOT_PIXEL_4X4,LINE_STYLE_SOLID);
19   Paint_DrawImage(gImage_70X70, 85, 25, 70, 70); 
20   Paint_DrawString_CN(56,140, "微雪电子",   &Font24CN,BLACK,  WHITE);
21   Paint_DrawString_EN(123, 123, "WAVESHARE",&Font16,  BLACK, GREEN);
22   Paint_DrawLine  (120, 120, 70, 70,YELLOW ,DOT_PIXEL_3X3,LINE_STYLE_SOLID);
23   Paint_DrawLine  (120, 120, 176, 64,BLUE ,DOT_PIXEL_3X3,LINE_STYLE_SOLID);
24   Paint_DrawLine  (120, 120, 120, 210,RED ,DOT_PIXEL_2X2,LINE_STYLE_SOLID); 
25 }

After plugging in the Arduino Uno to your computer, press the upload button in the Arduino IDE. After a few seconds you should see the LCD display showing a basic clock display. Now you can add or change some of the Paint-commands to build your own image on the display.

Instructional Video[edit]