LUCKFOX 1.5 Inch 65K Color OLED Display Module User Guide

June 1, 2024
LUCKFOX

LUCKFOX 1.5 Inch 65K Color OLED Display Module

Specifications

  • Operating voltage: 3.3V/5V (Ensure power supply voltage and logic voltage are consistent)
  • Support interface: 4-wire SPI, 3-wire SPI
  • Controller: SSD1351
  • Resolution: 128(H)RGB x 128(V)
  • Dimension: 26.855H x 26.855V mm
  • Pixel size: 0.045(H) x 0.194(V) mm
  • Display color: 65K color
  • 128 x 128, 1.5inch

Product Usage Instructions

Hardware Configuration
This OLED module supports both 4-wire SPI and 3-wire SPI communication methods. The default mode is 4-wire SPI. The communication method can be changed by soldering the appropriate resistor on the back of the module.

OLED and Controller Information
The OLED module uses the SSD1351 controller, supporting 262k and 65k color depths. It utilizes a 128x128x18bit SRAM for the display buffer area and offers various communication methods.

4-Wire SPI Communication Protocol
In 4-wire SPI mode, set the DC pin to indicate command or data transmission. Refer to the SSD1351 datasheet for detailed information on sending commands and data.

3-Wire SPI Communication Protocol
3-wire SPI mode eliminates the need for separate DC pins by adding a bit before each transfer byte to identify command or data transmission. The DC pin needs to be grounded, and each transfer is 9 bits.

Module Settings
The default settings include horizontal scan, 16-bit true color with high order first.

Raspberry Pi Software Instructions
This product offers demos for BCM2835, WiringPi, file IO, and RPI (Python) libraries for Raspberry Pi integration.

Hardware Connection with Raspberry Pi
When connecting to Raspberry Pi, use a 7-pin cable and refer to the pin correspondence table for proper connections.

FAQ

  • Q: How do I change the communication method on the OLED module?
    A: To change the communication method, solder the appropriate resistor on the back of the module as per the instructions provided.

  • Q: Can this OLED module be used with Arduino?
    A: Yes, this OLED module provides demos for Arduino integration along with Raspberry Pi and STM32.

Introduction

LUCKFOX-1-5-Inch-65K-Color-OLED-Display-Module-FIG-
\(1\)

1.5-inch RGB OLED Module provides Raspberry Pi, STM32, and Arduino demos.

Specification

  • Operating voltage: 3.3V/5(Please ensure that the power supply voltage and logic voltage are consistent, otherwise it will not work properly)
  • Support interface: 4-wire SPI, 3-wire SPI
  • Controller: SSD1351
  • Resolution: 128(H)RGB x 128(V)
  • Dimension: 26.855(H) x 26.855 (V) mm
  • Pixel size: 0.045(H) x 0.194(V) mm
  • Display color: 65K color

Pinout

PS: This module only has SPI interface, please pay attention when using it.IP Enclosures IP-ACIWM300.432 Air Conditioner for Electrical Enclosure
IMG 90

Hardware Configuration

  • This OLED module provides two communication methods: 4-wire SPI and 3wire-SPI
  • On the back of the module there is an optional solderable resistor through which the communication method is selected.

As shown below:

The module uses 4-wire SPI communication by default, that is, BSO is connected to 0 by default

Note : The following table shows the interface connections.IP
Enclosures IP-ACIWM300.432 Air Conditioner for Electrical Enclosure IMG
91

OLED and its controller

  • The built-in driver used by this OLED is SSD1351, which is a 128RGB 128 Dot Matrix OLED/PLED controller with a 128128*18bit SRAM as a display buffer area, which supports two color depths of 262k and 65k. And supports 8bit 8080 parallel, 8bit 6800 parallel, 3wire-SPI and 4wire-SPl and other communication methods.
  • This module selects 4wire-SPI and 3wire-SPI as the communication method, which reduces the area of the module and saves the 10 resources of the controller.

4WIRE-SPI Communication Protocol

LUCKFOX-1-5-Inch-65K-Color-OLED-
Display-Module-FIG- \(3\)

  • In 4wire-SPI communication, first set DC to 1 or 0, and then send one or more bytes of data
  • When DC is set to 0, the sent byte will be used as a command to control the OLED. When sending a command, generally only one byte is sent at a time.
  • When DC is set to 1, the transmitted bytes will be stored in the designated register or SRAM SSD1351 as data. When sending data, multiple bytes can be sent in succession.
  • See SSD1351 Datasheet Figure 8-5 for details.

3WIRE-SPI communication protocolLUCKFOX-1-5-Inch-65K-Color-OLED-Display-
Module-FIG- \(4\)

  • The only difference between 3wire-SPI and 4wire-SPI is that it removes the DC pins that control sending commands and data
  • A bit is added before each SPI transfer byte to identify whether the byte is a command or dat
  • Therefore, in 3wire-SPI, the DC pin needs to be grounded. In addition, the data transmitted each time is not 8bit, but 9bit.

