The OLED LEC1621
There are some I2C LCD shields available advertised for the Raspberry Pi. As these modules are using a MCP23017 they are equipped with 5 a RGB LED and 5 push buttons. Let's try to connect them to an Arduino or an ESP8266.
The LCD RGB KEPAD for RPi - Overview
The LCD RGB KEYPAD for RPi comes with following features:
- A 16bit I2C port expander based on a MCP23017
- 5 push buttons
- a RGB LED
- a 1602 LCD in with blue/white
Connectivity Options for the LEC1621
The OLED LEC1621 can be used in 8bit/4bit parallel mode. Therefore you could also use I2C or SPI expanders. Additionally the display has built in SPI and I2C support. Read your datasheet, because for I2C you must solder two jumpers on the backside of the display. When dealing with I2C always check with an I2C scanner, if your device is responding. In my case the display address is 0x3c.
The Hardware Driver for the OLED LEC1621
If you want to use the OLED with its native I2C interface you can use the Wire hardware driver:
#include <NoiascaLiquidCrystal.h> #include <NoiascaHW/lcd_wire.h> cosnt byte addr = 0x3c; // check the LCD address with an I2C scanner LiquidCrystal_Wire lcd(addr, cols, rows, convert_SPLC780D1_003A);
Remember to add a Wire.begin() to your setup() like in the examples, as this will not be done in the library. As mentioned before, you can also use the parallel interface or an external expander chip.
Noiasca Liquid Crystal and the OLED
The nice point for this OLED Display is that it contains 4(!) different fonts. Each font can be activated during runtime.
- font0: English Japanese
- font1: Western European
- font2: European Russian
- font3: Western European II
For easy usage of these fonts I recommend my "Noiasca Liquid Crystal" as this library will do character mapping from UTF-8 to the existing characters in the LCD ROM. As example some special characters in the second row of the display:
(Degree, Division, middle Point, n with tilde, Pound, Yen, Tilde, Sqareroot, Proportional to, Infinity, Left Arrow, Right Arrow, Backslash)
Depending on the chosen font you will need different mappings:
|0||English - Japanese||default||this font is based on the HD44780_A00. Additionally it will contain Hebrew letters, but currently my library don't support Hebrew out of the box|
|1||Western European I||convert_LEC1621_01|
|2||English - Russian||convert_LEC1621_02||Mainly for Cyrillic letters used for Russian or Ukrainian, Bulgarian, and lot of other languages|
|3||Western European II||SPLC780D1_003A||this character set is similar to the European SPLC780D1. It is my prefered font for Germanic languages.|
You can read more about this character mapping in the Introduction or in the German section of this site. For the beginning you should just know that you don't need to enter the octal ROM addresses of the special characters manually and these print can be done by a simple:
The examples 09xx_OLED_LEC1621 explain, how these displays are handled.
Additional methods for the OLED Display
To switch between fonts you must call following method:
lcd.setFont(3); // possible values 0..3
The OLED display doesn't have a backlight you neither need to switch it on nor off.
Your own Character Converter
If you need a different character converter you can hand over a callback function as optional last parameter.
Obviously - you also have to implement the callback function to do all the magic.
See the examples in the folder "50_Convert" how to write your own character converter.
For best support of German characters I recommend to use font 3. This is character set is very similar to the SPLC780D1_003A and adds support for small and capital Umlauts from the LCD ROM. Don't forget to switch to font 3 in the setup after initialization of the display.
#include <NoiascaLiquidCrystal.h> #include <NoiascaHW/lcd_wire.h> cosnt byte addr = 0x3c; // check the LCD address with an I2C scanner LiquidCrystal_Wire lcd(addr, cols, rows, convert_SPLC780D1_003A); // Ä becomes Ä void seutp() Wire.begin(); lcd.begin(); lcd.setFont(3); // activate character set 3 Western European II
The MCP23017 class in "Noiasca Liquid Crystal" enables you to run LCDs with MCP23017 I2C port expander and adds more IOs for your usage.