LCD is not exposed to writing

I'm having a problem with the LCD screen as it doesn't show me the text written, but the card reading boxes appear in the serial monitor, and it's supposed to show the time and date when reading, but the text does not appear on lcd scree.

This code

#include <SPI.h>
#include <MFRC522.h>
#include <LiquidCrystal.h>

// Pin setup for MFRC522 RFID Reader
#define SS_PIN 10
#define RST_PIN 9
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance

// Pin setup for 16x2 LCD
#define LCD_RS 8
#define LCD_EN 2
#define LCD_D4 4
#define LCD_D5 5
#define LCD_D6 6
#define LCD_D7 7
LiquidCrystal lcd(LCD_RS, LCD_EN, LCD_D4, LCD_D5, LCD_D6, LCD_D7);

// Pin setup for Active Buzzer
#define BUZZER_PIN 3

void setup() {
Serial.begin(9600); // Initialize serial communication
lcd.begin(16, 2); // Initialize 16x2 LCD

SPI.begin(); // Initialize SPI communication
mfrc522.PCD_Init(); // Initialize MFRC522 RFID Reader

pinMode(BUZZER_PIN, OUTPUT); // Set buzzer pin as output
}

void loop() {
// Look for new cards
if ( ! mfrc522.PICC_IsNewCardPresent() || ! mfrc522.PICC_ReadCardSerial() ) {
return;
}

// Print card UID on serial monitor
Serial.print("Card UID: ");
for (byte i = 0; i < mfrc522.uid.size; i++) {
Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");
Serial.print(mfrc522.uid.uidByte[i], HEX);
}
Serial.println();

// Print card UID on LCD
lcd.clear();
lcd.print("Card UID: ");
for (byte i = 0; i < mfrc522.uid.size; i++) {
  lcd.setCursor(0, 1);
  lcd.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");
  lcd.print(mfrc522.uid.uidByte[i], HEX);
}

// Get current time
unsigned long currentTime = millis();

// Print current time on serial monitor
Serial.print("Time of reading: ");
Serial.println(currentTime);

// Print current time on LCD
lcd.setCursor(1, 1);
lcd.print("Time: ");
lcd.print(currentTime);

// Make buzzer beep for 100 milliseconds
digitalWrite(BUZZER_PIN, HIGH);
delay(100);
digitalWrite(BUZZER_PIN, LOW);

// Wait for 1 second before reading the next card
delay(1000);
}


before you start to write your own sketch, proof if your wiring is correct.
Use the Hallo World example from the library Example and make your LCD working.

I suspect you didn't connect the RW line to GND.

Just as an example:
https://docs.arduino.cc/learn/electronics/lcd-displays/

As mentioned:
first make the LCD example working, than proceed with your sketch.

This is diagram for this circuit

Hi,

You might be right;


Six connections and 5 wires, gap between RS and E.

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

will not work. See my answer in post #2

When i try to post 2 the lcd make same problem and i changed lcd and i show the same problem in it.

Hi,
Please disconnect all except the display and run your code.
Also try the example code that came with the library, check the pin allocations.

Have you tried adjusting the contrast pot, which is not show in post #3.

Please reverse engineer your project and post a copy of your circuit, a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, power supplies, component names and pin labels.

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

post the LCD only code you have used.

This code i used :


/*
  LiquidCrystal Library - Hello World

 Demonstrates the use a 16x2 LCD display.  The LiquidCrystal
 library works with all LCD displays that are compatible with the
 Hitachi HD44780 driver. There are many of them out there, and you
 can usually tell them by the 16-pin interface.

 This sketch prints "Hello World!" to the LCD
 and shows the time.

  The circuit:
 * LCD RS pin to digital pin 12
 * LCD Enable pin to digital pin 11
 * LCD D4 pin to digital pin 5
 * LCD D5 pin to digital pin 4
 * LCD D6 pin to digital pin 3
 * LCD D7 pin to digital pin 2
 * LCD R/W pin to ground
 * LCD VSS pin to ground
 * LCD VCC pin to 5V
 * 10K resistor:
 * ends to +5V and ground
 * wiper to LCD VO pin (pin 3)

 Library originally added 18 Apr 2008
 by David A. Mellis
 library modified 5 Jul 2009
 by Limor Fried (http://www.ladyada.net)
 example added 9 Jul 2009
 by Tom Igoe
 modified 22 Nov 2010
 by Tom Igoe
 modified 7 Nov 2016
 by Arturo Guadalupi

 This example code is in the public domain.

 https://docs.arduino.cc/learn/electronics/lcd-displays

*/

// include the library code:
#include <LiquidCrystal.h>

// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("hello, world!");
}

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  lcd.print(millis() / 1000);
}

The pins in this sketch doesn't seem to fit to the used pins according to your picture - but they are hard to see. Double check them.

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