loading

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(){ }

<p>About the lcd.h, check this article <a href="https://www.instructables.com/id/How-to-connect-a-serial-LCD-to-an-Arduino-UNO/" rel="nofollow">https://www.instructables.com/id/How-to-connect-a-s...</a> </p><p>Also in my case the I2C_ADDR that works for me is 0x3F </p><p>I used the following sketch to find the I2C_ADDR:</p><p>// ------------------------------------</p><p>// I2C Scanner</p><p>// Written by Nick Gammon</p><p>// Date: 20th April 2011</p><p>#include &lt;Wire.h&gt;</p><p>void setup() {</p><p> Serial.begin (9600);</p><p> // Leonardo: wait for serial port to connect</p><p> while (!Serial) </p><p> {</p><p> }</p><p> Serial.println ();</p><p> Serial.println (&quot;I2C scanner. Scanning ...&quot;);</p><p> byte count = 0;</p><p> Wire.begin();</p><p> for (byte i = 8; i &lt; 120; i++)</p><p> {</p><p> Wire.beginTransmission (i);</p><p> if (Wire.endTransmission () == 0)</p><p> {</p><p> Serial.print (&quot;Found address: &quot;);</p><p> Serial.print (i, DEC);</p><p> Serial.print (&quot; (0x&quot;);</p><p> Serial.print (i, HEX);</p><p> Serial.println (&quot;)&quot;);</p><p> count++;</p><p> delay (1); // maybe unneeded?</p><p> } // end of good response</p><p> } // end of for loop</p><p> Serial.println (&quot;Done.&quot;);</p><p> Serial.print (&quot;Found &quot;);</p><p> Serial.print (count, DEC);</p><p> Serial.println (&quot; device(s).&quot;);</p><p>} // end of setup</p><p>void loop() {}</p>
<p>Excellent :) I love to see different codes for the same project.</p><p>Thank you</p>
<p>you didnt include the lcd.h library for us to download</p>

About This Instructable

18,122views

28favorites

License:

More by eliesalame:Game of Thrones Music Box One Pot 5 Vegetables Veal Shank Soup  Arduino 101 Fundamentals 
Add instructable to: