I2C LCD 16x2 - nothing displayed

Hello, new to programming an Arduino and trying to display something on my LCD, so I can check the code is functioning correctly. Following some advice, seen here, and have noticed changes with the Nano itself and the output of IDE.

I am using an Arduino Nano V3 and I2C LCD 16x2, the LCD is powered through the Nano and breadboard. LCD is wired to the breadboard, where SCL goes to A5 on Nano, SOA goes to A4, I have noticed that removing and reinserting these two wires changes nothing.

Before I followed some advice, I had one stationary LED at POW, and a flashing LED at L. My LCD is working and backlight is on, but nothing else just a blank screen. Now that I have followed some of the advice the following things have changed :

  • When USB power is applied the LCD initially turns on, then it turns off for a second (this did not happen before) and then it is turned on permanently
  • The Arduino LED at L is no longer flashing off and on
  • A tiny LED at TX is flashing very quickly, on Arduino

The Arduino code was from another person, I know the code is OK because I have contacted said person for some advice. When I have uploaded the code, I get the following

"Using Port : COM3
Using Programmer : arduino
Overriding Baud Rate : 57600
AVR Part : ATmega328P
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC2
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :

                              Block Poll               Page                       Polled
       Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
       ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
       eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
       flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
       lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
       signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

     Programmer Type : Arduino
     Description     : Arduino
     Hardware Version: 2
     Firmware Version: 1.16
     Vtarget         : 0.0 V
     Varef           : 0.0 V
     Oscillator      : Off
     SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: reading input file "C:\Users\fred\AppData\Local\Temp\arduino\sketches\6BEA10B75E9A29F5D50E4A5898A52BE6/sketch_oct11a_SMD_hotplate.ino.hex"
avrdude: writing flash (10004 bytes):

Writing | ################################################## | 100% 2.82s

avrdude: 10004 bytes of flash written

avrdude done. Thank you."

Arduino is on COM 3, Board is selected as Arduino Nano, Processor is selected as ATmega328P (Old Bootloader).

Could somebody advise me where I am going wrong, I have tried the "Hello World" sketch and still cannot see anything on LCD.

Many thanks

Do NOT power anything with the NANO, use a separate power supply but connect the grounds.

You'll have to provide a lot more relevant info other than the report of a successful upload !!
No code , no idea >>
Run the I2C sketch to check the address of the lcd backpack ! :face_with_diagonal_mouth:

#include <thermistor.h>
thermistor therm1(A0, 0);
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);

int but_1 = 12;
int but_2 = 11;
int but_3 = 10;
int but_4 = 9;
int SSR = 3;
int buzzer = 6;
int Thermistor_PIN = A0;

unsigned int millis_before, millis_before_2;
unsigned int millis_now = 0;
float refresh_rate = 500;
float pid_refresh_rate = 50;
float seconds = 0;
int running_mode = 0;
int selected_mode = 0;
int max_modes = 3;
bool but_3_state = true;
bool but_4_state = true;
float temperature = 0;
float preheat_setpoint = 140;  //Mode 1 preheat ramp value is 140-150ºC
float soak_setpoint = 150;     //Mode 1 soak is 150ºC for a few seconds
float reflow_setpoint = 230;   //Mode 1 reflow peak is 230ºC
float temp_setpoint = 0;
float pwm_value = 255;
float MIN_PID_VALUE = 0;
float MAX_PID_VALUE = 180;
float cooldown_temp = 40;  //When is ok to touch the plate!
float Kp = 2;
float Ki = 0.0025;
float Kd = 9;
float PID_Output = 0;
float PID_P, PID_I, PID_D;
float PID_ERROR, PREV_ERROR;

void setup() {
  pinMode(SSR, OUTPUT);
  digitalWrite(SSR, HIGH);
  pinMode(buzzer, OUTPUT);
  digitalWrite(buzzer, LOW);
  Serial.begin(115200);
  pinMode(but_1, INPUT_PULLUP);
  pinMode(but_2, INPUT_PULLUP);
  pinMode(but_3, INPUT_PULLUP);
  pinMode(but_4, INPUT_PULLUP);
  pinMode(Thermistor_PIN, INPUT);
  lcd.init();
  lcd.backlight();
  tone(buzzer, 1800, 200);
  millis_before = millis();
  millis_now = millis();
}