**Modulo settings

LUCKFOX-1-5-Inch-65K-Color-OLED-Display-Module-FIG-
\(5\)**

The reference settings are as shown: horizontal scan, 16-bit true color, high order first

Raspberry Pi Software Instructions

This product provides BCM2835, WiringPi, file IO, RPI (Python) library demos

Hardware connection

When connecting the Raspberry Pi, choose to use the 7PIN cable to connect, please refer to the pin correspondence table below.
Raspberry Pi connection pin correspondenceIP Enclosures IP-ACIWM300.432 Air
Conditioner for Electrical Enclosure IMG 92

Four-wire SPI wiring diagramLUCKFOX-1-5-Inch-65K-Color-OLED-Display-
Module-FIG- \(6\)

Enable SPI and I2C interfaces
Open terminal, use command to enter the configuration pageLUCKFOX-1-5-Inch-
65K-Color-OLED-Display-Module-FIG- \(7\)

Reboot Raspberry P:

Please make sure that SPI interface was not used by other devices
I2C is the same, enter the configuration interface and select Interfaceing Options -> I2C -> Yes to open the IIC interface, and then restart

Install Libraries

Install BCM2835 librariesLUCKFOX-1-5-Inch-65K-Color-OLED-Display-Module-FIG-
\(9\)

Install wiringPi librariesLUCKFOX-1-5-Inch-65K-Color-OLED-Display-Module-
FIG- \(10\)

Install Python librariesLUCKFOX-1-5-Inch-65K-Color-OLED-Display-Module-
FIG- \(11\)

Download Examples
Open Raspberry Pi terminal and run the following commandLUCKFOX-1-5-Inch-
65K-Color-OLED-Display-Module-FIG- \(12\)

Run the demo codes

Please go into the RaspberryPi directory (demo codes) first and run the commands in terminal

C Codes

  • Re-compile the demo codesLUCKFOX-1-5-Inch-65K-Color-OLED-Display-Module-FIG- \(13\)
  • After the compilation is complete, the main file is generateendt,e r the command according to the OLED model you are usin gI.f you have purchased a 1.3inch OLED Module (C), please enter the following command:LUCKFOX-1-5-Inch-65K-Color-OLED-Display-Module-FIG- \(14\)
  • If you have purchased a 1.5inch RGB OLED Module, please enter the following command:LUCKFOX-1-5-Inch-65K-Color-OLED-Display-Module-FIG- \(15\)
  • The command of each LCD model can check in the following table:LUCKFOX-1-5-Inch-65K-Color-OLED-Display-Module-FIG- \(16\)

Python

  • Enter the python directory and runLUCKFOX-1-5-Inch-65K-Color-OLED-Display-Module-FIG- \(17\)

  • Run the demo of the corresponding model OL,E tDhe program supports python2/3
    If you have purchased a 1.3inch OLED Module (C), please enterLUCKFOX-1-5
-Inch-65K-Color-OLED-Display-Module-FIG- \(18\)

  • If you have purchased a 1.5inch RGB OLED Module, please enterLUCKFOX-1-5-Inch-65K-Color-OLED-Display-Module-FIG- \(19\)

  • The command of each LCD model can check in the following table:LUCKFOX-1-5-Inch-65K-Color-OLED-Display-Module-FIG- \(20\)

  • Please make sure that the SPI is not occupied by other devices, you can check in the middle of /boot/config.txt

Description of C codes (API)

We have carried out the low-level encapsulation, if you need to know the internal implementation can go to the corresponding directory to check, for the reason the hardware platform and the internal implementation are different.
You can open DEV_Config.c(.h) to see definitions,which in the directory RaspberryPi\c\lib\ConfigLUCKFOX-1-5-Inch-65K-Color-OLED-Display-Module-FIG-
\(21\)

  • Interface selection:LUCKFOX-1-5-Inch-65K-Color-OLED-Display-Module-FIG- \(22\)
  • Data typeLUCKFOX-1-5-Inch-65K-Color-OLED-Display-Module-FIG- \(23\)
  • Module initialization and exit processing.LUCKFOX-1-5-Inch-65K-Color-OLED-Display-Module-FIG- \(23\)
  • Write GPIO:LUCKFOX-1-5-Inch-65K-Color-OLED-Display-Module-FIG- \(25\)
  • Read GPIO:LUCKFOX-1-5-Inch-65K-Color-OLED-Display-Module-FIG- \(26\)
  • GPIO mode settingLUCKFOX-1-5-Inch-65K-Color-OLED-Display-Module-FIG- \(27\)

