0.5”, 0.8” OLED (LD7032 driver)

 

보통 OLED 디스플레이는 0.96” 또는 1.3” OLED, 128×64 해상도를 많이 사용합니다. 그런데 근래에 이보다 작은 0.5”, 0.8” OLED 디스플레이도 등장했네요. 스펙은 아래와 같습니다.

  • 크기 : 0.5 인치, 0.82 인치
  • 해상도 : 60×32, 96×39
  • 드라이버 : LD7032, LYNX2 driver

 

아두이노에서 쓰기 편하도록 인터페이스 보드가 달린 모듈은 찾기가 어렵고 가격도 비쌉니다. 0.5”  OLED의 경우 아두이노 Micro 보드의 실드 형태로 나온게 20$ 안팎입니다.

 

예제를 한번 보죠.

먼저 0.5” OLED shield (LD7032 driver)의 경우는 아래와 같이 연결합니다.

Arduino –> OLED LD7032 LCD Display
D12  –>  Data In
D11  –>  Clock
D10  –>  A0 (Register Select)
D09  –> CS (Chip Select)
D08  –> Reset
GND  –> GND
3.3V  –> VCC

 

아두이노에서는 u8glib를 사용해서 디스플레이를 제어할 수 있습니다. 예제 코드는 아래를 참고…

// Watch video here: https://www.youtube.com/watch?v=obNeqesglgQ

/*
OLED LD7032 and MQ135 sensor connection pins to Arduino microcontroller:

Arduino        OLED LD7032 LCD Display
  D12          Data In
  D11          Clock
  D10          A0 (Register Select)
  D09          CS (Chip Select)
  D08          Reset  
  GND          GND
  3.3V         VCC

*/

/*
  >>> Before compiling: Please remove comment from the constructor of the 
  >>> connected graphics display (see below).
  
  Universal 8bit Graphics Library, http://code.google.com/p/u8glib/
  
  Copyright (c) 2012, olikraus@gmail.com
  All rights reserved.

  Redistribution and use in source and binary forms, with or without modification, 
  are permitted provided that the following conditions are met:

  * Redistributions of source code must retain the above copyright notice, this list 
    of conditions and the following disclaimer.
    
  * Redistributions in binary form must reproduce the above copyright notice, this 
    list of conditions and the following disclaimer in the documentation and/or other 
    materials provided with the distribution.

  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  
  
*/

#include "U8glib.h"

int i = 0;

// setup u8g object, please remove comment from one of the following constructor calls
// IMPORTANT NOTE: The following list is incomplete. The complete list of supported 
// devices with all constructor calls is here: http://code.google.com/p/u8glib/wiki/device

U8GLIB_LD7032_60x32 u8g(11, 12, 9, 10, 8);	// SPI Com: SCK = 11, MOSI = 12, CS = 9, A0 = 10, RST = 8  (SW SPI Nano Board)

 int ii= 4;
 
 void draw(void) {
  // graphic commands to redraw the complete screen should be placed here  
  u8g.setFont(u8g_font_unifont);
  //u8g.setFont(u8g_font_osb21);
  
  u8g.drawStr( 0, 12, "aaa");
  u8g.drawStr( 0, 29, "Hello World!");
}

void setup(void) {
   Serial.begin(9600);
  // flip screen, if required
  // u8g.setRot180();
  
  // set SPI backup if required
  //u8g.setHardwareBackup(u8g_backup_avr_spi);

  // assign default color value
  if ( u8g.getMode() == U8G_MODE_R3G3B2 ) {
    u8g.setColorIndex(255);     // white
  }
  else if ( u8g.getMode() == U8G_MODE_GRAY2BIT ) {
    u8g.setColorIndex(3);         // max intensity
  }
  else if ( u8g.getMode() == U8G_MODE_BW ) {
    u8g.setColorIndex(1);         // pixel on
  }
  else if ( u8g.getMode() == U8G_MODE_HICOLOR ) {
    u8g.setHiColorByRGB(255,255,255);
  }
}

void loop(void) {
  // picture loop
  
  u8g.firstPage();  
  do {
    draw();
  } while( u8g.nextPage() );
  
  // rebuild the picture after some delay
  delay(200); // 5 measurements in 1 second
}

 

가격이 좀 싸지면 써볼만 할 듯…

 

You may also like...