void loop() {
  millis_now = millis();
  if (millis_now - millis_before_2 > pid_refresh_rate) {
    millis_before_2 = millis();
    temperature = therm1.analog2temp();
    if (running_mode == 1) {
      if (temperature < preheat_setpoint) {
        temp_setpoint = seconds * 1.555;  //Reach 140ºC till 90s (150/90=1.555)
      }
      if (temperature > preheat_setpoint && seconds < 90) {
        temp_setpoint = soak_setpoint;
      } else if (seconds > 90 && seconds < 110) {
        temp_setpoint = reflow_setpoint;
      }
      PID_ERROR = temp_setpoint - temperature;
      PID_P = Kp * PID_ERROR;
      PID_I = PID_I + (Ki * PID_ERROR);
      PID_D = Kd * (PID_ERROR - PREV_ERROR);
      PID_Output = PID_P + PID_I + PID_D;
      if (PID_Output > MAX_PID_VALUE) {
        PID_Output = MAX_PID_VALUE;
      } else if (PID_Output < MIN_PID_VALUE) {
        PID_Output = MIN_PID_VALUE;
      }
      pwm_value = 255 - PID_Output;
      analogWrite(SSR, pwm_value);
      PREV_ERROR = PID_ERROR;
      if (seconds > 130) {
        digitalWrite(SSR, HIGH);
        temp_setpoint = 0;
        running_mode = 10;
      }
    }
    if (running_mode == 10) {
      lcd.clear();
      lcd.setCursor(0, 1);
      lcd.print("    COMPLETE    ");
      tone(buzzer, 1800, 1000);
      seconds = 0;
      running_mode = 11;
      delay(3000);
    }
  }
  millis_now = millis();
  if (millis_now - millis_before > refresh_rate) {
    millis_before = millis();
    seconds = seconds + (refresh_rate / 1000);
    Serial.println(temperature);
    if (running_mode == 0) {
      digitalWrite(SSR, HIGH);
      lcd.clear();
      lcd.setCursor(0, 0);
      lcd.print("T: ");
      lcd.print(temperature, 1);
      lcd.setCursor(9, 0);
      lcd.print("SSR OFF");
      lcd.setCursor(0, 1);
      if (selected_mode == 0) {
        lcd.print("Select Mode");
      } else if (selected_mode == 1) {
        lcd.print("MODE 1");
      } else if (selected_mode == 2) {
        lcd.print("MODE 2");
      } else if (selected_mode == 3) {
        lcd.print("MODE 3");
      }
    } else if (running_mode == 11) {
      if (temperature < cooldown_temp) {
        running_mode = 0;
        tone(buzzer, 1000, 100);
      }
      digitalWrite(SSR, HIGH);
      lcd.clear();
      lcd.setCursor(0, 0);
      lcd.print("T: ");
      lcd.print(temperature, 1);
      lcd.setCursor(9, 0);
      lcd.print("SSR OFF");
      lcd.setCursor(0, 1);
      lcd.print("    COOLDOWN    ");
    } else if (running_mode == 1) {
      lcd.clear();
      lcd.setCursor(0, 0);
      lcd.print("T: ");
      lcd.print(temperature, 1);
      lcd.setCursor(9, 0);
      lcd.print("SSR ON");
      lcd.setCursor(0, 1);
      lcd.print("S");
      lcd.print(temp_setpoint, 0);
      lcd.setCursor(5, 1);
      lcd.print("PWM");
      lcd.print(pwm_value, 0);
      lcd.setCursor(12, 1);
      lcd.print(seconds, 0);
      lcd.print("s");
    }
  }
  if (!digitalRead(but_3) && but_3_state) {
    but_3_state = false;
    selected_mode++;
    tone(buzzer, 2300, 40);
    if (selected_mode > max_modes) {
      selected_mode = 0;
    }
    delay(150);
  } else if (digitalRead(but_3) && !but_3_state) {
    but_3_state = true;
  }
  if (!digitalRead(but_4) && but_4_state) {
    if (running_mode == 1) {
      digitalWrite(SSR, HIGH);
      running_mode = 0;
      selected_mode = 0;
      tone(buzzer, 2500, 150);
      delay(130);
      tone(buzzer, 2200, 150);
      delay(130);
      tone(buzzer, 2000, 150);
      delay(130);
    }
    but_4_state = false;
    if (selected_mode == 0) {
      running_mode = 0;
    } else if (selected_mode == 1) {
      running_mode = 1;
      tone(buzzer, 2000, 150);
      delay(130);
      tone(buzzer, 2200, 150);
      delay(130);
      tone(buzzer, 2400, 150);
      delay(130);
      seconds = 0;
    }
  } else if (digitalRead(but_4) && !but_4_state) {
    but_4_state = true;
  }
}


Run the I2C sketch to check the address of the lcd backpack !

Not only that, but not all driver chips on the i2c backpacks are connected to the display in the same way as expected by LiquidCrystal_I2C.h

The best way to trouble shoot issues with the i2c lcd displays is to use the hd44780.h library and run the diagnostic sketch.

The best available library for the i2c lcd displays is called hd44780.h. written by Bill Perry. It is available through the library manager.

I would suggest that you convert to it. It is plug and play for a variety of configurations of the i2c backpack modules. It will detect both the i2c address and the configuration of the driver.

As part of the library there is a comprehensive diagnostic sketch which will test some internal details of the display. It's called I2CexpDiag

In the in the ide you can navigate to the library example

File>Examples>hd44780>ioclass>hd44780_I2Cexp>I2CexpDiag

You need all that modules in post#5 to see if the LCD is working?

Does an example from the LCD Library work ?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.