GUI functions
If you need to draw pictures, display Chinese and English characters, display pictures, etc., we provide some basic functions here about some graphics processing in the directory RaspberryPi\c\lib\GUI\GUI_Paint.c(.h).LUCKFOX-1-5-Inch-65K-Color-OLED-
Display-Module-FIG- \(28\)

The fonts can be found in RaspberryPi\c\lib\Fonts directory.LUCKFOX-1-5
-Inch-65K-Color-OLED-Display-Module-FIG- \(29\)

  • New Image Properties: Create a new image buffer, this property includes the image buffer name, width, height, flip Angle, color.LUCKFOX-1-5-Inch-65K-Color-OLED-Display-Module-FIG- \(30\)
  • Select image buffer: The purpose of the selection is that you can create multiple image attributes, there can be multiple images buffer, you can select each image you create.LUCKFOX-1-5-Inch-65K-Color-OLED-Display-Module-FIG- \(31\)
  • Image Rotation: Set the rotation Angle of the selected image, preferably after Paint_SelectImage(), you can choose to rotate 0, 90, 180, 270.LUCKFOX-1-5-Inch-65K-Color-OLED-Display-Module-FIG- \(32\)
  • Sets the size of the pixels
  • Image mirror flip: Set the mirror flip of the selected image. You can choose no mirror, horizontal mirror, vertical mirror, or image center mirror.
  • Set points of the display position and color in the buffer: here is the core GUI function, processing points display position and color in the buffer.
  • Image buffer fill color: Fills the image buffer with a color, usually used to flash the screen into blank.
  • The fill color of a certain window in the image buffer: the image buffer part of the window filled with a certain color, usually used to fresh the screen into blank, often used for time display, fresh the last second of the screen.
  • Draw point: In the image buffer, draw points on (Xpoint, Ypoint), you can choose the color, the size of the point, the style of the point.
  • Draw line: In the image buffer, draw line from (Xstart, Ystart) to (Xend, Yend), you can choose the color, the width and the style of the line.
  • Draw rectangle: In the image buffer, draw a rectangle from (Xstart, Ystart) to (Xend, Yend), you can choose the color, the width of the line, whether to fill the inside of the rectangle.LUCKFOX-1-5-Inch-65K-Color-OLED-Display-Module-FIG- \(40\)
  • Draw circle: In the image buffer, draw a circle of Radius with (X_Center Y_Center) as the center. You can choose the color, the width of the line, and whether to fill the inside of the circle.LUCKFOX-1-5-Inch-65K-Color-OLED-Display-Module-FIG- \(41\)
  • Write Ascii character: In the image buffer, use (Xstart Ystart) as the left vertex, write an Ascii character, you can select Ascii visual character library, font foreground color, font background color.LUCKFOX-1-5-Inch-65K-Color-OLED-Display-Module-FIG- \(42\)
  • Write English string: In the image buffer, use (Xstart Ystart) as the left vertex, write a string of English characters, you can choose Ascii visual character library, font foreground color, font background color.LUCKFOX-1-5-Inch-65K-Color-OLED-Display-Module-FIG- \(43\)
  • Write Chinese string: in the image buffer, use (Xstart Ystart) as the left vertex, write a string of Chinese characters, you can choose character font, font foreground color, font background color of the GB2312 encodingLUCKFOX-1-5-Inch-65K-Color-OLED-Display-Module-FIG- \(44\)
  • Write numbers: In the image buffer,use (Xstart Ystart) as the left vertex, write a string of numbers, you can choose Ascii visual character library, font foreground color, font background color.LUCKFOX-1-5-Inch-65K-Color-OLED-Display-Module-FIG- \(45\)
  • Display time: in the image buffer,use (Xstart Ystart) as the left vertex, display time,you can choose Ascii visual character font, font foreground color, font background color.;LUCKFOX-1-5-Inch-65K-Color-OLED-Display-Module-FIG- \(46\)

Python(for Raspberry Pi)
It is compatible with python2.7 and python3.
The calls of the python are less complex compared to C demo.
config.py

Select interface.LUCKFOX-1-5-Inch-65K-Color-OLED-Display-Module-FIG-
\(47\)

Module initialization and exit processingLUCKFOX-1-5-Inch-65K-Color-OLED-
Display-Module-FIG- \(48\)

  • SPI write data.
    • def spi_writebyte(data)
  • IIC write data.
    • i2c_writebyte(reg, value):

main.py
The main function, if your Python version is Python2, is re-executed in Linux command mode as follows. sudo python main.py
If your Python version is Python3, run the following command in Linux. sudo python3 main.py

GUI functions
Python has an image librarPy IL official library link , it do not need to write code from the logical layer like C, can directly call to the image library for image processing. The following will take 1.54inch LCD as an example, we provide a brief description for the demo.

It needs to use the image library and install the library.

sudo apt-get install python3-pil

And then import the library from PIL import Image, ImageDraw, and ImageFont.
Among them, Image is the basic library, ImageDraw is the drawing function, and ImageFont is the text function.

