4 LCD displays on 1 Arduino

I’m planning an Arduino based project where I would like to use two of the 16×2 character based LCD displays, but at the same time, don’t want to use all the I/O pins, I need some for data input also.

Therefor, I decided to do a test, and see if it’s possible for multiple displays to share some of the pins. The displays have an enable pin, so in theory it should be possible, and after a few tests, I can confirm that it works very well. I’m using the LiquidCrystal library that comes with Arduino 0018. That library is object oriented, and you set each pin for the display in the constructor, making it very easy to set separate pins for the enable pin for each display, and use a bus for the 4 data lines and RS. I’m not reading from the displays, to I simply tied R/W to GND, indicating write only.

This setup uses a total of 5 shared pins on the Arduino (Data and RS), and then one pin (Enable) for each display.

Below is my modified version of the HelloWorld example from the LiquidCrystal library, that initializes 4 displays and outputs individual content to each display.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// include the library code:
#include <LiquidCrystal.h>
 
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd1(12, 5, 7, 8, 9, 10);
LiquidCrystal lcd2(12, 4, 7, 8, 9, 10);
LiquidCrystal lcd3(12, 3, 7, 8, 9, 10);
LiquidCrystal lcd4(12, 2, 7, 8, 9, 10);
 
void setup() {
  // set up the LCD's number of rows and columns: 
  lcd1.begin(16, 2);
  lcd2.begin(16, 2);
  lcd3.begin(16, 2);
  lcd4.begin(16, 2);
 
  // Print a message to the LCD.
  lcd1.print("Disp1");
  lcd2.print("Disp2");
  lcd3.print("Disp3");
  lcd4.print("Disp4");
}
 
void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd1.setCursor(0, 1);
  lcd2.setCursor(0, 1);
  lcd3.setCursor(0, 1);
  lcd4.setCursor(0, 1);
 
 // print the number of seconds since reset:
  lcd1.print(millis()/1);
  lcd2.print(millis()/10);
  lcd3.print(millis()/100);
  lcd4.print(millis()/1000);
}

My test setup is all powered via USB, and the contrast is controlled using a single trim pot, feeding all the displays with the same voltage for the contrast pin (V0).

I’m using pin 7, 8, 9 and 10 on the Arduino for the data lines, pin 12 for RS and pin 2, 3, 4 and 5 for the enable signal for display 1, 2, 3 and 4 respectively, but that’s easy to change if you use some of them for other tasks.

Downloads

I have made a PDF file with the connection diagram for the breadboard setup. I have tried to draw the wires so that they can be traced, but if something is unclear, feel free to ask and I’ll do my best to clarify.

