RFID reader on Arduino with LCD display

This post is in continuation to RFID Reader with Arduino.

We can append previous post’s code to display the output to LCD display module instead of serial monitor. To do so, we will just pass the final output of “msg” to lcd.print argument.

Requirements

  1. Arduino                        :- i am using Arduino Uno
  2. 16×2 Display module :- i am  using JHD 162A.
  3. ES-125R                        :-i am using a 125Khz RFID Reader Module.
  4. RFID Tags.

Connections

  • Previous post’s connection will remain intact. These connection are for LCD module only
  • LCD RS pin          <—> digital pin 2
  • LCD Enable pin  <—>digital pin 3
  • LCD D4 pin         <—> digital pin 4
  • LCD D5 pin         <—> digital pin 5
  • LCD D6 pin         <—>digital pin 6
  • LCD D7 pin         <—> digital pin 7
  • LCD R/W pin      <—> ground
  • 10K resistor  (if needed for contrast, you can ground it in-spite), ends to +5V and ground wiper to LCD VO pin (pin 3)

Code


#include <LiquidCrystal.h>
#include <SoftwareSerial.h>

SoftwareSerial RFID(10, 11);
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);

void setup() {
//  Serial.begin(9600);
//  Serial.println("Serial Ready");

RFID.begin(9600);
// Serial.println("RFID Ready");

lcd.begin(16, 2);

}

void loop() {
int index =0 ;

char unit;
String msg;
//while no card is in field of action

if(msg==0){                          
lcd.setCursor(0,0);
lcd.print(" TAG is not in  ");
lcd.setCursor(0,1);
lcd.print("field of action ");
}
while(RFID.available()>0){      
         //when card is in field
lcd.setCursor(0,0);
lcd.print("TAG ID number is");
lcd.setCursor(0,1);
lcd.print("                ");
//clearing previos data

unit = RFID.read();

index++;

msg += unit;

if(index == 12)  {
//       Serial.print("Tag ID:");
// uncomment it for serial debugging
//       Serial.println(msg);
lcd.setCursor(2,1);

lcd.print(msg);
break; }

}
msg="";                         
    //clearing msg container
delay(1000); 
    //giving delay for persistence of vision
}

Demonstration

[videos file=”https://www.youtube.com/watch?v=J01Cf85z1gc” width=”650″ height=”488″][/videos]