Define an image buffer
image1 = Image.new(“1”, (disp. width, disp. height), “WHITE”)

The first parameter defines the color depth of the image, which is defined as “1” to indicate the bitmap of one-bit depth. The second parameter is a tuple that defines the width and height of the image. The third parameter defines the default color of the buffer, which is defined as “WHITE”.

Create a drawing object based on Image1 on which all drawing operations will be performed on here.
draw = ImageDraw.Draw(image1)

Draw line.

draw.line([(0,0),(127,0)], fill = 0)
The first parameter is a four-element tuple starting at (0, 0) and ending at (127,0). Draw a line. Fill =”0″ means the color of the line is white.

Draw rectangle

draw.rectangle([(20,10),(70,60)],fill = “WHITE”,outline=”BLACK”)
The first argument is a tuple of four elements. (20,10) is the coordinate value in the upper left corner of the rectangle, and (70,60) is the coordinate value in the lower right corner of the rectangle. Fill =” WHITE” means BLACK inside, and outline=”BLACK” means the color of the outline is black.

Draw circle.
draw.arc((150,15,190,55),0, 360, fill =(0,255,0)
Draw an inscribed circle in the square, the first parameter is a tuple of 4 elements, with (150, 15) as the upper left corner vertex of the square, (190, 55) as the lower right corner vertex of the square, specifying the level median line of the rectangular frame is the angle of 0 degrees, the second parameter indicates the starting angle, the third parameter indicates the ending angle, and fill = 0 indicates that the the color of the line is white. If the figure is not square according to the coordination, you will get an ellipse.
Besides the arc function, you can also use the chord function for drawing solid circle.

draw.ellipse((150,65,190,105), fill = 0)
The first parameter is the coordination of the enclosing rectangle. The second and third parameters are the beginning and end degrees of the circle. The fourth parameter is the fill color of the circle.

Character.
The ImageFont module needs to be imported and instantiated:

  • Font1 = ImageFont.truetype(“../Font/Font01.ttf”,25)
  • Font2 = ImageFont.truetype(“../Font/Font01.ttf”,35)
  • Font3 = ImageFont.truetype(“../Font/Font02.ttf”,32)

You can use the fonts of Windows or other fonts which is in ttc format..
Note: Each character library contains different characters; If some characters cannot be displayed, it is recommended that you can refer to the encoding set ro used. To draw English character, you can directly use the fonts; for Chinese character, you need to add a symbol u:

  • draw.text((5, 68), ‘Hello world’, fill = 0, font=Font1)
  • text= u”微雪电子”
  • draw.text((5, 200), text, fill = 0, font=Font3)

The first parameter is a two-element tuple with (5,68) as the left vertex, and use font1, fill is font color, fill = 0 means that the font color is white, and the second sentence sh微o雪ws电’ 子’, font color is white.

Read local picture.
image = Image.open(‘../pic/pic.bmp’)
The parameter is the image path.

Other functions.
Python’s image library is very powerful, if you need to implement more, you can learn on the website http://effbot.org/imagingbook pil.

STM32 Usage Tutorial

Provides demos based on STM32F103RBT6

Hardware Coonnection
The examples are based on STM32F103RBT6 as well as the connection table. If you want to use other MCU, you need to port the project and change the connection according to the actual hardware.

Connect to STM32F103RBT6IP Enclosures IP-ACIWM300.432 Air Conditioner for
Electrical Enclosure IMG 93

Four-wire SPI wiring diagramLUCKFOX-1-5-Inch-65K-Color-OLED-Display-
Module-FIG- \(64\)

Run the demo

  • Download the demo, find the STM32 demo file directory, use Keil5 to open oled_demo.uvprojx in the \STM32\STM32-F103RBT6\MDK-ARM directory.
  • Then modify the corresponding function comment in main.c according to the LCD model you are using, and then recompile and download to your board.LUCKFOX-1-5-Inch-65K-Color-OLED-Display-Module-FIG- \(65\)
  • For examples, if you are using 1.3inch OLED Modu(leC ),you need to comment out the line 105. (Note: there cannot be multiple sentences without comment at the same time; the line number may be changed, please modify it according to the actual situation)
  • The demo folder of each LCD model can fine in the following table:IP Enclosures IP-ACIWM300.432 Air Conditioner for Electrical Enclosure IMG 94

Software description

The demo is developed based on the HAL library. Download the demo, find the STM32 program file directory, and open the oled_demo.uvprojx in the STM32\STM32F103RBT6\MDK-ARM directory to check the programLUCKFOX-1-5-Inch-
65K-Color-OLED-Display-Module-FIG- \(66\)

In addition, you can see the file directory of the project in the STM32\STM32-F103RBT6\User\ directory. The five folders are the underlying driver, sample program, font, GUI, and OLED driverLUCKFOX-1-5-Inch-65K-
Color-OLED-Display-Module-FIG- \(67\)

Demo Description

Hardware interface
We package the bottom for different hardware platforms. You can check the DEV_Config.c(.h) file for more description.

Interface selection

  • define USE_SPI_4W 1

  • define USE_IIC 0

  • define USE_IIC_SOFT 0

  • Note:Switch SPI/I2C directly modified here

Data type

  • define UBYTE uint8_t

  • define UWORD uint16_t

  • define UDOUBLE uint32_t

Module initialization and exit processing

  • UBYTE System_Init(void);
  • void System_Exit(void);

Note:
Here is some GPIO processing before and after using the LCD screen.
After the System_Exit(void) function is used, the OLED display will be turned off;

Write and read GPIO

  • void DEV_Digital_Write(UWORD Pin, UBYTE Value);
  • UBYTE DEV_Digital_Read(UWORD Pin);

SPI write data

UBYTE SPI4W_Write_Byte(uint8_t value);

IIC write data

void I2C_Write_Byte(uint8_t value, uint8_t Cmd);

Application function
For the screen, if you need to draw pictures, display Chinese and English characters, display pictures, etc., you can use the upper application to do, and we provide some basic functions here about some graphics processing, you can check in the directory STM32\STM32F103RB\User\GUI\GUI_Paint.c(.h)LUCKFOX-1-5-Inch-65K-Color-OLED-
Display-Module-FIG- \(68\)

The character font which GUI dependent is in the directory STM32\STM32F103RB\User\FontsLUCKFOX-1-5-Inch-65K-Color-OLED-Display-
Module-FIG- \(69\)

New Image Properties: Create a new image property, this property includes the image buffer name, width, height, flip Angle, color.

  • void Paint_NewImage(UWORD Width, UWORD Height, UWORD Rotate, UWORD Color)
  • Parameters:
  • Width: image buffer Width;
  • Height: the Height of the image buffer;
  • Rotate: Indicates the rotation Angle of an image
  • Color: the initial Color of the image;

Set the clear screen function

  • void Paint_SetClearFuntion(void (*Clear)(UWORD));
  • parameter:
  • Clear : Pointer to the clear screen function, used to quickly clear the scr
  • een to a certain color;

Set the drawing pixel function.

  • void Paint_SetDisplayFuntion(void (*Display)(UWORD,UWORD,UWORD));
  • parameter:
  • Display: Pointer to the pixel drawing function, which is used to write data
  • to the specified location in the internal RAM of the OLED;

Select image buffer: the purpose of the selection is that you can create multiple image attributes, there can be multiple images buffer, you can select each image you create.

  • void Paint_SelectImage(UBYTE *image)
  • Parameters:
  • Image: the name of the image cache, which is actually a pointer to the firs
  • t address of the image buffer

Image Rotation: Set the selected image rotation Angle, preferably after Paint_SelectImage(), you can choose to rotate 0, 90, 180, 270.

  • void Paint_SetRotate(UWORD Rotate)
  • Parameters:
  • Rotate: ROTATE_0, ROTATE_90, ROTATE_180, and ROTATE_270 correspond to 0, 9
  • 0, 180, and 270 degrees respectively;

Image mirror flip: Set the mirror flip of the selected image. You can choose no mirror, horizontal mirror, vertical mirror, or image center mirror.

  • void Paint_SetMirroring(UBYTE mirror)
  • Parameters:
  • Mirror: indicates the image mirroring mode. MIRROR_NONE, MIRROR_HORIZONTAL,
  • MIRROR_VERTICAL, MIRROR_ORIGIN correspond to no mirror, horizontal mirror, vert
  • ical mirror, and about image center mirror respectively.

Set points of display position and color in the buffer: here is the core GUI function, processing points display position and color in the buffer.

  • void Paint_SetPixel(UWORD Xpoint, UWORD Ypoint, UWORD Color)
  • Parameters:
  • Xpoint: the X position of a point in the image buffer
  • Ypoint: Y position of a point in the image buffer
  • Color: indicates the Color of the dot

Image buffer fill color: Fills the image buffer with a color, usually used to flash the screen into blank.

  • void Paint_Clear(UWORD Color)
  • Parameters:
  • Color: fill Color

The fill color of a certain window in the image buffer: the image buffer part of the window filled with a certain color, usually used to fresh the screen into blank, often used for time display, fresh the last second of the screen

  • void Paint_ClearWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWO RD Color)

  • Parameters:

  • Xstart: the x-starting coordinate of the window

  • Ystart: indicates the Y starting point of the window
    Xend: the x-end coordinate of the window

  • Yend: indicates the y-end coordinate of the window

  • Color: fill Color

