Home > Arduino, Code > New liquidCrystal Arduino Library

New liquidCrystal Arduino Library

February 5, 2012 Leave a comment Go to comments

A new, 100% compatible with the current liquiCrystal Arduino library is available from: https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home.

With the same interface, the new library supports:

  • 4 bit parallel LCD interface
  • 8 bit parallel LCD interface
  • I2C IO bus expansion board with the PCF8574* I2C IO expander ASIC.
  • ShiftRegister adaptor board as described Shift Register project home.


In addition, it is faster than the existing liquidCrystal included in Arduino. In 4-bit mode (which is sort the “standard” mode), the new library performs operations an average of 3.73 times for a write operation. There is really no need for the current Hifiduino code to have faster LCD operations, but the performance increase is “free”.


Further (and without any change in the code), you can purchase/build an I2C adapter for the LCD and free up 9 pins in the Arduino to do other things. The I2C adapter is explained here: [link]

In Summary,

The nice thing about the library (if we set a side its speed improvements) is that its been written as a virtual class that can be extended to accommodate multiple ways to drive an LCD with the Hitachi chipset or compatible. The only thing that you need to do to include a fully compatible new driver (for example an SPI buffer) is to implement how to write to the buffer and the function to initialise the LCD using that device. All the support functions in the LiquidCrystal library are there and compatible.

The other nice thing, is that if you already have a project that uses a particular LCD driver (say 4 bits) and you now want to change it to I2C the only thing that would change in your code would be the way you create the “variable” to control the LCD. The rest is the same.

This is a bit different approach with respect to the huge collection of libraries that control LCDs and do more or less the same thing.

So with one library, you can control LCDs that use different devices or ways to control them, for example: 4bit, 8bit, I2C, shiftregister (2 and 3 wires) and shortly with just 1 wire.


After downloading the libraries (LiquidCrystal_V1.1.6.zip), I replaced the folder arduino-1.0\libraries\LiquidCrystal with the new LiquidCryistal folder (save the original folder somewhere else). Compiling the existing code resulted in no errors. It also runs as before.

There is no apparent differences in the way the text is displayed. Even thought the write operation to the LCD is faster, the refresh rate of the LCD is the limiting factor, so the display “feels” exactly the same. The only difference is in the “DIM” function: returning from DIM to the current volume setting is about 20% faster. For example if your volume is set at 00 and you DIM the volume (-70 db), it takes 4 seconds to return to 00 volume whereas the code with the original library took 5 seconds.


This library is a contribution by Francisco Malpartida, an Arduino enthusiast from Spain and also one of the developer of “vinciduino” [discussion], an open hardware clone of the Arduino Leonardo.

(The vinciDuino Logo was done by Inizul from the Spanish Arduino forum the creator of the paperDuino. The idea behind the logo was to simulate Leonardo Da Vinci’s habit of writing. In addition, it reads the same rotated 180 degress)

Be sure to check the project’s home page to see what is new…

  1. February 5, 2012 at 19:33

    the license says “New LiquidCrystal Library by F. Malpartida is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. CC BY-SA 3.0″

    how does that actually work? you can never use it for any commercial project?

  2. BlogGeanDo
    February 6, 2012 at 01:26

    Hmmm… That is an interesting question. But the code for non-commercial is CC BY-NC-SA 3.0.

  3. February 6, 2012 at 01:28

    the license says “New LiquidCrystal Library by F. Malpartida is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. CC BY-SA 3.0″

    it’s based on our code, which is open source, how can anyone make the license *more* restrictive and make it non-open source (non-commercial) ?

  4. BlogGeanDo
    February 6, 2012 at 01:46

    Well, I have no connection to the author and never really paid attention to the licensing as I assumed all Arduino code and h/w are open-source. I guess what I was trying to say is that the English words and the license code (CC BY-SA 3.0) contradict each other. In addition, the .h file says:
    // Created by Francisco Malpartida on 20/08/11.
    // Copyright 2011 – Under creative commons license 3.0:
    // Attribution-ShareAlike CC BY-SA
    So it is probably an error…

  5. February 6, 2012 at 11:30


    Sorry for the confusion of the licensing, it should be CC BY-SA. I think that in the wiki is correctly stated even though in the headers it isn’t I will make the adequate changes in coming release.

    Sorry for the misunderstanding.

    F. Malpartida

  6. February 6, 2012 at 13:48


    I am very sorry for the misunderstanding and as BlogGeant has indicated is a typo in the licensing terms of the library in the wiki. The link was correctly placed to the CC licensing terms: BY-SA. The licensing terms in the source code is correct as per: CC BY-SA. I have already updated the wiki section of the library to correct the typo.

    I have checked all the header files and source file comments and they all seam to be correct.

    You are all welcome to use and distribute the library in any form the end user likes (including commercial use) providing that you acknowledge the source and that any additional work based on it, is shared alike. In essence the terms of CC BY-SA.

    Very sorry for the misunderstanding and sincerely hope that you like it and use it.


    F. Malpartida

    • BlogGeanDo
      February 6, 2012 at 21:15

      Hello F. Malpartida,

      Thanks of clarifying the licensing terms. I read that you had iTead do your PCBs. How about having them build them and have them for sale, so people can get fully finished products. Cool board and logo BTW…

  7. February 6, 2012 at 22:55

    Yes, I use iTead Studio for PCB fabrication, I didn’t know they also manufactured. I already have some limited quantities on sale on my online “store”. I quote “store” because it is a very little, modest store.

    If you are interested: http://www.electrofunLTD.com

    Any where else where they can be fabricated?

    • BlogGeanDo
      February 8, 2012 at 17:33

      In reality I don’t know if they will manufacture it, but they are an equivalent of Seeedstudio and I can see that Seeedstudio manufacture and sell 3rd party boards. I suppose you want to meet/beat the US$20 target of the Leonardo. Only those guys can produce it at a lower cost.

  8. February 8, 2012 at 18:49

    @BlogGeanD – thanks for the information I will explore.
    BTW, thank you for your compliments. I will forward your comment [Cool board and logo BTW…] to the vinciDuino team and also to Inizul who is the real artist behind the logo. I am sure he will be pleased to read it.

  9. Val
    September 6, 2013 at 05:32

    Just tried compiling this library against arduino-tiny core (http://code.google.com/p/arduino-tiny/), in order to run it on attiny84 chip. Result: the binary is 4K too big – won’t fit onto an 8K chip.

    I was wondering if anyone has experience with this – is it possible to get this library to work on an attiny chip?

    • Val
      September 6, 2013 at 07:03

      Wow – this does not look promising. This is the summary of the memory usage by the LiquidCrystal library:

      LiquidCrystal.o: 1502K
      /avr/lib/avr25/libc.a: 3336K
      /avr/4.5.3/avr25/libgcc.a: 3682K
      /ArduinoTinyCore/tiny84_8MHz/libArduinoTinyCore.a: 5306K

      • Val
        September 6, 2013 at 20:30

        Problem solved.

        The solution was to pass the –gc-sections to the linker. This enables garbage collection of unused functions, which makes LiquidCrystal library fit on an ATTiny84 with room to spare.

      • fm
        September 6, 2013 at 21:37

        Cool, nice going.

      • BlgGear
        September 7, 2013 at 14:40

        Thanks for sharing.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s