LCD wiki MC154GX 1.54inch IIC OLED Module User Manual
- June 15, 2024
- LCD wiki
Table of Contents
LCDWIKI
1.54inch OLED SSD1309 IIC Module MC154GX User Manual
CR2022-MI4601 1.54inch OLED SSD1309 IIC Module
MC154GW &MC154GB
User Manual
Introduction to OLED
OLED is an Organic Light-Emitting Diode (OLED). OLED display technology has
the advantages of self-illumination, wide viewing angle, almost infinite
contrast, low power consumption, high reaction speed, flexible panel, wide
temperature range, simple structure and process, etc. A generation of flat
panel display emerging application technology.
OLED display is different from traditional LCD display, it can self-
illuminate, so no backlight is needed, which makes OLED display
The display is thinner than the LCD display and has a better display.
Product Description
The OLED module has a display size of 1.54″ and has a 128×64 resolution for black and white or black and blue. It adopts IIC communication mode and the internal driver IC is SH1106.
Product Features
- 1.54 inch OLED screen with black and white or black and blue color display
- 128×64 resolution for clear display and high contrast
- Large viewing angle: greater than 160° (one screen with the largest viewing angle in the display)
- Wide voltage supply (3V~5V), compatible with 3.3V and 5V logic levels, no level shifting chip required
- With IIC bus, only a few IOs can be used to light up the display
- Ultra-low power consumption: normal display is only 0.06W (far below the TFT display)
- Military-grade process standards, long-term stable work
- Provides a rich sample program for STM32, C51, Arduino platforms
- Provide underlying driver technical support
Product Parameters
Name | Description |
---|---|
Display Color | Black white / black blue |
SKU | MC154GW |
MC154GB
Screen Size| 1.54(inch)
Type| OLED
Driver IC| SSD309
Resolution| 128*64(Pixel)
Module Interface| IIC interface
Active Area| 35.052×17.516(mm)
Touch Screen type| No touch screen
Touch IC| No touch IC
Module PCB Size| 42.40×38.00(mm)
Visual angle| >160°
Operating Temperature| -20℃~60℃
Storage Temperature| -30℃~70℃
Operating Voltage| 3.3V / 5V
Power Consumption| TDB
Product Weight(With packaging)| 12(g)
Interface Description
NOTE:
-
This module supports IIC slave device address switching (shown in red box in Picture 2), as follows:
A. Solder the 0x78 side resistance, disconnect the 0x7A side, then select the 0x78 slave address (default);
B. Solder the 0x7A side resistance, disconnect the 0x78 side, then select the 0x7A slave address; -
The hardware switches the IIC from the set address, and the software also needs to be modified accordingly. For the specific modification method, see the following IIC slave device address modification instructions.
Number | Module Pin | Pin description |
---|---|---|
1 | GND | OLED power ground |
2 | VCC | OLED power positive (3.3V~5V) |
3 | SCL | OLED IIC bus clock signal |
4 | SDA | OLED IIC bus data signal |
5 | RES | OLED reset signal, low level reset (The module has a reset circuit, |
which can be powered on and reset)
Hardware Configuration
The hardware circuit of this module is composed of five parts: OLED display
control circuit, OLED boost circuit, IIC slave device address selection
circuit, pin array interface, and power supply voltage stabilizing circuit.
OLED display control circuit is mainly used to control OLED display, including
chip selection, reset, data and command transmission control.
The IIC slave address selection control circuit is used to select different
slave addresses.
The OLED boosting circuit is used to boost an input voltage to an OLED light
emitting voltage.
The pin array interface is used for external connection of the main control
development board.
The power supply voltage stabilizing circuit is used for 3.3V voltage
stabilizing power supply.
The OLED module adopts IIC communication mode, and the hardware is configured
with two pins: SCL (IIC data pin) and SDA (IIC clock pin). The IIC data
transmission can be completed by controlling these two pins according to the
IIC working timing.
Working principle
1. Introduction to SSD1309 Controller
The SSD1309 is an OLED/PLED controller that supports a maximum resolution of
128*64 and a 1024-byte GRAM. Support 8-bit 6800 and 8-bit 8080 parallel port
data bus, also supports 3-wire and 4-wire SPI serial bus and I2C bus. Since
parallel control requires a large number of IO ports, the most commonly used
are the SPI serial bus and the I2C bus. It supports vertical scrolling and can
be used in small portable devices such as mobile phones, MP3 players and more.
The SSD1309 controller uses 1 bit to control a pixel display, so each pixel
can only display black and white or black and blue. The displayed RAM is
divided into 8 pages, with 8 lines per page and 128 pixels per line. When
setting pixel data, you need to specify the page address first, and then
specify the column low address and column height address respectively, so set
8 pixels in the vertical direction at the same time. In order to be able to
flexibly control the pixel points at any position, the software first sets a
global one-dimensional array of the same size as the display RAM, first maps
the pixel point data to the global array, and the process uses the OR or the
operation to ensure that the global array is written before. The data is not
corrupted, and the data of the global array is then written to the GRAM so
that it can be displayed through the OLED.
2. Introduction to IIC Communication Protocol
The process of writing data on the IIC bus is shown in the following
figure:After the IIC bus starts working, the slave device
address is sent first. After receiving the slave device response, it then
sends a control byte to inform the slave device whether the next data to be
sent is a command written to the IC register or written. The RAM data, after
receiving the slave device response, then sends a value of multiple bytes
until the transmission is completed and the IIC bus stops working.
among them:
C0=0: This is the last control byte, and all the data bytes sent in the
following are all data bytes.
C0=1: The next two bytes to be sent are the data byte and another control
byte.
D/C(—)=0: is the register command operation byte
D/C(—)=1: operation byte for RAM data
The IIC start and stop timing diagrams are as follows:When the data line and the clock line of the IIC are both kept at a
high level, the IIC is in an idle state. At this time, the data line changes
from a high level to a low level, and the clock line continues to be at a high
level, and the IIC bus starts data transmission. When the clock line is held
high, the data line changes from low to high, and the IIC bus stops data
transmission.
The timing diagram for the IIC to send a bit of data is as follows:Each clock pulse (the process of pulling high and pulling low) sends
1 bit of data.
When the clock line is high, the data line must remain stable, and the data
line is allowed to change when the clock line is low.
The ACK transmission timing diagram is as follows: When the master waits for the ACK of the slave, it needs to keep the
clock line high.
When the slave sends an ACK, keep the data line low.
Instructions for use
1. Arduino instructions
Wiring instructions:
See the interface description for pin assignments.
Arduino UNO microcontroller test program wiring instructions
Number | Module Pin | Corresponding to UNO development board wiring pins |
---|---|---|
1 | GND | GND |
2 | VCC | 5V/3.3V |
3 | SCL | A5 |
4 | SDA | A4 |
5 | RES | No need to connect |
Arduino MEGA2560 microcontroller test program wiring instructions
Number | Module Pin | Corresponding to UNO development board wiring pins |
---|---|---|
1 | GND | GND |
2 | VCC | 5V/3.3V |
3 | SCL | 21 |
4 | SDA | 22 |
5 | RES | No need to connect |
Operating Steps:
A. Connect the OLED module and the Arduino MCU according to the above wiring
instructions, and power on;
B. Select the example you want to test, as shown below:
(Please refer to the test program description document for test program
description)C. Open the selected sample project, compile and
download.
The specific operation methods for the Arduino test program relying on library
copy, compile and download are as follows:
http://www.lcdwiki.com/res/PublicFile/Arduino_IDE_Use_Illustration_EN.pdf
D. If the OLED module displays characters and graphics normally, the program
runs Successfully;
2. STM32 instructions
Wiring instructions:
See the interface description for pin assignments.
Number| Module Pin| Corresponding to the STM32F103C8T6
development board wiring pin
---|---|---
1| GND| GND
2| VCC| 5V/3.3V
3| SCL| PA5
4| SDA| PA7
5| RES| No need to connect
STM32F103RCT6 microcontroller test program wiring instructions
Number| Module Pin| Corresponding to the MiniSTM32 development board wiring
pin
---|---|---
1| GND| GND
2| VCC| 5V/3.3V
3| SCL| PB13
4| SDA| PB15
5| RES| No need to connect
STM32F103ZET6 microcontroller test program wiring instructions
Number| Module Pin| Corresponding to the Elite STM32 development
board wiring pin
---|---|---
1| GND| GND
2| VCC| 5V/3.3V
3| SCL| PB13
4| SDA| PB15
5| RES| No need to connect
STM32F407ZGT6 microcontroller test program wiring instructions
Number| Module Pin| Corresponding to the Explorer STM32F4
development board wiring pin
---|---|---
1| GND| GND
2| VCC| 5V/3.3V
3| SCL| PB3
4| SDA| PB5
5| RES| No need to connect
STM32F429IGT6 microcontroller test program wiring instructions
Number| Module Pin| Corresponding to the Apollo STM32F4/F7
development board wiring pin
---|---|---
1| GND| GND
2| VCC| 5V/3.3V
3| SCL| PF7
4| SDA| PF9
5| RES| No need to connect
Operating Steps:
A. Connect the LCD module and the STM32 MCU according to the above wiring
instructions, and power on;
B. Open the directory where the STM32 test program is located and select the
example to be tested, as shown below:
(Please refer to the test program description document for test program
description)C. Open the selected test program project, compile
and download;
detailed description of the STM32 test program compilation and download can be
found in the following document:
http://www.lcdwiki.com/res/PublicFile/STM32_Keil_Use_Illustration_EN.pdf
D. If the OLED module displays characters and graphics normally, the program
runs successfully;
3. C51 instructions
Wiring instructions:
See the interface description for pin assignments.
STC89C52RC and STC12C5A60S2 microcontroller test program wiring instructions
Number| Module Pin| Corresponding to STC89/STC12 development
board wiring pin
---|---|---
1| GND| GND
2| VCC| 5V/3.3V
3| SCL| P17
4| SDA| P15
5| RES| No need to connect
Operating Steps:
A. Connect the LCD module and the C51 MCU according to the above wiring
instructions, and power on;
B. Open the directory where the C51 test program is located and select the
example to be tested, as shown below:
(Please refer to the test program description document for test program
description)C. Open the selected test program project, compile
and download;
detailed description of the C51 test program compilation and download can be
found in the following document:
http://www.lcdwiki.com/res/PublicFile/C51_Keil%26stc-
isp_Use_Illustration_EN.pdf
D. If the OLED module displays characters and graphics normally, the program
runs successfully;
4. RaspberryPi instructions
Wiring instructions:
See the interface description for pin assignments.
NOTE:
Physical pin refers to the GPIO pin code of the RaspBerry Pi development
board.
BCM encoding refers to the GPIO pin coding when using the BCM2835 GPIO
library.
WiringPi coding refers to the GPIO pin coding when using the wiringPi GPIO
library.
Which GPIO library is used in the code, the pin definition needs to use the
corresponding GPIO library code, see Picture 1 GPIO map table for
details. Raspberry Pi test program wiring instructions
Number| Module Pin| Corresponding to development board wiring
pin
---|---|---
1| GND| GND (Physical pin:6,9,14,20,25,30,34,39)
2| VCC| 5V/3.3V
( Physical pin:1,2,4)
3| SCL| Physical pin:5
BCM coding:3
wiringPi coding:9
4| SDA| Physical pin:3
BCM coding:2
wiringPi coding:8
Operating Steps:
A. open the IIC function of RaspberryPi
Log in to the RaspberryPi using a serial terminal tool (such as putty) and
enter the following command: sudo raspi-config
Select Interfacing Options->I2C->YES
Start RaspberryPi’s I2C kernel driver
B. install the function library
For detailed installation methods of the bcm2835, wiringPi, and python
function libraries of RaspberryPi, see the following documents:
http://www.lcdwiki.com/res/PublicFile/Raspberrypi_Use_Illustration_EN.pdf
C. select the example that needs to be tested, as shown below:
(Please refer to the test program description document for test program
description) D. bcm2835 instructions
a) Connect the OLED module to the RaspberryPi development board according to
the above wiring
b) Copy the test program directory Demo_OLED_bcm2835_IIC to RaspberryPi (can
be copied via SD card or via FTP tool (such as FileZilla))
c) Run the following command to run the bcm2835 test program:
cd Demo_OLED_bcm2835_IIC
make sudo ./ 1.54_IIC_OLED
As shown below: E. wiringPi instructions
a) Connect the OLED module to the RaspberryPi development board according to
the above wiring
b) Copy the test program directory DemoOLED wiringPi _IIC to RaspberryPi
(can be copied via SD card or via FTP tool (such as FileZilla))
c) Run the following command to run the wiringPi test program:
cd DemoOLED wiringPi _IIC
make
sudo ./ 1.54_IIC_OLED
As shown below:If you want to modify the IIC transfer rate, you
need to add the following content to the /boot/config.txt file, then restart
raspberryPi , i2c_arm_baudrate=2000000 (note that the comma is also required)
As shown below (the red box is the added content, the number 2000000 is the
set rate, can be changed): F. python instructions
a) The image processing library PIL needs to be installed before running
the python test program. The specific installation method is as follows:
http://www.lcdwiki.com/res/PublicFile/Python_Image_Library_Install_Illustration_EN.pdf
b) Connect the OLED module to the RaspberryPi development board as described
above.
c) Copy the test program directory Demo_OLED_python_IIC to RaspberryPi (either
via SD card or via FTP tool (such as FileZilla))
d) Run the following command to run 3 python test programs separately:
cd Demo_OLED_python_IIC/source
sudo python show_graph.py
sudo python show_char.py
sudo python show_bmp.py
As shown below:
5. MSP430 instructions
Wiring instructions:
See the interface description for pin assignments.
Number| Module Pin| Corresponding to MSP430 development board
wiring pin
---|---|---
1| GND| GND
2| VCC| 5V/3.3V
3| SCL| P54
4| SDA| P53
Operating Steps:
A. Connect the LCD module and the MSP430 MCU according to the above wiring
instructions, and power on;
B. Open the directory where the MSP430 test program is located and select the
example to be tested, as shown below:
(Please refer to the test program description document for test program
description)C. Open the selected test program project, compile
and download;
detailed description of the C51 test program compilation and download can be
found in the following document:
http://www.lcdwiki.com/res/PublicFile/IAR_IDE%26MspFet_Use_Illustration_EN.pdf
D. If the OLED module displays characters and graphics normally, the program
runs successfully;
Software Description
1. Code Architecture
A. Arduino code architecture description
The code architecture is shown belowArduino’s test program code
consists of two parts: the U8glib library and application code.
The U8glib library contains a variety of control IC configurations, mainly
responsible for operating registers, including hardware module initialization,
data and command transfer, pixel coordinates and color settings, display mode
configuration, etc.
The application contains several test examples, each of which contains
different test content. It uses the API provided by the U8glib library, writes
some test examples, and implements some aspects of the test function.
B. C51 , STM32 and MSP430 code architecture description
The code architecture is shown below:The Demo API code for the main
program runtime is included in the test code;
OLED initialization and related bin parallel port write data operations are
included in the OLED code;
Drawing points, lines, graphics, and Chinese and English character display
related operations are included in the GUI code;
The main function implements the application to run;
Platform code varies by platform;
IIC initialization and configuration related operations are included in the
IIC code;
C. RaspberryPi code architecture description
The python test program code architecture is shown below:The python test program consists of but part: PIL image processing
library, OLED initialization code, test sample code
PIL image processing library is responsible for image drawing, character and
text display operations, etc.
OLDE initialization code is responsible for operating registers, including
hardware module initialization, data and command transfer, pixel coordinates
and color settings, display mode configuration, etc.
The test example is to use the API provided by the above two parts of the code
to implement some test functions.
The bcm2835 and wiringPi test program code architecture is as follows:The Demo API code for the main program runtime is included in the
test code;
OLED initialization and related operations are included in the OLED code;
Drawing points, lines, graphics, and Chinese and English character display
related operations are included in the GUI code;
The GPIO library provides GPIO operations;
The main function implements the application to run;
Platform code varies by platform;
IIC initialization and configuration related operations are included in the
IIC code;
2. GPIO definition description
A. Arduino test program GPIO definition description
The Arduino test program uses the hardware IIC function, and the GPIO is
fixed.
B. STM32 test program GPIO definition description
The STM32 test program uses the software simulation IIC function, and the GPIO
definition is placed in the iic.h file, as shown in the following figure:OLED_SDA and OLED_SCL can be defined as any idle GPIO.
C. C51 test program GPIO definition description
The C51 test program uses the software simulation IIC function, and the GPIO
definition is placed in the iic.h file, as shown in the following figure:OLED_SDA and OLED_SCL can be defined as any idle GPIO.
D. RaspberryPi test program GPIO definition description
The RaspberryPi test program uses the hardware IIC function, and the GPIO is
fixed.
E. MSP430 test program GPIO definition description
The MSP430 test program uses the software simulation IIC function, and the
GPIO definition is placed in the iic.h file, as shown in the following
figure:OLED_SDA and OLED_SCL can be defined as any idle
GPIO
3. IIC slave device address modification
A. Arduino test program IIC modified from device address
The slave device address of IIC is defined in the u8g_com_arduino_ssd_i2c.c
file, as shown in the figure below:![LCD wiki MC154GX 1.54inch IIC OLED Module
- fig 24](https://manuals.plus/wp-content/uploads/2023/12/LCD-wiki-MC154GX-1
.54inch-IIC-OLED-Module-fig-24.jpg)Directly modify I2C_SLA(default is
0x3c2).For example, change to 0x3d2, then the IIC slave address is 0x3d*2
B. STM32 and C51 test program IIC modified from device address
The slave device address of the STM32 and C51 test program IIC is defined in the iic.h file, as shown in the following figure:Directly modify IIC_SLAVE_ADDR (default is 0x78).For example, change to 0x7A, then the IIC slave address is 0x7A.
C. RaspberryPi test program IIC modified from device address
The slave address of bcm2835 and wiringPi test program IIC is defined in the iic.h file, as shown in the following figure:Directly modify IIC_SLAVE_ADDR(default is 0x3C (corresponding to 0x78)).
For example, change to 0x3D, then the IIC slave address is 0x3D (corresponding to 0x7A);
The slave device address of the python test program IIC is defined in the oled.py file, as shown in the following figure: Directly modify IIC_SLAVE_ADDR(default is 0x3C (corresponding to 0x78)):
For example, change to 0x3D, then the IIC slave address is 0x3D (corresponding to 0x7A)
D. MSP430 test program IIC modified from device address
The slave device address of the MSP430 test program IIC is defined in the iic.h file, as shown in the following figure: Directly modify IIC_SLAVE_ADDR (default is 0x78).For example, change to 0x7A, then the IIC slave address is 0x7A.
4. IIC communication code implementation
A. Arduino test program IIC communication code implementation
Arduino test program IIC communication code is implemented by U8glib, the specific implementation method can refer to U8glib code
B. STM32 test program IIC communication code implementation
The STM32 test program IIC communication code is implemented in iic.c (there are subtle differences between different MCU implementations), as shown in the following figure: C. C51 test program IIC communication code implementation
C51 test program IIC communication code is implemented in iic.c, as shown below: A. RaspberryPi test program IIC communication code implementation
wiringPi test program IIC communication code is implemented in iic.c, as shown below:First call IIC_init to initialize, set the IIC slave address, get the IIC device file descriptor, and then use the IIC device file descriptor to write the register command and memory data respectively.
The bcm2835 test program IIC communication code is implemented in iic.c, as shown below:First call IIC_init to initialize, set the IIC slave address, get the IIC device file descriptor, and then use the IIC device file descriptor to write the register command and memory data respectively.
Python test program IIC communication code is implemented in oled.py, as shown below:First call SMBus for initialization, then call write_byte_data function to write register command and memory data respectively.
D. MSP430 test program IIC communication code implementation
MSP430 test program IIC communication code is implemented in iic.c, as shown below:
Common software
This set of test examples needs to display Chinese and English, symbols and
pictures, so PCtoLCD2002 modulo software is used. Here, the setting of the
modulo software is explained only for the test program.The PCtoLCD2002 modulo
software settings are as follows:
Dot matrix format select Dark code the modulo mode select the progressive
mode(C51 and MSP430 test program needs to choose determinant)
Take the model to choose the direction (high position first) (C51 and MSP430
test program needs to choose reverse (low position first))
Output number system selects hexadecimal number
Custom format selection C51 format
The specific setting method is as follows:
http://www.lcdwiki.com/Chinese_and_English_display_modulo_settings
Read User Manual Online (PDF format)
Read User Manual Online (PDF format) >>