Draw point: In the image buffer, draw points on (Xpoint, Ypoint), you can choose the color, the size of the point, the style of the point.

LUCKFOX-1-5-Inch-65K-Color-OLED-Display-Module-FIG-
\(70\)

Draw line: In the image buffer, draw line from (Xstart, Ystart) to (Xend, Yend), you can choose the color, line width, line style.LUCKFOX-1-5-Inch-
65K-Color-OLED-Display-Module-FIG- \(71\)

Draw rectangle: In the image buffer, draw a rectangle from (Xstart, Ystart) to (Xend, Yend), you can choose the color, the width of the line, whether to fill the inside of the rectangle.LUCKFOX-1-5-Inch-65K-Color-OLED-Display-
Module-FIG- \(72\)

Draw circle: In the image buffer, draw a circle of Radius with (X_Center Y_Center) as the center. You can choose the color, the width of the line, and whether to fill the inside of the circle.LUCKFOX-1-5-Inch-65K-Color-OLED-
Display-Module-FIG- \(73\)

Write Ascii character: In the image buffer, use (Xstart Ystart) as the left vertex, write an Ascii character, you can select Ascii visual character library, font foreground color, font background color.

void Paint_DrawChar(UWORD Xstart, UWORD Ystart, const char Ascii_Char, sFONT F
ont, UWORD Color_Foreground, UWORD Color_Background)
Parameters:
Xstart: the x-coordinate of the left vertex of a character
Ystart: the Y-coordinate of the left vertex of a character
Ascii_Char: indicates the Ascii character
Font: Ascii visual character library, in the Fonts folder provides the foll
owing Fonts:
Font8: 5
8 font
Font12: 712 font
Font16: 11
16 font
Font20: 1420 font
Font24: 17
24 font
Color_Foreground: Font color
Color_Background: indicates the background color

