Introduction: How to Connect a Serial LCD With an Arduino Nano

In a earlier instructable I demonstrated how to connect the serial LCD to an Arduino UNO

https://www.instructables.com/you?show=PUBLISHED

Yesterday I wanted to use two Arduinos for an RF project and realized that I don't know how to use the serial LCD with the Arduino Nano. So with a bit of research I was able to connect it and decided to share it with you.

Step 1: Here Is What You Need for This Project

  1. An Arduino Nano or a Nano compatible
  2. A solderless breadboard
  3. An LCD with an I2C
  4. Four jumper wires

Step 2: Connect the LCD and the NANO

I found a pinout diagram for the Arduino NANO which clearly indicates that the SDA and the SCL pins on the NANO are the A4 and the A5 pins.

Place the NANO on the solderless breadboard

Connect the black jumper cable from the GND pin on the LCD to the BND pin on the NANO

Connect the red jumper cable from the VCC pin on the LCD to the VCC pin on the NANO

Connect the green jumper cable from the SDA pin on the LCD to the A4 pin on the NANO

Connect the yellow jumper cable from the SCL pin on the LCD to the A5 pin on the NANO

Next step load the Arduino IDE and upload the sketch

Step 3: The Sketch

I already explained the sketch in details in the previous instructable

https://www.instructables.com/id/How-to-connect-a-s...

I just changed the output on the LCD to Happy Halloween

I will include the sketch with this instructable.

//load libraries
#include <Wire.h> #include <LCD.h> #include <LiquidCrystal_I2C.h>

//Define variables

#define I2C_ADDR 0x27 //Define I2C Address where the PCF8574A is #define BACKLIGHT_PIN 3 #define En_pin 2 #define Rw_pin 1 #define Rs_pin 0 #define D4_pin 4 #define D5_pin 5 #define D6_pin 6 #define D7_pin 7

//Initialise the LCD LiquidCrystal_I2C lcd(I2C_ADDR, En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

void setup() { //Define the LCD as 16 column by 2 rows lcd.begin (16,2); //Switch on the backlight lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE); lcd.setBacklight(HIGH); //goto first column (column 0) and first line (Line 0) lcd.setCursor(5,0); //Print at cursor Location lcd.print("HAPPY"); //goto first column (column 0) and second line (line 1) lcd.setCursor(3,1); lcd.print("Halloween"); } void loop(){ }

Comments

author
onlinesid made it! (author)2016-09-16

About the lcd.h, check this article https://www.instructables.com/id/How-to-connect-a-s...

Also in my case the I2C_ADDR that works for me is 0x3F

I used the following sketch to find the I2C_ADDR:

// ------------------------------------

// I2C Scanner

// Written by Nick Gammon

// Date: 20th April 2011

#include <Wire.h>

void setup() {

Serial.begin (9600);

// Leonardo: wait for serial port to connect

while (!Serial)

{

}

Serial.println ();

Serial.println ("I2C scanner. Scanning ...");

byte count = 0;

Wire.begin();

for (byte i = 8; 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() {}

IMG_20160916_014716.jpg
author
eliesalame (author)onlinesid2016-09-18

Excellent :) I love to see different codes for the same project.

Thank you

author
aaviles5 (author)2015-12-22

you didnt include the lcd.h library for us to download

About This Instructable

21,790views

28favorites

License:

More by eliesalame:Print the IP Address on LCD From Arduino and Ethernet ShieldGame of Thrones Music BoxOne Pot 5 Vegetables Veal Shank Soup
Add instructable to: