Professional Documents
Culture Documents
RFID GSM Based Student Attendance Alert Message To Parents
RFID GSM Based Student Attendance Alert Message To Parents
com
/rfid-gsm-based-student-attendance-alert-message-to-parents/
RFID & GSM based student Attendance Alert message system– Recently, crime against children is
increasing at a higher rate and it is high time to offer a safety system for the children going to school.
When a child does not come to school it is very important to inform the parents. Time can be critical, as
small children may get in trouble and help should come quickly.
It is the responsibility of the school management to inform the parents in time whether their child is
present or absent. However, this is not easy to do this manually by typing and sending alert messages to
parents. So, a suitable solution for this problem is to design an automatic messaging system. Each
student is given an RFID card, when the student swipes a card a message is sent to their parents. This
way the parents can know whether their child is present or absent. So in this episode, you will learn how
to make an automatic parents alert messaging system using Arduino, MFRC522 RFID module, 16×2
LCD, and a GSM SIM900A module.
For the complete project Designing and Programming Watch Video Tutorial.
Amazon Links:
12v Adaptor:
1/10
Arduino Uno
Arduino Nano
Mega 2560:
Digital Oscilloscopes
Variable Supply
Digital Multimeter
*Please Note: These are affiliate links. I may make a commission if you buy the components through
these links. I would appreciate your support in this way!
2/10
This is the GSM module, in the market, we have different types of GSM modules, the one I will be using
today is sim900A if you want you can also use any other gsm module, like for example sim900D. I have
also tested the same programming using sim900D but with a different baud rate, the rest of the program
remains the same.
If you are from Pakistan, Bangladesh or India make sure you double-check the GSM module and
purchase the unlocked version of the sim900A. This GSM sim900A module as you can see on the screen
has no Onboard voltage regulator, so be careful while applying the voltage. The ideal voltage for this
3/10
GSM module is 4.7v but you can also connect it with a 5v adaptor. If you don’t have a 5v adaptor then
you can make your power supply using an lm317t adjustable variable voltage regulator, I have a very
detailed tutorial on lm317t explaining everything. Watch the video tutorial.
As you can see clearly in the picture above this module has so many pins that are clearly labeled, but we
will be using only 5 of these pins, the power supply pins, GND, Rxd 5v, and TXD 5v. The GND will be
connected with the Arduino GND, TXD will be connected with the Arduino pin2 and RXD will be
connected with the Arduino pin4.
If you want to study more about the GSM SIM900A Module, then consider reading my article on GSM
SIM900A with Arduino Complete Guide.
The first pin of the RFID module is the VCC and this will be connected with 3.3v of the Arduino. Pin
number 2 is the RST or reset, pin number 3 is the ground, while the MISO pin, MOSI PIN, SCK pin and
NSS pin, these four pins are the SPI pins and will be connected with the Arduino SPI pins, In Arduino the
SPI pins are
4/10
pin number 13 is the SCK
What is SPI :
SPI stands for “Serial Peripheral Interface”. It is a Synchronous serial data bus, which means that the
data can travel in both directions at the same time, as opposed to (for example) the I2c bus that cannot
do so. To use Synchronous data transmission, the SPI bus makes use of the four wires, and they are
called.
MISO: The MISO stands for Mater in, Slave Out. The purpose of this line is to carry data from the SPI
support devices back to Arduino.
MOSI: The MOSI stands for Master Out, Slave In. the purpose of this line is to carry data from the
Arduino to the SPI supported devices.
SS: The SS stands for Slave Select. Each SPI supported device needs a unique SS line back to Arduino.
5/10
As you know my friends GSM sim900A module communicates with the Arduino using Serial
communication so that’s why we have to define pins for the Tx and Rx pins of the GSM sim900A
module. As you know that the Arduino has only one serial port which is on pin number0 and pin
number1.
As I always say use the Arduino’s default Serial port only for debugging purposes. Now the question is if
we are using the Arduino’s default serial port for the debugging purposes, then how we will connect the
GSM module?
Well no worries at all, we can define multiple serial ports using the SoftwareSerial library which I will
explain in the programming. As you can see in the circuit diagram Tx of the GSM sim900A module is
connected with pin number 7 of the Arduino and Rx of the GSM sim900A module is connected with pin
number 8 of the Arduino and GND is connected with the Arduino’s ground. a power supply is connected
with sim900A ideal voltage is 4.7volts to 5volts.
The MFRC522 RFID module VCC pin is connected with the Arduino’s 3.3volts and the ground is
connected with the Arduino’s ground. the RST, SS, MOSI, MISO, and sck pins of the MFRC522 RFID
module are connected with pins 9, 10, 11, 12, and 13.
Pin number1 and pin number 16 of the LCD are connected with the Arduino’s Ground while pin number2
and pin number 15 are connected with the Arduino’s 5 volts. Pin number 3 of the 16×2 LCD is the
contrast pin and is connected with the middle leg of the variable resistor, this variable resistor is used to
control the LCD brightness, the remaining two legs of the variable resistor are connected with the
Arduino’s 5volts and Ground.
6/10
The Rs pin of the LCD is connected with the Arduino’s analog pin A1, the en pin is connected with the
analog pin A2, while d4 to d7 pins of the LCD are connected with pins 6, 5, 4 and 3 of the Arduino.
1 /* terminal1 program
2 -----------------------------------------------------------------------------
3 * Pin layout should be as follows:
4 * Signal Pin Pin Pin
5 * Arduino Uno Arduino Mega MFRC522 board
6 * ------------------------------------------------------------
7 * Reset 9 5 RST
8 * SPI SS 10 53 SDA
9 * SPI MOSI 11 51 MOSI
10 * SPI MISO 12 50 MISO
11 * SPI SCK 13 52 SCK
12 * voltage 3.3v
13 */
14 // gsm module is connected with pin number 7 and pin number 8 of the arduino.
15
16 #include <SPI.h>
17 #include <MFRC522.h>
18 #include <LiquidCrystal.h>
19 #include <SoftwareSerial.h>
20 SoftwareSerial SIM900(7, 8); // gsm module connected here
21 String textForSMS;
22
23 #define SS_PIN 10
24 #define RST_PIN 9
25 MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance.
26
27 // lcd pins
28 #define rs A1
29 #define en A2
30 #define d4 6
31 #define d5 5
32 #define d6 4
33 #define d7 3
34 // initialize the library with the numbers of the interface pins
35 LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
36
37 // parents numbers
38
39 String f1001 = "+923339218213"; // student1 father cell phone number
40 String f1002 = "+923351920959";
41 String f1003 = "+923171956677";
42
7/10
43 void setup() {
44 Serial.begin(9600); // Nodemcu is connected over here
45 randomSeed(analogRead(0));
46 SIM900.begin(9600); // original 19200. while enter 9600 for sim900A
47 SPI.begin(); // Init SPI bus
48 mfrc522.PCD_Init(); // Init MFRC522 card
49 //Serial.println("Scan a MIFARE Classic PICC to demonstrate Value Blocks.");
50
51 // set up the LCD's number of columns and rows:
52 lcd.begin(16, 2);
53 // Print a message to the LCD.
54 lcd.print("AttendanceSystem");
55 delay(3000);
56 lcd.clear();
57 lcd.print("Swip Your Card");
58 delay(1000);
59
60
61 }
62
63 void loop() {
64
65
66 // Prepare key - all keys are set to FFFFFFFFFFFFh at chip delivery from the factory.
67 MFRC522::MIFARE_Key key;
68 for (byte i = 0; i < 6; i++) {
69 key.keyByte[i] = 0xFF;
70 }
71 // Look for new cards
72 if ( ! mfrc522.PICC_IsNewCardPresent()) {
73 return;
74 }
75
76 // Select one of the cards
77 if ( ! mfrc522.PICC_ReadCardSerial()) {
78 return;
79 }
80 // Now a card is selected. The UID and SAK is in mfrc522.uid.
81
82 // Dump UID
83 Serial.print("Card UID:");
84 for (byte i = 0; i < mfrc522.uid.size; i++) {
85 // Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");
86 // Serial.print(mfrc522.uid.uidByte[i], DEC);
87 }
88 Serial.println();
89
90 // Dump PICC type
91 byte piccType = mfrc522.PICC_GetType(mfrc522.uid.sak);
92 // Serial.print("PICC type: ");
93 //Serial.println(mfrc522.PICC_GetTypeName(piccType));
94 if ( piccType != MFRC522::PICC_TYPE_MIFARE_MINI
95 && piccType != MFRC522::PICC_TYPE_MIFARE_1K
96 && piccType != MFRC522::PICC_TYPE_MIFARE_4K) {
97 //Serial.println("This sample only works with MIFARE Classic cards.");
98 return;
8/10
99 }
100 // defining Cards here
101 // student1
102 if( (mfrc522.uid.uidByte[0] == 224) && (mfrc522.uid.uidByte[1] == 154) &&
103 (mfrc522.uid.uidByte[2] == 156) && (mfrc522.uid.uidByte[3] == 124) ) // student1 card
104 {
105 lcd.clear();
106 lcd.print("AttendanceMarked");
107 delay(500);
108 Serial.println("student 1");
109
110 // for gsm
111 sendsms(" Ali is Present", f1001);
112 delay(1000);
113
114 lcd.setCursor(0, 1);
115 lcd.print("message sent");
116 delay(2000);
117
118 lcd.clear();
119 lcd.print("Swip Your Card");
120 delay(1000);
121 }
122
123 // student2
124 if( (mfrc522.uid.uidByte[0] == 189) && (mfrc522.uid.uidByte[1] == 54) &&
125 (mfrc522.uid.uidByte[2] == 235) && (mfrc522.uid.uidByte[3] == 213) ) // student2 card
126 {
127 lcd.clear();
128 lcd.print("AttendanceMarked");
129 delay(500);
130 Serial.println("student 2");
131
132 // for gsm
133 sendsms("James is Present", f1002);
134 delay(1000);
135
136 lcd.setCursor(0, 1);
137 lcd.print("message sent");
138 delay(2000);
139
140 lcd.clear();
141 lcd.print("Swip Your Card");
142 delay(1000);
143 }
144
145
146 else
147 Serial.println("unregistered user");
148
149
150 }
151
152
153 void sendsms(String message, String number)
154 {
9/10
155 String mnumber = "AT + CMGS = \""+number+"\"";
156 SIM900.print("AT+CMGF=1\r");
157 delay(1000);
158 SIM900.println(mnumber); // recipient's mobile number, in international format
159 delay(1000);
160 SIM900.println(message); // message to send
161 delay(1000);
162 SIM900.println((char)26); // End AT command with a ^Z, ASCII code 26
163 delay(1000);
164 SIM900.println();
165 delay(100); // give module time to send SMS
166 // SIM900power();
167 }
168
169
170
10/10