Write English string: In the image buffer, use (Xstart Ystart) as the left vertex, write a string of English characters, you can choose Ascii visual character library, font foreground color, font background color.

void Paint_DrawString_EN(UWORD Xstart, UWORD Ystart, const char pString, sFON
T
Font, UWORD Color_Foreground, UWORD Color_Background)
Parameters:
Xstart: the x-coordinate of the left vertex of a character
Ystart: the Y-coordinate of the left vertex of a character
PString: string, string is a pointer
Font: Ascii visual character library, in the Fonts folder provides the foll
owing Fonts:
Font8: 58 font
Font12: 7
12 font
Font16: 1116 font
Font20: 14
20 font
Font24: 17*24 font
Color_Foreground: Font color
Color_Background: indicates the background color

Write Chinese string: in the image buffer, use (Xstart Ystart) as the left vertex, write a string of Chinese characters, you can choose GB2312 encoding character font, font foreground color, font background color.

void Paint_DrawString_CN(UWORD Xstart, UWORD Ystart, const char pString, cFON
T
font, UWORD Color_Foreground, UWORD Color_Background)
Parameters:
Xstart: the x-coordinate of the left vertex of a character
Ystart: the Y-coordinate of the left vertex of a character
PString: string, string is a pointer
Font: GB2312 encoding character Font library, in the Fonts folder provides
the following Fonts:
Font12CN: ASCII font 1121, Chinese font 1621
Font24CN: ASCII font24 41, Chinese font 3241
Color_Foreground: Font color
Color_Background: indicates the background color

Write numbers: In the image buffer,use (Xstart Ystart) as the left vertex, write a string of numbers, you can choose Ascii visual character library, font foreground color, font background color.

void Paint_DrawNum(UWORD Xpoint, UWORD Ypoint, double Nummber, sFONT Font, UWO
RD Digit, UWORD Color_Foreground, UWORD Color_Background)
Parameters:
Xstart: the x-coordinate of the left vertex of a character
Ystart: the Y-coordinate of the left vertex of a character
Nummber: indicates the number displayed, which can be a decimal
Digit: It’s a decimal number
Font: Ascii visual character library, in the Fonts folder provides the foll
owing Fonts:
Font8: 5
8 font
Font12: 712 font
Font16: 11
16 font
Font20: 1420 font
Font24: 17
24 font
Color_Foreground: Font color
Color_Background: indicates the background color

Display time: in the image buffer,use (Xstart Ystart) as the left vertex, display time,you can choose Ascii visual character font, font foreground color, font background color

void Paint_DrawTime(UWORD Xstart, UWORD Ystart, PAINT_TIME pTime, sFONT Font,
UWORD Color_Background, UWORD Color_Foreground)
Parameters:
Xstart: the x-coordinate of the left vertex of a character
Ystart: the Y-coordinate of the left vertex of a character
PTime: display time, here defined a good time structure, as long as the hou
r, minute and second bits of data to the parameter;
Font: Ascii visual character library, in the Fonts folder provides the foll
owing Fonts:
Font8: 58 font
Font12: 7
12 font
Font16: 1116 font
Font20: 14
20 font
Font24: 17*24 font
Color_Foreground: Font color
Color_Background: indicates the background color

Arduino Tutorial

Provides demos based on UNO PLUS

Hardware connection
The demos we provide are based on UNO PLUS, and the connection method provided is also the corresponding UNO PLUS pins. If you need to transplant the program, please connect according to the actual pins.

Arduino UNO connectionIP Enclosures IP-ACIWM300.432 Air Conditioner for
Electrical Enclosure IMG 95

  • Four-wire SPI wiring diagramLUCKFOX-1-5-Inch-65K-Color-OLED-Display-Module-FIG- \(74\)

  • How to install Arduino IDE

Run the demo

  • Download the demo, find the STM32 demo file directory, use Keil5 to open oled_demo.uvprojx in the \STM32\STM32-F103RBT6\MDK-ARM directory.
  • Then modify the corresponding function comment in main.c according to the LCD model you are using, and then recompile and download to your board.LUCKFOX-1-5-Inch-65K-Color-OLED-Display-Module-FIG- \(65\)
  • For examples, if you are using 1.3inch OLED Module (C),you need to comment out the line 105. (Note: there cannot be multiple sentences without comment at the same time; the line number may be changed, please modify it according to the actual situation) The demo folder of each LCD model can fine in the following table:

Software Description

  • Download the demo on the Resources, open the Arduino demo file directory, you can see the
    Arduino program of different models of OLED.LUCKFOX-1-5-Inch-65K-Color-OLED-
Display-Module-FIG- \(75\)

  • Choose the folder according to the LCD model you are using, and open the xxx.ino file. Take the 1.3inch OLED Module (C) as an example: open OLED_1in3_c, then double-click
    OLED_1in3_c.ino to open the Arduino project.LUCKFOX-1-5-Inch-65K-Color-OLED-
Display-Module-FIG- \(76\)

  • The demo folder of each LCD model can fine in the following table

Program Description
Underlying hardware interface
Because the hardware platform and the internal implementation are different. If you need to know the internal implementation, you can see many definitions in the directory DEV_Config.c(.h)

Interface selection

  • define USE_SPI_4W 1

  • define USE_IIC 0

  • Note:Switch SPI/I2C directly modified here

Data type

  • define UBYTE uint8_t

  • define UWORD uint16_t

  • define UDOUBLE uint32_t

Module initialization and exit processing

  • UBYTE System_Init(void);
  • void System_Exit(void);

Note:

  • here is some GPIO processing before and after using the LCD screen.
  • After the System_Exit(void) function is used, the OLED display will be turned
  • off;

Write and read GPIO

  • void DEV_Digital_Write(UWORD Pin, UBYTE Value);
  • UBYTE DEV_Digital_Read(UWORD Pin);

SPI write data

UBYTE SPI4W_Write_Byte(uint8_t value);

IIC write data

void I2C_Write_Byte(uint8_t value, uint8_t Cmd);

The upper application
For the screen, if you need to draw pictures, display Chinese and English characters, display pictures, etc., you can use the upper application to do, and we provide some basic functions here about some graphics processing in the directory: Arduino\OLED_xxx\GUI_Paint.c(.h)

LUCKFOX-1-5-Inch-65K-Color-OLED-Display-Module-FIG-
\(77\) IP Enclosures IP-ACIWM300.432 Air
Conditioner for Electrical Enclosure IMG 89

New Image Properties: Create a new image property, this property includes the image buffer name, width, height, flip Angle, color.

void Paint_NewImage(UWORD Width, UWORD Height, UWORD Rotate, UWORD Color)
Parameters:
Width: image buffer Width;
Height: the Height of the image buffer;
Rotate: Indicates the rotation Angle of an image
Color: the initial Color of the image;

Set the clear screen function, usually call the clear function of OLED directly

void Paint_SetDisplayFuntion(void (Display)(UWORD,UWORD,UWORD)); parameter:
Display: Pointer to the pixel drawing function, which is used to write data to the specified location in the internal RAM of the OLED;
void Paint_SetClearFuntion(void (
Clear)(UWORD));
parameter:
Clear : Pointer to the clear screen function, used to quickly clear the scr
een to a certain color;

Set the drawing pixel function.

void Paint_SetDisplayFuntion(void (*Display)(UWORD,UWORD,UWORD));
parameter:
Display: Pointer to the pixel drawing function, which is used to write data
to the specified location in the internal RAM of the OLED;

Select image buffer:the purpose of the selection is that you can create multiple image attributes, image buffer can exist multiple, you can select each image you create.

void Paint_SelectImage(UBYTE *image)
Parameters:
Image: the name of the image cache, which is actually a pointer to the firs
t address of the image buffer

Image Rotation: Set the selected image rotation Angle, preferably after Paint_SelectImage(), you can choose to rotate 0, 90, 180, 270.

