Arduino: The Noiasca Liquid Crystal with Support of Cyrillic
As you might already know, the Noiasca Liquid Crystal can print special characters on the LCD if they are encoded as multi byte UTF-8 characters. Recently I thought about possibilities how to support Cyrillic letters on the character liquid crystal display.
This page covers following topics:
- Use a Liquid Crystal Display with Cyrillic letters in the character ROM
- Replace all Cyrillic letters to Latin letters for a "standard" LCD
For the first variant there are 3 options
- LCD with the SPLC780D1 002 ROM
- LCD with the ST7070 Driver
- LCD with the HD44780 A02 ROM
In any case you phase the challenge, that your source files in the Arduino IDE will be encoded in UTF-8. I.e. you will need a LCD library which can handle UTF-8 characters and send the proper characters to the LCD.
Use Liquid Crystal Displays with Cyrillic letters in the character ROM
The commonly used HITACHI HD44780 ROM A00 doesn't contain Cyrillic letters, but there are several other hardware options available:
- SPLC780D1 002A
- HD44780 ROM A02
But in any case you will need a library which supports UTF-8 because the Cyrillic letters are on different ROM addresses.
SPLC780D1 - 002A - preferred way to print Cyrillic on a LCD
LCDs with the SPLC780D1 and the character ROM 002A are able to print Cyrillic letters. These LCDs are available very easily. I can recommend this seller *) on Aliexpress. Sometimes these displays are advertised as "ST7920". Obviously the character set must fit.
With this library you can use a simple print to display Cyrillic characters on a LCD:
lcd.print("Аа Бб Вв Гг Дд");
An example constructor for this kind of displays with an I2C port expander looks like:
LiquidCrystal_PCF8574 lcd(addr, cols, rows, convert_SPLC780D1_002A);
ST7070 - Cyrillic supported by this Library
LCDs with a ST7070 can support most Cyrillic letters (capital and small). Unfortunately these displays are hard to find nowadays. You can read more about this display on the page for the ST7070 Liquid Crystal. You will need to call the extended converter for the ST7070 to support Cyrillic when you create your LCD object:
LiquidCrystal_PCF8574 lcd(addr, cols, rows, convert_ST7070_ext); // create LCD object
HD44780 ROM A02 (only implementation guides)
There are some capital Cyrillic letters in the HD44780 ROM A02 starting at address 0x80. If you combine them with the ASCII characters and the included Latin letters with diacritic you can at least write in CAPITALS (large letters) on the LCD. A converter should map the UTF-8 capital Cyrillic letters to the character set of the LCD. Additional all small Cyrillic letters must be printed as Capital letters. As I don't have this kind of display (and they are not very common at all), the library doesn't contain this specific converter. Nevertheless you can write your own converter for the HD44780 ROM A02 display, like described here.
Replace all Cyrillic letters to Latin letters
As the commonly used HITACHI HD44780 ROM A00 doesn't contain Cyrillic letters you can define a callback function which simply converts any Cyrillic letter to a Latin character. This transliteration is based on GOST 16876-71(1). In the next chapter you can read why I have chosen GOST.
The main idea is, that if you print Cyrillic letters the LCD will print ASCII letters (Latin)
lcd.print("Аа Бб Вв Гг Дд");
(exact picture still missing)
The full mapping of all Cyrillic Letters would take around 750 bytes of program memory therefore I made a minimized version with just 55 characters.
To activate the Cyrillic converter you add one further parameter to your LCD object. The last parameter is a callback function which will do this transliteration. An example based on the I2C LCD the constructor for the minimum Cyrillic converter:
LiquidCrystal_PCF8574 lcd(addr, cols, rows, convert_cyrillic_min_ASCII); // create LCD object
See the sketch 5035_Convert_Cyrillic with several examples.
Why GOST 16876-71 (1) to transliterate Cyrillic?
When I started to write "just another converter" for the LCD, I wasn't aware of the complexity of the Cyrillic Alphabet. Thankfully you will find transliteration tables from Cyrillic to Latin letters. But there are a lot! For Russian you find 13 (!) transliteration tables from Cyrillic to ASCII. For Belarusian 7, for Macedonian 6, one for Serbian Cyrillic, for Ukrainian 8. Bulgarian knows 7 transliterations - but at least there is "one" official transliteration since 2009. And just in case all these Cyrillic transliterations are not enough, there is also a scientific transliteration for Cyrillic.
I decided to implement my mapping based on GOST 16876-71(1) with some adoptions:
- omit any diacritics marks (acute, grave, breve...) on letters, because they might not be available in the character ROM of the LCD
- use plain ASCII letters (7 bit characters)
- only use one single character for each letter. Even the letters Ю ю Я я will be replaced by one Latin character.
Just in case someone is not happy with my work, it's up to you to write your very own character converter. On this page can read more about writing your own converter.
With the additional language converters it becomes very easy to print Cyrillic letters in pure ASCII (lower ANSI) on a standard LCD. If you need true Cyrillic support you should consider to buy a specific SPLC780D1 002A LCD - which is also covered by the Noiasca Liquid Crystal library.