0.96-inch SPI Monochrome Screen
Module Source
Purchase Link: https://item.taobao.com/item.htm?id=37849023766&_u=n1q56pn343e4
Baidu Netdisk Download Link: https://pan.baidu.com/s/1PUAFSSejSUb9ddEPrin_UA
Password: g4xn
Specifications
Operating Voltage: 3.3V
Operating Current:15MA
Module Dimensions:27.3 x 27.8 MM
Pixel Resolution:128(H) x 64(V)RGB
Driver Chip:SSD1306
Communication Protocol:SPI
Pin Count:7 Pin (2.54mm pitch header)
Hardware Connection
For SPI connections, the SSD1306 screen typically requires the following pin connections:
- CS: Chip select signal used to initiate and terminate command sequences.
- DC: Data/Command control signal used to differentiate between data and commands.
- RES: Reset signal used to reset the screen.
- SCK: Clock signal that provides timing.
- MOSI: Master-to-slave data signal.
Make sure to modify these pin connections according to your specific hardware.
c
#define OLED_MOSI 9 //Screen D1
#define OLED_CLK 10 //Screen D0
#define OLED_DC 11
#define OLED_CS 12
#define OLED_RESET 13
1
2
3
4
5
2
3
4
5
Usage Method
Installing Library Files (skip this step if already installed)
- Open the Arduino IDE.
- Go to “Tools” > “Manage Libraries…”.
- Search for “Adafruit ST7789” and “Adafruit GFX”, and install each library individually.
Enter the code:
Below is a simple example code that demonstrates how to initialize the screen and display text on it:
c
/******************************************************************************
* Test Hardware: LCSC ColorEasyDuino Development Board
* Version Number: V1.0
* Modified By: www.lckfb.com
* Modification Date: March 26, 2024
* Function Overview:
*****************************************************************************
* Open-source development board hardware and software information and related projects hardware and software information on official website
* Development board official website: www.lckfb.com
* Technical support resident forum, any technical problems are welcome at any time to exchange learning
* LCSC Forum: club.szlcsc.com
* Follow our Bilibili account: [立创开发板], stay toned to our latest news!
* We focus on cultivating Chinese engineers rather than profiting from board sales.
******************************************************************************/
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED screen width
#define SCREEN_HEIGHT 64 // OLED screen height
// SPI Screen Pin Definitions
#define OLED_MOSI 9 //D1
#define OLED_CLK 10 //D0
#define OLED_DC 11
#define OLED_CS 12
#define OLED_RESET 13
//Set screen parameters and pins
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT,
OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);
void setup() {
// Initialize the OLED display
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) //Set voltage source and communication address
{
Serial.println(F("SSD1306 allocation failed"));
for(;;); // Infinite loop
}
display.clearDisplay(); //Clear the display
display.setTextSize(1); // Normal 1:1 pixel ratio
display.setTextColor(SSD1306_WHITE); // Set text color to white
display.setCursor(0,0); // Set text starting position
display.println(F("Hello, World!"));
display.display(); // Display the content drawn above
}
void loop() {
// No need to repeat code here
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50