November 3, 2022
Description
Hello world
This is a RFID Based Smart Traffic Signal for Ambulance project. With the help of RFID tag the ambulance when required to pass through signals the signal becomes green by keeping mind all other signals of the junction becomes red.
This helps to pass the signals by ambulance without waiting for green signal like in thickly populated areas / traffic areas.
The program is written in Arduino IDE and the complete program is given below.
Parts to be print for signal (Parts download from thingiverse link https://www.thingiverse.com/thing:3235977/edit )
1xBase
1xCap
1x Led holder
1x Led holder top
Components required
Arduino Uno 1 No
EM18 RFID Reader 1 No
RFID Tag 1No (your required no)
LED Red, Green & Yellow each 1 No
Wire required legnth
Android app download from below link
https://drive.google.com/file/d/1qHocOYj0XdJPhKepeiy6cKMNSKDOO9Ci/view?usp=sharing
Arduino Program
/*RFID Based Smart Traffic Signal for Ambulance
by Aakaar Lab*/
int yellow_led=11,red_led=12,green_led=10,count=0,countp;
char*rfid_id[]={"270021BEBE06","270021BCFE44"};
char* names[]={"Ambulance-1","Ambulance-1"};
int presence[2];
void setup()
{
Serial.begin(9600);
pinMode(yellow_led,OUTPUT);
pinMode(red_led,OUTPUT);
pinMode(green_led,OUTPUT);
}
void loop()
{
int i;
char response[12];
int ch;
delay(200);
signalchange();
if(Serial.available()>0)
{
i=0;
do
{
while(Serial.available()<=0);
response[i]=Serial.read();
Serial.print(response[i]);
i++;
}while(i<12);
response[i]='\0';
if(strcmp(response,rfid_id[0])==0)//User1 rfid received
{
digitalWrite(red_led,LOW);
digitalWrite(green_led,HIGH);
}
else if(strcmp(response,rfid_id[1])==0)//User2 rfid received
{
digitalWrite(red_led,LOW);
digitalWrite(green_led,HIGH);
}
delay(5000);
} if(countp==1)
{count++; }
if(countp==0)
{count--; }
}
void signalchange()
{
if(count==0)
{
digitalWrite(green_led,LOW);
digitalWrite(yellow_led,HIGH);
delay(1000);
digitalWrite(yellow_led,LOW);
digitalWrite(red_led,HIGH);
countp=1; }
else if(count==50)
{ digitalWrite(red_led,LOW);
digitalWrite(yellow_led,HIGH);
delay(1000);
digitalWrite(yellow_led,LOW);
digitalWrite(green_led,HIGH);
countp=0;
}
}
License:
Creative Commons — Attribution
9