Arduino: The Noiasca Liquid Crystal with Language Support

As you have seen, my Noiasca Liquid Crystal can print special characters on the LCD even if they are encoded as multi byte UTF-8 characters. But as there are only some special characters available in the ROM of the HD44780 LCD, this will fail for several Latin characters with diacritic marks (acute, grave, breve...) like À Ç È some Japanese letters will be printed instead. To avoid this, I have prepared some converters to replace letters with such diacritic with their plain ASCII (lower ANSI) counterpart to keep your text readable.

An Example: if you would print the French letters to the LCD you might get something like:

LCD displaying Japanese characters

The Power of Character Converter Callback

With the ASCII converter this print will get readable. To avoid letters with diacritic you can use a UTF-8 to ASCII converter.

lcd.print("àâæçèéêëîïôœùûüÿ");

lettres françaises sur écran LCD

The full mapping will take around 1500 bytes of program memory because we have 500 characters and each will take 3 bytes. If you only have the need of one (or some) languages it might be enough if you choose a smaller subset for your need.

To activate the ASCII Converter you add one further parameter to your lcd object. The last parameter is a callback function which will do this conversion. An example based on the I2C LCD constructor looks like:

LiquidCrystal_PCF8574 lcd(addr, cols, rows, convert_ASCII); // create LCD object

See the sketch 5030_Convert_ASCII with several converters.

ASCII converter for European Language Families

As the full ASCII converter is quite large and might take around 1500 bytes of Arduino flash memory, I've added smaller converters specific for some language families (if several languages use similar diacritics) or single languages

First: Lets see the he supported language families

  • North Germanic - gmq
  • West Germanic - gmw
  • Romance - roa
  • Slavic - sla

North Germanic - gmq

North Germanic (gmq) includes Danish, Norwegian, Swedish, Faroese and Icelandic and can be converted using this parameter::

LiquidCrystal_PCF8574 lcd(addr, cols, rows, convert_gmq); // create LCD object

Danske bogstaver på LC display

svenska bokstäver på LC-display

norske bokstaver på LCD-skjerm

íslenskir stafir á LC skjá

West Germanic - gmw

West Germanic (gmw) includes Dutch, English, German, Scots, Frisian

LiquidCrystal_PCF8574 lcd(addr, cols, rows, convert_gmw); // create LCD object

LCD with German Umlauts

Please keep in mind, that for German, there are several specific converters available. Also the large Umlauts can be converted to real diacritic letters. German speaking users should check the German site also.

For English some deprecated letters are replaced to their plain ASCII representation:

 LCD with english letters

The Dutch ij is not present in the ASCII code, nor in any of the ISO 8859 character encodings. Therefore, this digraph is most often encoded as an i followed by a j. And even you will find these ligatures at 0xc4b2 and 0xc4b3 it will be just replaced by I.

Romance Languages - roa

Portuguese, Spanish, Catalan, French, Italian, Romanian are examples for Romance languages. They need a lot of conversions (but still less more than the full ASCII converter):

LiquidCrystal_PCF8574 lcd(addr, cols, rows, convert_roa); // create LCD object

LCD with Italian characters

LCD with Spanish, including reversed questionmark

LCD with Catalan special characters

LCD with French special characters

LCD with Romanian special characters

LCD with Portugese special characters

Slavic Languages - sla

For the Slavic languages (sla) like Czech, Slovak, Polish, Bulgarian, Mazedonian, Serbian, Croatian, Bosnian, Montenegrin, Burgenland Croatian, Slovene you can use

LiquidCrystal_PCF8574 lcd(addr, cols, rows, convert_sla); // create LCD object

LCD with Czech characters

LCD with Slovak special characters

LCD with Slovene special characters

LCD with Polish special characters

Language Specific Character Settings

The smallest flash usage can be achieved with language specific mappings. They are available if there is a legit need or if a language doesn't fit well in one of the above language families.

  • en - English - just as starting point with some deprecated English letters
  • es - Spanish - will also include the characters for Catalan
  • de - German - as it is my native language
  • fr - French - lot of characters. So you still can use romance-roa instead
  • fi - Finnish - this Uralic language doesn't fit to well into the existing language families
  • hu - Hungarian - this Uralic language doesn't fit to well into the existing language families

Estonian

Estonian (beside being a Uralic language) is best covered with the Romance LCD converter.

LCD with Estonian special characters

According to wikipedia: the official Estonian alphabet has 27 letters: A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, R, S, Š, Z, Ž, T, U, V, Õ, Ä, Ö, Ü.  Occasionally, the alphabet is recited without them, and thus originally has only 23 letters: A, B, D, E, G, H, I, J, K, L, M, N, O, P, R, S, T, U, V, Õ, Ä, Ö, Ü.