23 thoughts on “4 LCD displays on 1 Arduino”

  1. Francisco Javier Torres Ponce says:

    Thanks for this article. I used it to improve my little lap & time slot counter joining an additional display. Now it has one display per lane (it has two).
    You can see the old one in this video:
    http://www.youtube.com/watch?v=FscmY-A5o_M

    The new one is almost ready.

  2. Hi Francisco,

    That looks great!

    I’m glad that you could use my little “proof of concept” setup documentation for your project.

    If you make a video of the next version, feel free to post a comment with a link, I’d love to see that!

    /Thomas

  3. Winston Pike says:

    thanx for the R&D on the displays. I’m sure this will help a lot of people who want to display more data. Other than having to use multiple serial LCDs; this is just as good.
    especially if you have a few parallel LCDs laying around.

  4. john wrigley says:

    thank you for the “LiquidCrystal” multiple display sketch example!! I felt for sure there was a simple way to do this and you found it! Interesting that the official arduino reference site did not have this simple suggestion…but, oh well…

  5. Naadir says:

    Could you please do a post on hacking a natural display calculator 31-dot × 96-dot LCD screen with an arduino, still keep it looking like a normal calculator

  6. Gustavo says:

    Hi there,

    I need to be very efficient using pins for a project I’m working on (I must admit that I’m kind of a newbie). I love what you did, but I had a couple of questions:

    1- is it possible that you share how you did the connections (schematics, perhaps)?

    2- I have recently read about using an MCP23017 I2C chip to master 1 LCD on 2 Pins, I was wondering in the need for 4 LCDs, if it was possible to be more efficient than your current arrangement?

    Thanks in advance for your thoughts.

  7. Hi Gustavo,

    If you really need to save pins, one option is to unload the LCD control to a separate chip, eg. another avr… there is even a sketch in the Arduino environment that makes a serially controlled LCD. That sketch could probably be modified a little to be able to control multiple displays and only require a single I/O pin from the main controller to run some UART commands (could probably be soft serial if the hardware serial is occupied).

    Using shift registers or I/O expanders is probably also possible, but I haven’t tried it myself.

    I hope it helps,

    /Thomas

  8. Hi Naadir,

    I guess you are talking about the Casio fx350es or something similar, right? Even though it could be fun, I can think of a lot of other projects that I would rather spend time on. Calculators are often custom silicon with all features put together in one “blob” and difficult to interface with. But I do have some graphics display modules that I will probably use in some projects in the future.

  9. Ben Porter says:

    Hi Thomas,

    I was wondering if you had tried to connect the LCD displays together within the code so that, for example, you could have a message that scrolled across all 4 displays?

    I say this because I am currently working on a project using an array of the Nokia 5110 LCD screens and it would be extremely useful if you could give an insight into how you might go about having an array of LCD screens physically but coding them as one large screen.

    Cheers,

    Ben

  10. Hi Ben,

    That is an interesting idea, but not something I have tried, I have treated each display by themselves.

    I don’t think the standard library in Arduino would be able to do that, but a few hacks might get close. I would probably look in the direction of letting all displays “see” the complete picture, and then give each a “viewing window” to display. This way, you can also decide to have a little spacing between the viewing windows, since there will be a bit of distance in the real world. Scrolling or circles will look weird if they jump from one display to the next.

    If it’s just a uniform scrolling, you might be able to just start each display with a certain time delay, and the same “animation” and you will end up with something that looks like a continued motion, but it’s a hack and not efficient coding ;-)

    I hope this is useful for you project.

    /Thomas

  11. Amir says:

    Thomas, this is exactly what I was looking for. I can’t believe it possible. I am so happy to see you we’re able to do it. Since I am a complete newb in arduino, is there any chance you can post some schematics of how to connect all this?
    In my project I will connect the 4 lcd and report (and continuously update) status of 4 different items. Thanks again.

  12. Hi Amir,

    I’m happy that you like my little setup. I have made a PDF file with all the wires drawn up, so that is’t a bit easier to see where each wire goes. Hope it helps, otherwise, please let me know what’s making trouble and I’ll do my best to help.

    http://www.hackmeister.dk/wp-content/uploads/2013/06/4_lcd_1_arduino_diagram.pdf

    /Thomas

  13. Amir says:

    Thomas, fantastic. I was able to duplicate this.
    Thank you very much!
    Is there an easy way to reference the different LCDs using 1 object?
    I mean to have something like this:

    if intVar = 1 then reference lcd1 as lcd2write
    elseif intVar = 2 then reference lcd2 as lcd2write
    elseif intVar = 3 then reference lcd3 as lcd2write
    elseif intVar = 4 then reference lcd4 as lcd2write

    then I can have code
    ld2write.clear() which will clear the display based on the value of intVar.

    I know it can be done, but have no idea how to do it in arduino code.

  14. Hi Amir,

    I would look into having the different LiquidCrystal objects in an array like this:

    LiquidCrystal lcds[4] = {LiquidCrystal(12, 5, 7, 8, 9, 10),
    LiquidCrystal(12, 4, 7, 8, 9, 10),
    LiquidCrystal(12, 3, 7, 8, 9, 10),
    LiquidCrystal(12, 2, 7, 8, 9, 10)};

    and then use intVar to simply select the object you want to work with:

    lcds[intVar].clear();

    and skip the if/else altogether.

    I haven’t tried this code on an Arduino, but it seems to compile OK.

    Let me know how it goes!

    /Thomas

  15. Angel says:

    The schematics were wrong in my case.

    1…
    2…
    11 (Data 4)
    12 (Data 5)
    13 (Data 6)
    14 (Data 7)
    15 (LED +5V)
    16 (LED GND)
    so the 4 data wires had to move one position to the left

    But I’m a n00b and have a 20×4 display. Don’t know if one of these facts made the difference ;)

    Great tut… I needed exactly that for connecting 3 LCDs to my flightsim homecockpit.

  16. Hi Angel,

    Thanks for letting me know, you are right, the two left most displays have the data wires connected to the wrong pins, I’ll try to get the drawing corrected and upload a new one.

    But I’m glad that you liked it!

    /Thomas

  17. Jim says:

    Hello there,

    could you tell me what type/model of LCD’s you are using?

    cheers

    Jim

  18. Hi Jim,

    The displays are the standard 16×2 character displays based on the Hitachi HD44780 (or a compatible) chipset. The specific ones I’m using is from defective battery chargers, where I have scavenged them, but similar displays are used in all sorts of devices.

    /Thomas

  19. Benjamin Vis says:

    Dear Thomas:
    Great project to put more LCDs on one Arduino !
    Hereunder my source to connect two LCDs to one Arduino.
    Unfortunately only lcd1 works OK.
    lcd2 (here blocked) gives either strange characters or nothing at all.
    The Enable pin was connected to resp. pins 6, 9, 10 on the Arduino, which work OK for lcd1.
    What did I wrong ?
    Thanks,
    Ben

    /* Vis_1xLCD

    The circuit:
    * 10k pot; ends to +5V and GND; wiper to LCD AO
    * LCD-pin 4 6 11 12 13 14 5
    * LCD RS E DB4 DB5 DB6 DB7 R/W //for lcd1
    * Ardu D12 D11 D5 D4 D3 D2 GND
    */

    #include
    LiquidCrystal lcd1(12, 11, 5, 4, 3, 2);
    //LiquidCrystal lcd2(12, 6, 5, 4, 3, 2);
    float voltage;
    int mA = 257;

    void setup(){
    lcd1.begin(16, 2);
    // lcd2.begin(16, 2);

    lcd1.print(“Volt mA”);
    // lcd2.print(“Display TWO”);
    }
    void loop() {
    voltage = 3.14; //if no pot. <===========================
    lcd1.setCursor(0, 1);
    lcd1.print(voltage,2);
    lcd1.print(" ");
    lcd1.print(mA);
    }

  20. Hi Benjamin,

    Your code looks correct, only thing I notice is the #include line that’s missing the library, but that might be the comment system stripping that off.

    I would try to swap the two displays (if you haven’t done it already) to make sure both displays work correctly and in the same way.

    Second, if you have confirmed that both displays are functioning correctly, I would try to comment out lcd1, to see if the second display can operate by itself.

    Remember that both displays should be connected with power, contrast, RS, R/W and data in the same way, only EN should be on two different pins on the Arduino.

    Unfortunately, I have made an error in the PDF that I link to with the connection diagram, so the two left most displays have the data connections shifted one pin, which is wrong, they should be connected as the two right most displays in the PDF.

    Hope this helps, if not, please post a link to a photo of your setup or similar, if you want me to check out your connections.

    /Thomas

  21. Benjamin Vis says:

    Dear Thomas:
    Thanks for your suggestions.
    Indeed I had “ #include ” in my code, but apparently, as you said, the library was deleted during the copying process, Probably because of the “”signs.
    Sorry if I disturbed you, but it was only after a few hours that I got it to work, probably through the mass on the breadboard.
    Now it is working fine and I am happy.
    During all the massing around I found that the potmeter for the contrast may be very useful. Until now I just put LCD-pin 3 to GND, but especially for an old LCD without backlight it regulates fine.
    So the more problems you have the more you keep learning.

    Thanks again,
    Ben.

  22. I’m glad that you got it to work, and you are always welcome to ask questions or comment.

    If you have a link to a description of your project, feel fee to post it!

    /Thomas

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>