How to Connect a Serial LCD With an Arduino Nano
by eliesalame in Circuits > Arduino
103262 Views, 40 Favorites, 0 Comments
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.
Here Is What You Need for This Project
- An Arduino Nano or a Nano compatible
- A solderless breadboard
- An LCD with an I2C
- Four jumper wires
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
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(){ }