Matrix - 0.96' 128x64 OLED

From FriendlyELEC WiKi
Revision as of 09:14, 19 February 2016 by Yftan (Talk | contribs) (Features)

Jump to: navigation, search

查看中文

1 Introduction

0.96inch 128x64 OLED

This is a tiny single color OLED. Its dimension is 0.96". Its resolution is 128 x 64. It can display text and graphics.It is high contrast and low power consumption. This module is powered by 5V which is then converted to 3.3V to OLED. It communicates via SPI or I2C. Its signal level is 3.3V. By default it communicates via SPI. If you want to set it to I2C you can change the module's resistor configuration.

2 Features

  • Tiny
  • High contrast, low power consumption
  • SPI/I2C
  • 2.54mm spacing pin header
  • PCB Dimension(mm): 27 x 32

3 Basic Device Operation

4 Download Matrix Source Code

All the matrix modules' code samples are open source. They are maintained on GitHub --https://github.com/friendlyarm/matrix.git
Each branch in this hub contains the matrix modules' code samples for a board that the matrix modules can work with.

  • The nanopi branch contains the matrix modules' code samples for the NanoPi
  • The nanopi 2 branch contains the matrix modules' code samples for the NanoPi 2
  • The tiny4412 branch contains the matrix modules' code samples for the Tiny4412
  • The raspberrypi branch contains the matrix modules' code samples for the RaspberryPi

Please follow the steps below to get the source code:
Install the git utility on a PC running Ubuntu14.04

$ sudo apt-get install git

Clone the matrix code from GitHub

$ git clone https://github.com/friendlyarm/matrix.git

If this is successful a "matrix" directory will be generated, which will contain all the matrix modules' code samples.

5 How To

5.1 Connection

  • Connect to Tiny4412 SDK (1506)
GND: Gound
VCC: 5V
CLK: SPI CLK
MOSI: SPI MOSI
RES: GPIO PIN1
DC: GPIO PIN2
CS: SPI CS

5.2 Code Sample in C under Linux

#include <stdio.h>
#include "libfahw.h"
 
int display(int x, int y, char* str)
{
    int devFD;
    if ((devFD = OLEDInit(TINY4412_GPIO_PIN1, TINY4412_GPIO_PIN2)) == -1) {
        printf("Fail to init OLED\n");
        return -1;
    }
    // Char bitmap: 8x16
    OLEDDisp8x16Str(devFD, x, y, str);
    OLEDDeInit(devFD);
    return 0;
}
 
int main(int argc, char *argv[]) {
    display(0, 0, "1234567890");
    display(0, 16, "ABCDEFGHIJK");
    return 0;
}

5.3 Compile and Run

git clone https://github.com/friendlyarm/fa-hardware.git
cd fa-hardware
cd demo
cd matrix-0.96inch_128x64_oled
make

Copy your compiled bin to your board and you are ready to go.

6 Resources