Instructables

I2C LCD Controller (the easy way)

Picture of I2C LCD Controller (the easy way)
I am working on an alarm/weather station project and I wanted to use an LCD but dint want to have a lot of wires so I order a controller. This is just a very basic tutorial on how to hook it up, for the beginners like my self.
 
Remove these adsRemove these ads by Signing Up

Step 1: Parts

Picture of Parts
IMG_20130427_073024.jpg
IMG_20130427_073038.jpg
IMG_20130427_073739.jpg

Parts list:

 

 

 

1. LCD in this case a 16x02

 

1. I2C 1602 LCD Controller ($1.99 on ebay free shipping)

 

4. Jumper wires

 

1. Arduino ( I have a mega)    

 

Step 2: Soldering

Picture of Soldering
IMG_20130427_073445.jpg
lcd.jpg
Now we solder the LCD and the controller. make sure you have the correct pin arrangement. Mine doesn't have a mark for pin one, but I just looked at the 5+ and GND inputs to figure it out.

Step 3: Connecting

Picture of Connecting
IMG_20130427_080507.jpg
it is very simple to connect only 4 wire 5+ and GND and  SDA goes to Arduino pin 20 and SCL to pin 21 on my arduino mega. depending on what you have it might be different.

Step 4: The Code

Picture of The Code
Since the seller doesn't provide any info I neede to find the address for the module so I ran an I2C scanner
 //Written by Nick Gammon
// Date: 20th April 2011

#include <Wire.h>

void setup() {
  Serial.begin (115200);

  // Leonardo: wait for serial port to connect
  while (!Serial)
    {
    }

  Serial.println ();
  Serial.println ("I2C scanner. Scanning ...");
  byte count = 0;
 
  Wire.begin();
  for (byte i = 1; i < 120; i++)
  {
    Wire.beginTransmission (i);
    if (Wire.endTransmission () == 0)
      {
      Serial.print ("Found address: ");
      Serial.print (i, DEC);
      Serial.print (" (0x");
      Serial.print (i, HEX);
      Serial.println (")");
      count++;
      delay (1);  // maybe unneeded?
      } // end of good response
  } // end of for loop
  Serial.println ("Done.");
  Serial.print ("Found ");
  Serial.print (count, DEC);
  Serial.println (" device(s).");
}  // end of setup

void loop() {}
amurzakhmetov made it!1 month ago

very useful!

photo-1.JPG
MoonDocker2 months ago

Thanks for sharing this is valuable code. There are a lot of LCD's out there with little or no documentation. I have an Arduino Uno and the pin setup was SCL on A5 and the SDA on A4.

verdelj (author) 11 months ago
The scanner works great it found the module address 0X20. Usually is 0x20 or 0x27 but the I2C Scanner its a great tool to have.
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!