OLED Display 1.12

From
Jump to: navigation, search

Grove - OLED Display 1.12 inches (Seeed-Studio)

Caractéristiques

16 niveaux de gris

il y a 2 versions


matrix OLED v1.0
96 × 96 pixels
Pilote SSD1327

matrix OLED v2.1 *utilisé pour nos tests
128 × 128 pixels
Pilote SH1107G

Les deux versions partagent la même bibliothèque qui de base était conçu pour la version 1.0

Communication

Port I2c

Support

Supports both Normal and Inverse Color Display
Supports Continuous Horizontal Scrolling

OLED Display 96x96 recto.jpg OLED Display 96x96 verso.jpg OLED Display 96X96 connection.jpg

Pilotes (Drivers)

OLED Display: LY120-96096
Driver I2C:
v1.0 SSD1327Z
v2.1 SH1107G

Voltage

Operating Voltage: 3.3~5V

Mise en route (Setup)

connecter au port I2c
installer la bibliotheque
github -> https://github.com/Seeed-Studio/OLED_Display_96X96

il faut aussi la bibliotheque arduino wire.h

veuillez adapter le code selon la version OLED utilisée
v1.0 -> SeeedGrayOled.init(SSD1327);
v2.1 -> SeeedGrayOled.init(SH1107G);

Exemples

Grove OLED Display 1.12 V1.0
./examples/OLED_SSD1327_v1

Grove OLED Display 1.12 V2.0

./examples/OLED_SH1107G_v2

liste d'exemples:

OLED_Bitmap_Inverse_Display
OLED_Draw_Bitmap
OLED_Hello_World
OLED_Inverse_Display
OLED_PrintNumbers
OLED_Scroll_Left
OLED_Scroll_Right
OLED_Z_Display_Driver_Test_Suite

Code : Hello World!

Bibliotheque SeeedGrayOLED (128 × 128 pixels)

https://github.com/Seeed-Studio/OLED_Display_96X96

https://github.com/Seeed-Studio/OLED_Display_96X96/blob/master/examples/OLED_SH1107G_v2/OLED_Hello_World/OLED_Hello_World.ino




	/*
	  The new OLED module drive IC has two version,
	  1. SH1107G
	  2. SSD1327
	  
	  Change the paramater of the drive IC name to init the module.
	  **
	  ** SeeedGrayOled.init(SSD1327);  // SSD1327 or SH1107G
	  **
	  Copyright - Seeedstudio
	  Author - lambor
	  Date - 4/24/2017
	*/

	#include <Wire.h>
	#include <SeeedGrayOLED.h>
	#include <avr/pgmspace.h>

	void setup()
	{
	  Wire.begin();
	  SeeedGrayOled.init(SH1107G);             //initialize SEEED OLED display
	  SeeedGrayOled.clearDisplay();            //Clear Display.
	  SeeedGrayOled.setNormalDisplay();        //Set Normal Display Mode
	  SeeedGrayOled.setVerticalMode();         // Set to vertical mode for displaying text
	  
	  for(char i=0; i < 12 ; i++)
	  {
	  SeeedGrayOled.setTextXY(i,0);           //set Cursor to ith line, 0th column
	  SeeedGrayOled.setGrayLevel(i);          //Set Grayscale level. Any number between 0 - 15.
	  SeeedGrayOled.putString("Hello World"); //Print Hello World
	  }
	}   

	void loop()
	{
	  
	}



Code Hello World! (u8g2)

Bibliotheque u8g2 128 × 128 pixels

library of u8g2 (Monochrome graphics library supports OLEDs and LCDs)

Grove Base for XIAO 1.PNG XIAO-ESP32S3 1.PNG OLED Display 96x96 recto.jpg

Grove Base for XIAO
XIAO-ESP32S3
OLED Display 1.12 - Port I2c ✅ sketch_oct7a

mais il n'écoute pas x,y n'est pas exécuté, on demande de faire 0,24 mais il fait 0,0

bug classique** avec les écrans OLED SH1107 et la bibliothèque **u8g2** : la commande `drawStr(x, y, ...)` ne positionne pas le texte comme prévu.

Voici une solution à Tester
int y_offset = 16; // Valeur typique pour SH1107
u8g2.drawStr(0, 24 + y_offset, "Hello World!");

Le code suivant positionne le texte au milieu Y = 64 + 16, et horizontalement centré X = 15
Si on indique Y = 128 + 16 le texte disparait par contre Y = 112 + 16 (128) il sera aligné en bas de l’écran


#include <Arduino.h>
#include <U8g2lib.h>
#include <SPI.h>
#include <Wire.h>

U8G2_SH1107_SEEED_128X128_1_SW_I2C u8g2(U8G2_R0, /* clock=*/ SCL, /* data=*/ SDA, /* reset=*/ U8X8_PIN_NONE);

void setup(void) {
  u8g2.begin();
}

void loop(void) {
  u8g2.firstPage();
  do {
    u8g2.setFont(u8g2_font_ncenB10_tr);
    int y_offset = 16; // Valeur typique pour SH1107
    u8g2.drawStr(15, 64 + y_offset, "Hello World!");
  } while ( u8g2.nextPage() );
}



Code Hello World! (u8x8)

Grove Base for XIAO 1.PNG XIAO-ESP32S3 1.PNG OLED Display 96x96 recto.jpg

Grove Base for XIAO
XIAO-ESP32S3
OLED Display 1.12 - Port I2c ✅ sketch_oct7b

Voici une autre version Hello World! avec u8x8
Les polices `u8x8_font_*` sont **fixées à 8x8 pixels

Le texte est trop petit, à cause du format 8x8 pixels le texte est centré horizontalement et verticalement
Le texte clignote, avec la fonction pause de 10 secondes, le texte va rester pendant se lapse de temps, pour ensuite disparaitre et apparaitre à nouveau.


certaines polices comme `u8x8_font_px437wyse700a_2x2_r` affichent les caractères en double taille (chaque caractère occupe 2x2 blocs de 8x8
à tester

#include <Arduino.h>
#include <U8x8lib.h>
#include <Wire.h>

// Remplace U8G2 par U8X8
U8X8_SH1107_SEEED_128X128_SW_I2C u8x8(/* clock=*/ SCL, /* data=*/ SDA, /* reset=*/ U8X8_PIN_NONE);

void setup(void) {
  u8x8.begin();
  u8x8.setPowerSave(0); // Active l'affichage
  u8x8.setFont(u8x8_font_chroma48medium8_r); // Choisis une police compatible U8x8
}

void loop(void) {
  u8x8.clearDisplay(); // Efface l'écran
  u8x8.drawString(2, 24, "Hello World!"); // Affiche le texte à la ligne 24, colonne 2, texte centré au milieu de l'écran
  delay(10000); // pause de 10 secondes, afin de avoir un texte figé
}

Autres polices u8x8
u8x8_font_profont29_2x3_n
u8x8_font_courB18_2x3_n
u8x8_font_inb33_3x6_n

https://github.com/olikraus/u8g2/wiki/u8x8reference



à tester avec u8g2 basé sur l'article de Elaine Wu dans le blog @seeed ✅

https://www.seeedstudio.com/blog/2019/07/05/u8g2-for-seeeduino-boards/

#include <Arduino.h>
#include <U8g2lib.h>
#include <Wire.h>

U8G2_SH1107_SEEED_128X128_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);

void setup(void) {
  u8g2.begin();
}

void loop(void) {
  u8g2.clearBuffer(); 
  u8g2.setCursor(10, 80);
  u8g2.setFont(u8g2_font_ncenB12_tr); 
  u8g2.print("Hello World!");
  u8g2.sendBuffer();
  delay(1000);  
}

Autres Polices u8g2
u8g2_font_lastpriestess_tu
u8g2_font_lubB10_tn
u8g2_font_lubB12_tn
u8g2_font_lubB14_tn
u8g2_font_lubB18_tn
u8g2_font_lubB19_tn
u8g2_font_lubB24_tn


Liste des fonctions

init()
clearDisplay()
setNormalDisplay()
setContrastLevel(unsigned char ContrastLevel)
setInverseDisplay()
setHorizontalMode()
setVerticalMode()
setTextXY(X,Y)
putChar(unsigned char c)
putString(cont char *string)
putNumber(long n)
drawBitmap(unsigned char *bitmaparray, int bytes)
setHorizontalScrollProperties
activateScroll()
deactivateScroll()

Liens internes

Main page


Liens externes

github.com/Seeed-Studio/OLED_Display_96X96/archive/master.zip Librairies ZIP

www.seeedstudio.com/Grove-OLED-Display-1-12-V2.html  shop

wiki.seeedstudio.com/Grove-OLED_Display_1.12inch  wiki