Iot Project
Iot Project
By
Guided by
Prof. Hemil patel
At the current point in time, due to the increasing number of kidnaps and accident cases,
parents always worry about their children, even their children using a school bus for
transportation. Millions of children require school buses to pick up and drop to the school
on an everyday basis. A means of safe transport for these children is one of the main
concerns that need to be taken care of by the school management. Hence, the need for a
reliable management system of the school bus in today’s world has increased to a greater
extent. So we are developing a smart tracking system for school buses, which is an android
based application for providing remote tracking. GPS is used to track the location of the
school bus in real-time. The RFID technology is used to identify the identity of children.
Parents can see the location of the bus, and they will be notified when the children are
getting into a bus or getting down from a bus. The proposed system will result in providing
the security to children travelling via school bus.
Understanding the importance of transport safety, a few years ago in 2014 in India, the
CBSE made it mandatory for all school buses to install GPS systems to ensure the safe
transportation of children to and from schools.
The paper proposed a bus safety system which was designed to control the entering/exiting
of students from the bus. This system does several tasks, including identifying personal
information (Eg. Name) of each student using RFID tag, which will exchange the data with
the RFID reader via radio waves, and displaying each student name into LCD display.
There is provision for three switch inside the bus which has been deployed for Technical ,
medical and other emergency assistance.
1.3 Why All Schools Must Have A GPS Bus Tracking System?
A bus tracking system won’t solve all of your school’s bus-related problems. But the right
solution can ease your school bus-related operations by automating manual processes and
ensure students’ safety and security at the same time. A school bus tracker also goes a long
way in assuring parents that their children are in safe hands.
The following are some issues faced by parents along with students and school
administration while using school buses in traditional ways.
Parents waiting for School Buses:
For children’s safety and security, unwillingly parents have to wait
for hours at the bus stop until the school bus pick up or drop their children.
Function Modules
Our proposed system gives the real time location of bus and Smart bus tracking technology
is advantageous for tracking and monitoring a college bus.
1. Location Tracker
Generally, our system is operated by GPS which is attached with the bus. Firstly,
GPS receives the satellite signals and then the position co-ordinates with latitude
and longitude are determined by it. The location is determined with the help of GPS
and transmission mechanism. After receiving the data, the tracking data can be
transmitted using any wireless communications systems. The GPS module will be
connected to micro controller reader and the real time of vehicles will see the
location continent. Node MCU will receive valid data from GPS module and upload
it on firebase with the help of Wi-Fi. Every 15 to 20 second data of bus will update.
This means that no events is generated, the Bus will be sent to the Server event 30
second by sending the GPS location to NodeMCU which means the last location of
the Bus will allocate be saved on the Server. The mobile application will retrieve
and the show the exact location of bus
2. Student Identification
Information of a subject using radio waves. This information consists of unique
digit number which differentiates various objects. A RFID system is made up of
two different parts viz. RFID tag and RFID reader. There is a microchip antenna
inside tag; This chip consists of useful data in different forms. A study has showed
that, the performance of reader decreases rapidly with increase in a distance.
Children carries a unique RFID card. This RFID card is embedded on his own
smartcard. The RFID tag reader is installed near the bus entrance. It will read all the
passive tags that the students will swipe while entering/leaving the bus. As soon as
a child swipes the card; the reader will identify him based on the unique
identification number associated with the RFID tag. The LCD unit will display the
unique identification number on the display along with the entry timings on the
LCD display. Now the work of GPS module comes into picture. The embedded
GPS module will help to locate the bus by providing the longitude and latitude
coordinates of the location and sends this information to the microcontroller. This
information is then passed to the microcontroller which conveys the same to the
ESP8266 module. The Wi-Fi module will send the information of student and GPS
location on the registered parent’s mobile number. This way parents will be assured
of their kids boarding and leaving the bus and the driver of the bus will also get the
attendance of the students.
3. Emergency switches
There are 3 switches in the Bus for different kind of emergency situation like
technical, medical or police emergency. Switches are connected to the A7 analog
pin of micro controller. When we press switches, pin status will turned 0 & if we
leave them the status is 1. If switch value is less than 770 than the request should
be considered. if value is less than 10 than it should be medical emergency, if value
is between 485 to 550 than it should be technical emergency and if value is between
650 to 700 than it should be police emergency. If any emergency situation will
arrive drive can inform school administration with the help of these 3 switches.
User Modules
The IC is inserted in RFID Tag, when the RFID tag is moved closer to the RFID
reader. The electromagnetic field will generated.
Data will receive by micro controller and students ID number will appear on LCD
display and that information send to node MCU with the help of serial
communication.
Once data will receive by NodeMCU, and then NodeMCU will give it validation
and if the data will correct than and than only it will take data from GPS and attach
them with string.upload them on server which include student’s name, pick up and
drop location and than these information displayed on application.
1) RFID reader:
The RFID reader has a radio transmitter and receiver within. The
reader transmits radio frequency signals incessantly upon powering. It is also called
as an interrogator. When an RFID tag is placed within the range area of a reader, it
energizes the tag through electromagnetic induction and collects the data from it.
Data is stored in the RFID tag electronically. Tags can store only a few kilo bytes
of data. This data is retrieved by the reader using electromagnetic waves.
2) RFID tag:
The image given below is that of an RFID tag (smart card shaped tag).
RFID tags are available in different types of shapes and sizes. The Tag contains an
IC for storing the information, an antenna for transmitting and receiving, and also a
modulator. Tags are small in size and they can hold only few bits of data. The
operation of an reader is very much similar to barcode scanning method which uses
Universal Product Codes (UPC) codes. In some applications, RFID Tag and Reader
has advantages over the barcode system.
2.Active tag:
While active tags have a power source for their internal circuitries, And for
sending the response to the reader also,it uses its own power supply.
Each pin on the Nano board comes with a specific function associated with it.
We can see the analog pins that can be used as an analog to digital converter where
A4 and A5 pins can also be used for I2C communication. Similarly, there are 14
digital pins, out of which 6 pins are used for generating PWM.
Vin: It is input power supply voltage to the board when using an external power
source of 7 to 12 V.
5V: It is a regulated power supply voltage of the board that is used to power the
controller and other components placed on the board.
3.3V: This is a minimum voltage generated by the voltage regulator on the board.
GND: These are the ground pins on the board. There are multiple ground pins on
the board that can be interfaced accordingly when more than one ground pin is
required.
Analog Pins: There are 8 analog pins on the board marked as A0 - A7. These
pins are used to measure the analog voltage ranging between 0 to 5V.
Rx, Tx: These pins are used for serial communication where Tx represents the
transmission of data while Rx represents the data receiver.
3.1.4 GPS
GPS, which stands for Global Positioning System. It is a radio navigation system that
allows land, sea, and airborne users to determine their exact location, velocity, and time 24
hours a day. It works in all weather conditions, anywhere in the world.
The Global Positioning System (GPS) has been developed in order to allow accurate
determination of geographical locations by military and civil users. It is based on the use
of satellites in Earth orbit that transmit information which allow to measure the distance
between the satellites and the user. If the signals from three or more satellites are received,
simple triangulation will make it possible to determine unambiguously the location of the
user.
The three main components are the GPS satellites, the GPS receivers, and the complex
computer software needed to decode the signals and compute the geographical position of
the user.
Figure1.14: GPS
This is an LM2596 DC-DC buck converter step-down power module with the high-
precision potentiometer, capable of driving a load up to 3A with high efficiency, which can
work with Freeduino UNO, other mainboards, and basic modules. When the output current
keeps greater than 2.5A (or output power greater than 10W).
This device is internally compensated to minimize the number of external components to
simplify the power supply design. Since LM2596 converter is a switch-mode power supply,
its efficiency is significantly higher in comparison with popular three-terminal linear
regulators, especially with higher input voltage. The LM2596 operates at a switching
frequency of 150 kHz thus allowing smaller sized filter components than what would be
needed with lower frequency switching regulators.
3.1.6.2 Features
Input voltage:3-40V
Output voltage:1.5-35V(Adjustable)
Output current: Rated current is 2A, maximum 3A(Additional heatsink is required)
Module Properties: non-isolated constant voltage module
Rectification: non-synchronous rectification
Short circuit protection: current limiting, since the recovery
This security system endeavours the safety transportation for the school children daily
outing. IN this project, bus safety system for school children has been developed. The
proposed system is designed to track the school bus in real-time with the help of GPS. The
system uses RFID for detecting the child whether boards or leaves the bus. This paper
showed how IoT technologies can be used to make the school transportation system
smarter. A smartphone application can be downloaded by the parents and school
administration which will continuously show the location of the bus and also provide
emergency notification in school administration application. The system provides security
to students effectively and also is more comfortable for parents and institutes.
Appendix
Coding
Arduino Nano
#include <LiquidCrystal.h>
#include <SoftwareSerial.h>
#define swPin A7
#define espTx 2
#define espRx 3
#define rfidPin 13
void setup() {
Serial.begin(9600);
esp.begin(9600);
lcd.begin(16, 2);
lcd.print("SCL BUS PROJECT");
pinMode(rfidPin, INPUT_PULLUP);
}
void loop() {
Serial.flush();
rfidString = "";
String data;
if (Serial.available() > 0) {
delay(200);
rfidString = "";
testCard();
Serial.println(idValue); Serial.flush();
if (idValue > 0) {
sendStudent();
}
delay(2000);
lcd.clear();
lcd.print("SCL BUS PROJECT");
}
esp.flush();
delay(1);
esp.println(espString);
Serial.println(espString);
lcd.clear();
lcd.print(espString);
}
delay(200);
}
void testCard() {
idValue = 0;
if (rfidString.substring(0, 12) == "1800016E4136" && oldRfid != 1) {
idValue = 1; oldRfid = 1;
if (student[1] == '0') {
student[1] = 'U';
}
else {
if (student[1] == 'U') {
student[1] = 'D';
}
else {
if (student[1] == 'D') {
idValue = 0;
}
}
}
}
else {
if (rfidString.substring(0, 12) == "5300B8BFB5E1" && oldRfid != 2) {
idValue = 2; oldRfid = 2;
if (student[2] == '0') {
student[2] = 'U';
}
else {
if (student[2] == 'U') {
student[2] = 'D';
}
else {
if (student[2] == 'D') {
idValue = 0;
}
}
}
}
else {
if (rfidString.substring(0, 12) == "5300B8C01D36" && oldRfid != 3) {
idValue = 3; oldRfid = 3;
if (student[3] == '0') {
student[3] = 'U';
}
else {
if (student[3] == 'U') {
student[3] = 'D';
}
else {
if (student[3] == 'D') {
idValue = 0;
}
}
}
}
else {
if (rfidString.substring(0, 12) == "5300B8C06E45" && oldRfid != 4) {
idValue = 4; oldRfid = 4;
if (student[4] == '0') {
student[4] = 'U';
}
else {
if (student[4] == 'U') {
student[4] = 'D';
}
else {
if (student[4] == 'D') {
idValue = 0;
}
}
}
}
}
}
}
}
void sendStudent() {
espString = "Student," ;
espString += idValue ;
espString += "," ;
if (student[idValue] == 'U') {
espString += "UP";
}
if (student[idValue] == 'D') {
espString += "DOWN"; //espString += student[idValue] ;
}
espString += "," ;
esp.flush();
delay(1);
esp.println(espString);
Serial.println(espString);
lcd.clear();
lcd.print("STUDENT ");
lcd.print(idValue); lcd.setCursor(0, 1);
if (student[idValue] == 'U') {
lcd.print("UP");
}
if (student[idValue] == 'D') {
lcd.print("DOWN");
}
}
NodeMCU ESP8266
#include <TinyGPS.h>
#include <SoftwareSerial.h>
#include <ESP8266WiFi.h>
#include <FirebaseESP8266.h>
TinyGPS gps ;
SoftwareSerial ss(13, 15) ; // gps
SoftwareSerial nano(5, 4) ; // nano
void setup() {
pinMode(led, OUTPUT); pinMode(netLed, OUTPUT);
Serial.begin(115200); ss.begin(9600); nano.begin(9600);
digitalWrite(led, LOW);
setupWifi();
Serial.println("G.P.S ?");
while (gpsStatus == false) {
getGps(); delay(1000);
digitalWrite(led, !digitalRead(led));
}
digitalWrite(led, HIGH);
updateRequest();
}
void loop() {
count++;
if (WiFi.status() == WL_CONNECTED) {
digitalWrite(netLed, !digitalRead(netLed));
}
else {
digitalWrite(netLed, HIGH);
}
if (nano.available() > 0) {
delay(200);
if (nano.find("Student")) {
studentId = nano.read() ;
studentStatus = nano.readString();
Serial.println(studentId);
Serial.println(studentStatus);
updateServer();
studentId = 0;
studentStatus = "";
nano.flush();
}
if (nano.find("REQUEST")) {
requestType = nano.readString();
Serial.println(requestType);
digitalWrite(led, LOW);
updateRequest();
nano.flush();
digitalWrite(led, HIGH);
}
}
delay(500);
}
void getGps(){
bool newData = false; // For one second we parse GPS data and report some key values
for (unsigned long start = millis(); millis() - start < 1000;){
while (ss.available()){
char c = ss.read();
if (gps.encode(c)) // Did a new valid sentence come in?
newData = true;
}
}
if (newData){
float flat, flon;
unsigned long age;
gps.f_get_position(&flat, &flon, &age);
lati = String(flat,6);
lon = String(flon,6);
sat = String(gps.satellites());
spd = String(gps.f_speed_knots(), 2);
if(sat.toInt() >3){
gpsStatus = true;
digitalWrite(led, LOW);
}else
digitalWrite(led, HIGH);
}
sendToSerial();
}
void updateBus(){
Firebase.setString(fbdo,"/Latitude", lati);
Firebase.setString(fbdo, "/Longitude", lon);
Firebase.setString(fbdo, "/Speed", spd);
Firebase.setString(fbdo, "/Sat", sat);
}
void updateRequest(){
Firebase.setString(fbdo,"/Latitude", lati);
Firebase.setString(fbdo, "/Longitude", lon);
Firebase.setString(fbdo, "/Speed", spd);
Firebase.setString(fbdo, "/Sat", sat);
Firebase.setString(fbdo, "/Req", requestType);
}
void updateSt1Up(){
Firebase.setString(fbdo,"/St1/Up/Latitude", lati);
Firebase.setString(fbdo,"/St1/Up/Longitude", lon);
}
void updateSt1Dn(){
Firebase.setString(fbdo,"/St1/Down/Latitude", lati);
Firebase.setString(fbdo,"/St1/Down/Longitude", lon);
}
void updateSt2Up(){
Firebase.setString(fbdo,"/St2/Up/Latitude", lati);
Firebase.setString(fbdo,"/St2/Up/Longitude", lon);
}
void updateSt2Dn(){
Firebase.setString(fbdo,"/St2/Down/Latitude", lati);
Firebase.setString(fbdo,"/St2/Down/Longitude", lon);
}
void updateSt3Up(){
Firebase.setString(fbdo,"/St3/Up/Latitude", lati);
Firebase.setString(fbdo,"/St3/Up/Longitude", lon);
}
void updateSt3Dn(){
Firebase.setString(fbdo,"/St3/Down/Latitude", lati);
Firebase.setString(fbdo,"/St3/Down/Longitude", lon);
}
void updateSt4Up(){
Firebase.setString(fbdo,"/St4/Up/Latitude", lati);
Firebase.setString(fbdo,"/St4/Up/Longitude", lon);
}
void updateSt4Dn(){
Firebase.setString(fbdo,"/St4/Down/Latitude", lati);
Firebase.setString(fbdo,"/St4/Down/Longitude", lon);
}
void sendToSerial(){
Serial.print("\n\nLAT "); Serial.println(lati);
Serial.print("LON ");Serial.println(lon);
Serial.print("SAT ");Serial.println(sat);
Serial.print("SPEED ");Serial.println(spd);
}
void setupWifi(){
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
Serial.print("Connecting to Wi-Fi");
while (WiFi.status() != WL_CONNECTED){
Serial.print("."); delay(300);
}
Serial.println();
Serial.print("Connected with IP: ");
Serial.println(WiFi.localIP());
Serial.println();
Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);
Firebase.reconnectWiFi(true);
}
void updateServer(){
if(studentId == 1){
if(studentStatus == "UP"){updateSt1Up();}
if(studentStatus == "DOWN"){updateSt1Dn();}
}
if(studentId == 2){
if(studentStatus == "UP"){updateSt2Up();}
if(studentStatus == "DOWN"){updateSt2Dn();}
}
if(studentId == 3){
if(studentStatus == "UP"){updateSt3Up();}
if(studentStatus == "DOWN"){updateSt3Dn();}
}
if(studentId == 4){
if(studentStatus == "UP"){updateSt4Up();}
if(studentStatus == "DOWN"){updateSt4Dn();}
}
}