void Paint_SetRotate(UWORD Rotate)
Parameters:
Rotate: ROTATE_0, ROTATE_90, ROTATE_180, and ROTATE_270 correspond to 0, 9
0, 180, and 270 degrees respectively;

Image mirror flip: Set the mirror flip of the selected image. You can choose no mirror, horizontal mirror, vertical mirror,or image center mirror.

void Paint_SetMirroring(UBYTE mirror)
Parameters:
Mirror: indicates the image mirroring mode. MIRROR_NONE, MIRROR_HORIZONTAL,
MIRROR_VERTICAL, MIRROR_ORIGIN correspond to no mirror, horizontal mirror, vert
ical mirror, and about image center mirror respectively.

Set points of display position and color in the buffer: here is the core GUI function, processing points display position and color in the buffer.

void Paint_SetPixel(UWORD Xpoint, UWORD Ypoint, UWORD Color)
Parameters:
Xpoint: the X position of a point in the image buffer
Ypoint: Y position of a point in the image buffer
Color: indicates the Color of the dot

Image buffer fill color: Fills the image buffer with a color, usually used to flash the screen into blank.

void Paint_ClearWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWO
RD Color)
Parameters:
Xstart: the x-starting coordinate of the window
Ystart: indicates the Y starting point of the window
Xend: the x-end coordinate of the window
Yend: indicates the y-end coordinate of the window
Color: fill Color

Draw points: In the image buffer, draw points on (Xpoint, Ypoint), you can choose the color, the size of the point, the style of the point.

LUCKFOX-1-5-Inch-65K-Color-OLED-Display-Module-FIG-
\(78\)

Line drawing: In the image buffer, line from (Xstart, Ystart) to (Xend, Yend), you can choose the color, line width, line style

LUCKFOX-1-5-Inch-65K-Color-OLED-Display-Module-FIG-
\(79\)

Draw rectangle: In the image buffer, draw a rectangle from (Xstart, Ystart) to (Xend, Yend), you can choose the color, the width of the line, whether to fill the inside of the rectangle

LUCKFOX-1-5-Inch-65K-Color-OLED-Display-Module-FIG-
\(80\)

Draw circle: In the image buffer, draw a circle of Radius with (X_Center Y_Center) as the center. You can choose the color, the width of the line, and whether to fill the inside of the circle.

LUCKFOX-1-5-Inch-65K-Color-OLED-Display-Module-FIG-
\(81\)

Write Ascii character: In the image buffer, at (Xstart Ystart) as the left vertex, write an Ascii character, you can select Ascii visual character library, font foreground color, font background color.

LUCKFOX-1-5-Inch-65K-Color-OLED-Display-Module-FIG-
\(81\)

Write English string: In the image buffer, use (Xstart Ystart) as the left vertex, write a string of English characters, can choose Ascii visual character library, font foreground color, font background color.

LUCKFOX-1-5-Inch-65K-Color-OLED-Display-Module-FIG-
\(83\)

Write Chinese string: in the image buffer, use (Xstart Ystart) as the left vertex, write a string of Chinese characters, you can choose GB2312 encoding character font, font foreground color, font background colorLUCKFOX-1-5
-Inch-65K-Color-OLED-Display-Module-FIG- \(84\)

Write numbers: In the image buffer,use (Xstart Ystart) as the left vertex, write a string of numbers, you can choose Ascii visual character library, font foreground color, font background color.LUCKFOX-1-5-Inch-65K-Color-OLED-
Display-Module-FIG- \(85\)

Display time: in the image buffer,use (Xstart Ystart) as the left vertex, display time,you can choose Ascii visual character font, font foreground color, font background color.LUCKFOX-1-5-Inch-65K-Color-OLED-Display-
Module-FIG- \(86\)

Resources

Provide a full set of documents, procedures, data sheets, etc.

  • Documentation
    Schematic

  • Program
    Sample Program

  • 3D drawings
    3D Drawing

  • Software
    LCD
    Image2lcd

  • Data sheet
    SDD1351 Datasheet
    1.5inch RGB OLED Datasheet

FAQ

  • Question: What is the working current of the OLED module?
    Answer: At the operating voltage of 3.3V: about 60mA for full white and 4mA for full black.

  • Question: Why does the OLED module not turn on when it is connected to the power supply?
    Answer: There is no backlight, and the display is self-illuminating. Only connect VCC and GND, the OLED will not light up. Program control is required to brighten the OLED.

Support

Technical Support
If you need technical support or have any feedback/review, please click the Submit Now button to submit a ticket, Our support team will check and reply to you within 1 to 2 working days. Please be patient as we make every effort to help you to resolve the issue. Working Time: 9 AM – 6 AM GMT+8 (Monday to Friday)

References

Read User Manual Online (PDF format)

Loading......

Download This Manual (PDF format)

Download this manual  >>

Related Manuals