16x2 LCD display does not work... It does not display characters


Circuit Scheme (ignore the missing backlight resistor).

#include <SPI.h>
#include <RF24.h>
#include <nRF24L01.h>
#include <LiquidCrystal.h>

RF24 radio(9, 10); //CE,CSN
const byte address[6] = "00001";

const int rs = 7, en = 6, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

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

  radio.begin();
//  radio.setAutoAck(false);
  radio.setDataRate(RF24_250KBPS);
  radio.openWritingPipe(address);
  radio.setPALevel(RF24_PA_MAX);
  radio.stopListening();

  pinMode(A0, INPUT);
  pinMode(A1, INPUT);
  pinMode(A2, INPUT);
  pinMode(A3, INPUT);

  lcd.begin(16, 2);
  lcd.setCursor (0, 0);
  lcd.print("HELLO");
  

}

void loop() {
    int len = 30;   
    char msgchar[len];
    msgchar[0]=0; //ax
    msgchar[2]=0; //ay
    msgchar[4]=0; //bx
    msgchar[6]=0; //by
    msgchar[8]=0; //ac1
    msgchar[10]=0; //ac2


    //bool status = radio.write(&msgchar,len);
    //Serial.print("sending: ");
    //Serial.println(msgchar);
    //if(status == true){
      //Serial.println("status: connected");
    //}else{
      //Serial.println("status: disconnected");
    //}
    
    /*
    Serial.print(analogRead(A0)); //513
    Serial.print(" ");
    Serial.print(analogRead(A1)); //511
    Serial.print(" ");
    Serial.print(analogRead(A2)); //507
    Serial.print(" ");
    Serial.println(analogRead(A3)); //513
*/
    Serial.println(analogRead(A2));
    lcd.setCursor(0, 1);
}



Code.

Hello, I'm new here and with arduino. My problem is that after connecting all the jumpers and connecting the lcd to the board, it still doesn't work.
It does not display anything, neither rectangles nor characters. I tested it on TinkersCad and it works fine, but on the real board it doesn't work.

Hard to read the tiny font on your LCD PWA, but it looks like some wires are going to where they don't need to go (different model?).

Try this wokwi LCD setup (maybe compare the differences with your project):


I followed the circuit suggested by some people on the forum. Is something strange in the circuit?

I am not using ports 9 to 13, as they are already in use by another module.

The only differences from your drawing to Wokwi is: remove V0 (white, row 7) and put a 220ohm resistor on row 30.

[edit] Also, make the LCD print something first (Hello, World!). Then integrate other devices. [/edit]

I corrected what you said, but I'm still the same... :cry:

Hey, no qq.

I did your pin-out (minus the row-7 white wire, at with the row 30 resistor) on Wokwi and your setup works. Check your wire placement. You have it right.

Make this sketch on your project (correct wiring as stated above):

// LCD1602 - Arduino Uno

#include <LiquidCrystal.h>
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);

void setup() {
  lcd.begin(16, 2);
  lcd.print("Hello World!");
}

void loop() {
}

There's my problem. :thinking:
In WEB simulators it works, but when I put it into practice, it doesn't work.
Ignore the lack of resistance

Breadboards fail or worse, can be intermittent. I still use them, but they are the first to be scrutinized.

The frizzy picture does not convey much information. It shows no power, no contrast biasing resistor, LCD pin information, and a few other things. Since you also have other things connected post an annotated schematic instead of a picture. Other things can make a difference when pins are involved.

she looks ok :thinking:

The wiring diagram is in the question (up there). The other connected devices don't exist in the simulators, but I don't think they influence the lcd.
In the analog inputs I have 2 joysticks and in ports 9 to 13 I have an nRF24L01.

I generally do not work with simulators, just hardware which apparently does not work for you. As you can now see there is a difference between simulation and hardware (reality). In time my questions will make sense as your knowledge increases instead of a pain. I assumed you would include links with "Technical information" on each of the modules. Yes learning to draw schematics is a pain but worth it in the long run Try KiCad, it is free.

I tried to exemplify the circuit in a diagram. Sorry for the simplicity, but that's what I managed to do.

Product links are:

Arduino UNO
Breadboard

1 Like

If I don't connect the contrast pin (V0) it's supposed to keep the contrast at maximum, right?
I've tried with it off and with it directly connected to GND, both haven't changed anything.

V0 might have something to do with the contrast, but "without V0" the simulation works.

The datasheet does NOT have a V0... see page 3, 4, 5, and 7.

WITH the resistor tied to Vcc:

WITHOUT the resistor tied to Vcc:

// LCD1602 to Arduino Uno connection example

#include <LiquidCrystal.h>

LiquidCrystal lcd(7, 6, 5, 4, 3, 2);

void setup() {
  lcd.begin(16, 2);
  // you can now interact with the LCD, e.g.:
  lcd.print("Hello, brun0!");
}

void loop() {
  // NOP
}

The contrast (LCD pin 3 or Vo) must be connected. A resistor to ground or tied directly to ground is necessary. With Vo left unconnected or tied to Vcc there will not be anything displayed.

I use a 1K from Vo to ground on most of my LCDs. A 220 Ω can work or even tied to ground. Many people use a pot to have adjustable contrast.

The contrest (pin 3) and the backlight (pins 15 & 16) are not at all related.

2 Likes

Do not apologize you did Great! There is so much more information. The only thing would be to label the peripherals but no worry at this time. The resistor connected/unconnected is in series with the backlight LED. I think you are all set. Have fun.

1 Like

Hi, @brun0_mf

It looks like you have started with a mass of hardware connected and a mass of code and tried to get it all to work.

Can I suggest your remove ALL hardware apart from the UNO and the LCD display.
Then use one of the Example codes that come with the Library to prove your connections.

Developing your code in stages with hardware in stages will mean you do not encounter bugs that may be from unrelated code/hardware.

We have had 19 posts of suck it and see, lets get logical and make sure your LCD is working, FORGET for the moment the rest of your code and hardware.

Thanks.. Tom.. :smiley: :+1: :coffee: :australia:

Post #5.