Introduction: Prepaid Tollgate System Using RFID ,Arduino and GSM

A simple prepaid tollgate system.using RFID ,GSM and arduino

Step 1: Connection !

Make connections as per this Diagram

Step 2: Modules Used

Step 3: Code !!

/*
* RFID connections - RFID tx ---> rx(3) ardunio
*
* GSM - GSM rx ---> 8 arduino
* GSM tx ---> 7 arduino
*
* MOTOR - C2B --->4 arduino
* C2A---->5 ardunio
*
* RGB LED - A0 --> red
* A1--> green
*buzzer 6
*/
#include

SoftwareSerial rfidSerial(3, 2);
SoftwareSerial SIM900( 7 , 8 );
int aBAL=1000;
int bBAL=1500;
int cBAL=2000;

String a;
const int ledPin = 13;

void setup() {
pinMode (6, OUTPUT);

pinMode (A0, OUTPUT);
pinMode (A1, OUTPUT);
pinMode (A2, OUTPUT);

pinMode (4, OUTPUT);
pinMode (5, OUTPUT);
digitalWrite (4, HIGH);
digitalWrite (5, HIGH);
digitalWrite (6, LOW);
Serial.begin(9600);
pinMode(ledPin, OUTPUT);

SIM900. begin (19200 );
SIM900. print ("AT+CMGF=1\r" );

rfidSerial.begin(9600);
digitalWrite (A2, HIGH);
delay(1000);
digitalWrite (A2, LOW);
Serial.println("WAITNG FOR A VEHICLES ......");
}

void loop() {

digitalWrite (A2, HIGH);
delay(1000);
digitalWrite (A2, LOW);

digitalWrite(A0, HIGH);
while(rfidSerial.available()) {

a= rfidSerial.readString();// read the incoming data as string
rfidSerial.print("Vehicle RFID read ");
rfidSerial.print(a);

delay(1000);
digitalWrite(ledPin, HIGH);
delay(1000);
SIM900. println ( "AT + CMGS = \"8970220880\""); // CHANGE NUMBER TO BE MESSAGED HERE
delay(1000);
//--------------------------------------------______________________________________________
if(a=="03908807\r\n"){
Serial.println("THIS IS A");
aBAL=aBAL-30;
if(aBAL>=30){
//void openGATE();---------------
digitalWrite(A0, LOW);
digitalWrite(A1, HIGH);
digitalWrite (6, HIGH);
delay(1000);


digitalWrite(4, LOW);

delay(750);
digitalWrite(4, HIGH);


delay(2000);
//}

SIM900. print ( "Hello, THANK YOU a, FOR USING MG ROAD TOLL OF Rs.30/- HAS BEEN DEDUCTED YOUR BALANCE IS Rs.");
SIM900.print(aBAL);
}

else{
//void closeGATE();
digitalWrite(A1, LOW);
digitalWrite (6, LOW);
digitalWrite(A0, HIGH);
delay(1000);
digitalWrite(5, LOW);
delay(750);
digitalWrite(5, HIGH);

delay(2000);
//-----------
SIM900. print ( "Hello, THANK YOU a, FOR USING MG ROAD TOLL YOUR BALANCE IS TOO LOW PLEASE RECHARGE! ");

}
delay ( 1000);
SIM900. println (( char ) 26 );
delay ( 1000);
SIM900. println ();
digitalWrite(ledPin, LOW);
}
//--------------------------------------------____________________________________________________________________________________________
else if(a=="13703425\r\n"){
Serial.println("THIS IS B");
bBAL=bBAL-30;
if(bBAL>=30){
//void openGATE();
digitalWrite(A0, LOW);
digitalWrite(A1, HIGH);digitalWrite (6, HIGH);
delay(1000);
digitalWrite(4, LOW);

delay(750);
digitalWrite(4, HIGH);

delay(2000);
//--------------------
SIM900. print ( "Hello, THANK YOU b, FOR USING MG ROAD TOLL OF Rs.30/- HAS BEEN DEDUCTED YOUR BALANCE IS Rs.");
SIM900.print(bBAL);
}

else{//void closeGATE();
digitalWrite(A1, LOW);
digitalWrite(A0, HIGH);
digitalWrite (6, LOW);
delay(1000);
digitalWrite(5, LOW);

delay(750);
digitalWrite(5, HIGH);

delay(2000);

//-------------------

SIM900. print ( "Hello, THANK YOU b, FOR USING MG ROAD TOLL YOUR BALANCE IS TOO LOW PLEASE RECHARGE! ");

}
delay ( 1000);
SIM900. println (( char ) 26 );
delay ( 1000);
SIM900. println ();
digitalWrite(ledPin, LOW);
}
//-------------------------------------------________________________________________________________________________

else if(a=="03908806\r\n"){
Serial.println("THIS IS C");
cBAL=cBAL-30;
if(cBAL>=30){
//void openGATE();
digitalWrite(A0, LOW);
digitalWrite(A1, HIGH); digitalWrite (6, HIGH);
delay(1000);
digitalWrite(4, LOW);

delay(750);
digitalWrite(4, HIGH);

delay(2000);
//---------------
SIM900. print ( "Hello, THANK YOU c, FOR USING MG ROAD TOLL OF Rs.30/- HAS BEEN DEDUCTED YOUR BALANCE IS Rs.");
SIM900.print(cBAL);
}

else{
//void closeGATE();
digitalWrite(A1, LOW);
digitalWrite(A0, HIGH);
digitalWrite (6, LOW);
delay(1000);
digitalWrite(5, LOW);

delay(750);
digitalWrite(5, HIGH);

delay(2000);
//---------------
SIM900. print ( "Hello, THANK YOU c, FOR USING MG ROAD TOLL YOUR BALANCE IS TOO LOW PLEASE RECHARGE! ");

}

//-------------------
}
//-------------------------------------------

else{ // WRONG CARD OR NO CARD
digitalWrite(A0, HIGH);
delay(1000);
digitalWrite(A0, LOW);
delay(2000);




}

delay ( 1000);
SIM900. println (( char ) 26 );
delay ( 1000);
SIM900. println ();
digitalWrite(ledPin, LOW);
delay(5000);
// void closeGATE();
digitalWrite(A1, LOW);
digitalWrite(A0, HIGH); digitalWrite (6, LOW);
delay(1000);
digitalWrite(5, LOW);

delay(750);
digitalWrite(5, HIGH);

delay(2000);
}


}

Comments

author
gowtham96 (author)2017-01-30

is it possible to send the data to the database?,,can i keep all data at database ?

author
JcP26 (author)2016-10-29

Can i use MIFARE Rfid Reader ? if yes what would be its connections ?

author
SolihinO (author)2016-09-27

What type of arduino may be used in this system , following these steps?

author
AXR AMAR (author)SolihinO2016-09-27

I have used arduino pro mini !, you may use any type of arduino.

author
arduinolearner12345 (author)2016-05-18

is it possible to store balance of each customer and view it in excel sheet

About This Instructable

2,361views

15favorites

License:

Bio: Electronics and Automation Engineer, Game designer, Artist! EMAIL: amaraxr@gmail.com
More by AXR AMAR:#DIY# How to grow Bonsai (or any plant) using Internet of things (IOT)#DIY# A Complete Guide to Build Your own ATtiny85 Project PCB with Relay and Interfacing HC05 Bluetooth Module to it Pinguino Project (a PIC microcontroller based Arduino #No Programmer Required)
Add instructable to: