I've searched for good library for my OLED 16x02 screen, but i haven't found anything! So i've tried to implement my own library! There were some pieces of code in different repositories without any(or poor) description what each part do, with strange method names and bad comments... I've started to search information about my OLED screen and have found a full SSD1311 controller datasheet on which my screen was based!
So, what i have:
wide.hk
label on the front left sideOp162i
text on the back1602 i2c OLED screen
as product name from seller- product picture with link to youtube https://youtube.com/watch?v=74Wso_3TskA
After some research i had:
- controller SSD1311
- OLED screen
- 2 lines x 16 cells
- 5x7 (5x8) char
- 256 step contrast
- i2c interface
- character generator 256 * 5x8 CGROM
- character generator 64 * 8 bits CGRAM
- display data 80 * 8 bits
- 3 sets of CGROM (ROM A / B / C)
- Row Re-mapping and Column Re-mapping
- Double-height Font characters
- Bi-direction shift function
- All character reverse display
- Display shift per line
- Screen saving fade in / out feature
Useful links:
- Product at original site
- Blogpost about screen
- Library on github with very awful code
- Library for Raspberry Pi
- Scroll text example
- Another library with awful code
- One more library
More links with some basic information:
Frame consist of:
- (1) i2c address is 7 bit long
- (2) next bit is a direction (READ or WRITE)
- (3) next byte define is it command or data packet
- (4) next byte is the command|data byte
Datasheet contains some naming for important moments. There are some explanations:
IS
, RE
, SD
is a logical bits which can be set by doing command requests to screen
D/C#
is a (3) in frame. First Wire.write
after Wire.beginTransmission
in code
R/W#
is a bit (2) in frame. You can "control" it by doing Wire.requestFrom()
or Wire.beginTransmission()
- R/W# = 0 when Wire.beginTransmission()
- R/W# = 1 when Wire.requestFrom()
CGRAM is Character Generator RAM
DDRAM is Display Data RAM
This controller features is preset by pin configuration and may be ignored in code if default values are suitable for you^
- MCU bus interface selection
- CGRAM
- Slave address
- Internal VDD regulator
- OLED Characterization
- Display Clock Divide Ratio
- Oscillator Frequency
- SEG Pins Hardware Configuration
- V COMH Deselect Level