The library contains an example how to implement a converter including support of the Õ using 5 special characters (Ä Ö Ü Õ õ).

French

French is included in the Romance language Family and there is also a separate French only converter available which needs less flash memory:

LiquidCrystal_PCF8574 lcd(addr, cols, rows, convert_fr); // create LCD object

 LCD with French special characters

Finnish

Finnish is an Uralic language, you can use a dedicated character converter. Most of the characters are replaced by their plain counterparts because only ä and ö can be found in the HD44780 ROM.

LiquidCrystal_PCF8574 lcd(addr, cols, rows, convert_fi); // create LCD object

LCD with Finnish special characters

If you use 8 special characters you could program your own converter for full support. See the Swedish Example 5013_Convert_Swedish how to do that.

German

Any default constructor (without explicit callback) enables the support for the small letters ä ö ü and ß as these letters are in the ROM A00. The large German umlauts Ä Ö Ü will be converted to their counterpart A O U, as there are no capital Umlauts in the Standard HD44780 A00 Character set.

The convert_small will convert large Umlauts into small umlauts. This comes handy if you need the difference Umlaut/ASCII. The Umlauts O and U are just one pixel smaller, so the difference is not much if you want to write österreich or überraschungsei to the LCD. There a very view words in German starting with Ä.

LiquidCrystal_PCF8574 lcd(addr, cols, rows, convert_small);             // Ä --> ä

In German it is very common to replace an Umlaut with the ASCII letter followed by a small e. But be carefully, because the text will expand by this additional letter!

LiquidCrystal_PCF8574 lcd(addr, cols, rows, convert_ae);          // Ä --> Ae

And finally there is one converter which uses the last three custom characters (5,6 and 7) for the representation of Ä Ö Ü. You have to use the callback "convert_special"

LiquidCrystal_PCF8574 lcd(addr, cols, rows, convert_special);   // Ä --> Ä 

Additionally you have to create these custom characters. This can be done with a simple call of one method in the setup():

lcd.createUml(); // create 3 German Umlauts using Special Characters 5, 6, and 7 - used for convert_special

For German specific sketches, see the examples 0x05_xxx_German_Umlaut.

Hungarian

Hungarian is an Uralic language, you can use dedicated character converters. Most of the characters are replaced by their plain counterparts.

LiquidCrystal_PCF8574 lcd(addr, cols, rows, convert_hu); // create LCD object

LCD with Hungarian Letters

Swedish

For Swedish there is also an example with a converter for full support using special characters. See the Example 5013_Convert_Swedish to see how to write your very specific converter with special characters.

Gaj's Latin alphabet

For the Serbo Croatian languages the Gaj's Latin alphabet is covered within the Slavic converter:

LiquidCrystal_PCF8574 lcd(addr, cols, rows, convert_sla); // create LCD object

LCD with Gaj's Alphabet

lcd.print("ČčĐ𩹮ž"); // Gaj's Latin

The Example Sketch 5030_Convert_ASCII

Most of the examples were made with the sketch 5030_Convert_ASCII. First you have to define which converter should be used, than you have to activate the Hardware specific LCD object. After compilation and upload you can jump through the examples by a simple send within the serial monitor. As always, if you find a bug - please let me know. If the ASCII converter occupies to much memory, try a smaller variant fitting to your language.

Hebrew on the Character LCD

LCD with the the SPLC780 are compatible to the HD44780 but come with more character ROM variants. The LC displays with ROM 015A *) contains Hebrew Characters. Additionally a lot of capital Cyrillic letters and some Latin letters (äöü). The converter

convert_SPLC780D1_015A

can be used for easy printing to such LCD.

To invers the order of writing call

lcd.rightToLeft();

Additionally don't forget to position the cursor to the right end of the each row to place the cursor to the right before printing:

lcd.setCursor(cols - 1, 0); // set cursor to start position

convert_SPLC780D1_015A

From ASCII to Latin to Cyrillic - LiquidCrystalRus

If you are interested in Cyrillic, see the this page: Noiasca Liquid Crystal Library Russian - Cyrillic Letters

Summary

With the additional language converters it becomes very easy to convert from letters with diacritic signs to the printable ASCII letters. If you are from an European country and you need better support of Latin1-4 letters you should consider to buy a SPLC780D1 LCD - which is also supported by this library.

Links

(*) Disclosure: Some of the links above are affiliate links, meaning, at no additional cost to you I will earn a (little) comission if you click through and make a purchase. I only recommend products I own myself and I'm convinced they are useful for other makers.

History

First upload: 2020-09-02 | Version: 2024-03-22