Shashwat Raj
Published © GPL3+

How to connect two 16*2 LCD together with arduino

In this I will tell you how to connect two 16*2 LCD together with single arduino. This is a very unique project. you can't find this anywhere.

IntermediateFull instructions provided4,199
How to connect two 16*2 LCD together with arduino

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
Alphanumeric LCD, 16 x 2
Alphanumeric LCD, 16 x 2
×2
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires

Story

Read more

Schematics

Circuit Diagram

This is the circuit diagram of project

Code

Arduino Source code

Arduino
This is the source code which is uploaded on arduino
#include <LiquidCrystal.h>
LiquidCrystal lcd2(12, 11, 1, 2, 3, 4);
LiquidCrystal lcd1(0, 10, 8, 7, 6, 5);

char * LargeText = "  Connecting 2 - 16*2 LCD with Arduino by shashwat__raj.  ";
int iLineNumber = 1;                                                                
int iCursor = 0;

void setup() 
{
  
  lcd1.begin(16, 2);                                                          
  lcd2.begin(16, 2);
  lcd1.clear();
  lcd2.clear();
  
}
void loop() 
{
  
  UpdateLCDDisplay();                                                              
  delay(160);                                                                      
  lcd1.clear();
  lcd2.clear();
  delay(60);
  
}

void UpdateLCDDisplay()
{
  int iLenOfLargeText = strlen(LargeText);                                         
  if (iCursor == (iLenOfLargeText - 1) )                                            
{
   iCursor = 0;
}
  lcd1.setCursor(0,iLineNumber);
  lcd2.setCursor(0,iLineNumber);
  if(iCursor < iLenOfLargeText - 32)                                             
{
  for (int iChar = iCursor; iChar < iCursor + 16 ; iChar++)
{
  lcd1.print(LargeText[iChar]);
}
  for (int iChar = iCursor + 16 ; iChar < iCursor + 32 ; iChar++)
{
  lcd2.print(LargeText[iChar]);
}
}
  else
{
  for (int iChar = iCursor; iChar < (iLenOfLargeText - 1) ; iChar++)           
{
  if(16 > (iChar - iCursor))
{
  lcd1.print(LargeText[iChar]);
}
  else
{
  lcd2.print(LargeText[iChar]);
}
}
  for (int iChar = 0; iChar <= 32 - (iLenOfLargeText - iCursor); iChar++)       
{
  if(16 > (32 - (iLenOfLargeText - iCursor)))
{
  lcd2.print(LargeText[iChar]);
}
  else
{
  if( ((32 - (iLenOfLargeText - iCursor)) - 16) >=  iChar)
{
  lcd1.print(LargeText[iChar]);
}
  else
{
  lcd2.print(LargeText[iChar]);
}
}  
}
}
  iCursor++;
}

Credits

Shashwat Raj

Shashwat Raj

7 projects • 12 followers
My name is Shashwat Raj. I love doing projects with arduino and Raspberry Pi. You want to view more please subscribe to my YouTube Channel.

Comments