The Internet of Things (IoT) refers to a network of internet-connected things able to collect and exchange data and send it to the internet. There are so many examples of the Internet of Things like desktop and laptop computers, smart phones and tablets to a diverse range of devices and everyday things that utilize embedded technology to communicate and interact with the external environment through the Internet. Examples of objects that can fall into the scope of Internet of Things include connected security systems, thermostats, cars, bus, electronic appliances, lights in household and commercial environments, alarm clocks, speaker systems and many more. There are more than 12 billion devices that can currently connect to the Internet. The researchers at IDC estimate that by 2020 there will be 26 times more connected things than people .
Public bus management system (also known as public transportation, public transit, or mass transit) is a transport of passengers by group travel systems available for use by the general public, typically managed on a schedule, operated on established routes, and that charge a posted fee for each trip. Examples of public transport include city buses, trolleybuses, trams (or light rail) and passenger trains, rapid transit (metro/subway/underground, etc.) and ferries. Most public transport systems run along fixed routes with set embarkation/disembarkation points to a prearranged timetable, with the most frequent services running to a headway (e.g.: “every 15 minutes” as opposed to being scheduled for any specific time of the day .
Public bus is the most widely used public transportation system in Dhaka city nowadays. Passengers face a major problem due to the lack of proper bus management system by the authorities of the public bus. Passengers as well as conductor face a tough time during the peak hours where ticket acquisition becomes the major issue. In order to overcome these difficulties faced by the passengers, authors create a smart bus management system using IoT that can ensure efficient traveling during peak and normal hours. The proposed management system includes technology such as ESP32 for integrated Wi-Fi and dual-mode Bluetooth, IR sensors for passenger standing status and seat availability, Firebase for database management that controls and stores the overall data that is being generated, and Kodular for android application.
The owner can monitor the bus and user (passenger) can know the nearest location, available seat and standing status through mobile application. GPS (Global Positioning System) is used to track the current location and IR-sensor is used for detect the passenger.
The women harassment is increasing day by day in Bangladesh and most of them are harassed in public transport (bus). A study by development organization BRAC has revealed on Women harassment that around 94% of women using public transport in Bangladesh and most of them have sexually harassed in verbal, physical, or other forms due to insecure implementation of laws, overcrowding and lack of monitoring. The authors use panic alert button in every seat of the public bus to reduce this harassment there will be also a condition to press the button .
The public bus authorities in Dhaka city can use the proposed device for their better services, like ATCL, 6 number, Dipon, 15 number, 7 number, 13 number, Sekhar Paribahan, Trans silva, Salsabil, Anabil super, Winner etc. The owners of public bus will use IoT device for their better performance and to ensure a secured transportation system.
2. Literature Review
Bus is the cheapest medium of transport in Bangladesh and Dhaka being the most densely populated city. There is no alternative to bus for public transportation. So, people must have to use public bus, as private bus is not sufficient in proportion to the number of passengers. Now-a-days the public bus management authorities give very poor services to the passenger in Dhaka city. They have to face a number of problems like: long waiting period, traffic jam, increased amount of fare, over-crowd, unavailability of seats, women harassment, rude behavior of the bus staff members, delayed boarding time, discomfort inside the bus, transport inadequacy during peak hour and many more. Besides all these factors, standing and hanging on the door, unexpected breakdown for fitness problems, unavailability of information of bus services, lack of facilities in bus stoppage areas add more trouble to the passengers of local buses. This problem can be solved by a smart IoT device.
In  Sarah Aimi Saad et al. in 2018, the authors has proposed a Real-time on-Campus Public Transportation Monitoring System that is Wi-Fi based public transportation monitoring system device by IoT. Authors use ESP8266 Wi-Fi module and establish Wi-Fi connection to communicate with cloud server. The ESP8266 Wi-Fi module has implemented by TCP/IP protocol for the sake of communication between bus and web application.
The reviewed project work used ESP8266 as a Wi-Fi module which pin connection is limited whereas the proposed work use ESP32 which has enough pin connection and also high energy Bluetooth connection and also use GPS for controlling and monitoring bus.
In  Lin Kang et al. in 2016 have proposed A Public Transport Bus as a Flexible physical Mobile Smart Environment Sensing Platform for the IoT. The authors proposed the architecture for Mobile Enterprise Sensor Bus (M-ESB) service to monitor the urban physical environment and road conditions. Authors use Opportunistic Mobile Sensor Network (OMSN) and GSM for monitoring air quality in urban physical environment. GPS and GIS used for monitoring road and traffic condition.
The reviewed project is just for track the environment and road condition of the vehicles, but in authors proposed IoT based device is for monitor the current location, available seat of the vehicles and most important emergency alert system for reduce women harassment.
In  Dr. I. Lakshmi in 2017 has proposed a Smart Local Transport Tracking System using IoT based technique that is designed to display the real time location of the bus. The proposed system gets GPS data of the location and sends this information to control section. The display shows the current location and arrival time at every bus stop. The same information sends to the android app, which gives exact location on the Google map.
This reviewed project work is only for monitoring the vehicles current location and arrival time but in authors proposed system is for showing the seat availability, current location and also add an emergency alert option for the passengers (women) safety.
In  Ashour, M. Zorkany and M. Shiple in 2015 had proposed a Design and Implementation of Transportation management system. This proposed system is designed to interconnect public transport vehicles and bus stations to “central room” to monitor the vehicles and traffic status. Monitoring buses based on GPS and GPRS applications. In this paper, authors proposed a modified technique to predict bus arrival time.
This reviewed project work is to monitor the vehicles and traffic status. On the other hand the proposed project work is for monitor the available seat and current location of the bus and also to reduce the women harassment on public transport.
In  Manini Kumbhar et al. in 2016 have proposed a Real Time Web Based Bus Tracking System that is operated by GPS which is attached with the bus. The user side module and admin module are implemented using visual studio 13 & c# with MYSQL as a database for storing the necessary details. Author said that it is not secured and open source also slightly costly.
In proposed project system authors use GPS for real time information, Firebase for storing the data and Kodular as an app inventor.
In  Süleyman Eken and Ahmet Sayar in 2014 proposed a Smart Bus Tracking System Based on Location Aware Services and QR Codes. Authors presented a smart bus tracking system. It is based on GPS, GSM, QR coding and Google’s map technologies. The proposed system, basically tracks the buses, estimates their arrival times at specific bus stops and informs the users through emails and SMSs. The system prevents passengers unnecessarily to wait at bus stops and enables them to use their time more efficiently.
In authors proposed system is for monitor the available seat, close and current location of the bus and passengers get the information through mobile application.
In  Feng Li, Yuan et al. in 2011 have proposed A Model for Public Bus Arrival Time Prediction Based on Traffic information management System. Authors use a statistical approach that was present to forecast the arrival time at each stop for public bus. In the model author considered all of evaluated factors, such as departure time, driver characteristics, dwell time, intersections, traffic conditions etc. A web application prototype was built to verify the practicability and efficiency of the approach. The approach has been proved relatively accurate and efficient by experiments of the prototype. On the other hand the authors proposed project work is for monitor the available seat and current location of the bus.
In  Rajesh Kannan Megalingam et al. in 2014 have proposed a Smart Public Buses Information System. The authors prefer Arduino Uno R3 board because it has high transfer rate and more memory. The Arduino can work at a nominal voltage of 5 V. The system can track the location of the buses and also the arrival time and the delay time of the particular bus at the bus terminal. In the proposed project work authors use Arduino IDE and ESP32 microcontroller because it has enough pin connection and high energy Bluetooth capacity.
The proposed IoT based project work has completed by following some strategies, which are given below in Figure 1.
3.2. Description of Methodology
Full project work has been divided by 7 steps. The explanation is given below:
Project Planning: Project planning is a procedural step in project management, where required documentation is created to ensure successful project completion. Documentation includes all actions required to define, prepare, integrate and coordinate additional plans. The project plan clearly defines how the project is executed, monitored, controlled and closed. In this phase, Authors have planned in which area authors will work.
Firstly, authors found some regular problem in Dhaka city and found the local bus management system problem. Then authors discuss about the problem with the bus owner and also the passenger. Authors also thought about the women harassments in public bus and to reduce the problem. Finally, authors decide to solve the problem in some smart way.
Gather Information: Gathering information and knowledge allows alternative options to a problem to be identified and helps ensure that relevant options are considered in light of the available facts. Once we know the focus of our project there are lots of tools and strategies to help us find and collect the information about public bus. In this step, we have searched and gather knowledge from other paper, books internet and related works on public bus. We have also collected the idea that how we can construct our project and how we can develop a better version existing public bus project. Besides, authors have collected data about the limitations and drawbacks of existing system of public bus.
Requirement Analysis: Requirement analysis is the process of developing good specification for any hardware or software development of project. In this stage required hardware analysis was learned to build the project.
Figure 1. Diagram of proposed methodology.
Learn Require Skill: Learn require skill is a teaching method in which students gain knowledge and skills by working for an extended period of time to investigate and respond to an authentic, engaging, and complex question, problem, or challenge. To completing the project, we had to know about c programming language, Aurdino IDE language and hardware connection.
Design and Development: Design is the process of defining the components, modules, interfaces, and data for a system to satisfy specified requirements. Development is the process of creating or altering systems, along with the processes, practices, models, and methodologies used to develop them. Authors developed a device which has a sensor and owner can monitoring the public bus through mobile application that can alert waiting passengers with real time public bus information and user (passenger) can know the nearest location, available seat and standing status by mobile application and also stored data in to cloud storage by Firebase. That data will show into an android application.
Testing and Debugging: Testing is a process of finding bugs or errors in a software product that is done manually by tester or can be automated. Debugging is a process of fixing the bugs found in testing phase. We have tested our device in public buses in Dhaka city. We got some results and it works well.
Maintenance: Maintenance is the modification of a product after delivery to correct faults, to improve performance or other attributes. A common perception of maintenance is that it merely involves fixing defects. In our project there are some issues which come up in the public bus owner environment. To fix those issues patches are released. Also, to enhance the product some better versions are released. Maintenance is done to deliver these changes in the public bus owner environment.
4. Design and Development
4.1. Block Diagram
Block diagram of proposed system is shown in Figure 2.
Figure 2. Block diagram of proposed system.
Description of Block Diagram
In Figure 2, there are three main parts in the block diagram of a public bus management system: sensor interface, microcontroller and hardware. In the sensor interface section, there is one sensor: IR sensor. The IR sensor is connected with ESP32 microcontroller. Hardware section consists of anI2c LCD, a button, a buzzer, resistor and transistor. The hardware components are connected to the microcontroller as output. Data can be stored in cloud server by using a router gateway. The passengers (user) can see the nearest location, available seat, standing status and owner can monitoring the bus through mobile application.
4.2. Flow Chart
A flowchart is a diagram of the sequence of movements, workflow or actions of people or things involved in a complex system or activity. The following flowchart is created for the diagrammatic representation of the authors proposed IoT based public bus management systems algorithm. The flowchart shows the steps as boxes of various types and their order by connecting the boxes with arrows. The flowchart of the proposed system is shown in Figure 3(a) and Figure 3(b).
Description of the flow chart
Figure 3(a) and Figure 3(b) shows the flow chart of the proposed system. There are two parts of the flow chart diagram, the IoT device part and the mobile application part. First of all, authors turned on the device. After turning on the device, it checked that whether the device is connected correctly or not. If the device connection is not correct then it went to the turn on point. Otherwise the device started to check the status of IR sensors one by one. The authors reset IR sensors, if there is any problem to the sensors. Otherwise the sensors connected with the device and started to read signal. If the signal is low then it counted the object one by one and displayed the result and stored the data. Otherwise, the sensors again check the signal.
On the other hand, the device searched Wi-Fi connection. If the device could not found the Wi-Fi connection, it again went to the access point and searched the Wi-Fi connection. After found the connection it connected with the android apps. Then the Users, Driver and Owner can login to use the apps. The user must complete the registration to use the apps as a new user. After verification, the owner could see the checkpoint, available seat, current location of the bus, emergency alert and also the standing status. The normal user could check their selected buses seat availability and current location. The user entered into the bus if the bus had any available seat otherwise check the next bus. The user pressed the button if any women faced any type of harassment in the bus. Then the buzzer created a sound on the bus and sent notification to the owner and also to the nearest police station. On the other hand, the driver could check the available seat through mobile app. The driver waited for the passengers if there is any available seat on the bus, otherwise started the bus.
Figure 3. (a) Working flow diagram of the proposed system (Part-1); (b) Working flow diagram of the proposed system (Part-2).
4.3. Circuit Design
A circuit design is a graphical representation of an electrical circuits pin connections. A pictorial circuit diagram uses simple images of elements. The following circuit diagram is the pictorial representations and interconnections of the authors proposed systems. The circuit diagram of the device is shown in Figure 4.
Description of circuit design
Figure 4 shows the circuit diagram of the device. The ESP32 microcontroller has 30 pins. An LCD is connected with the microcontroller. The SCL and SDA pin of the LCD 5v system are connected with ESP32 through data pins D22 and D21 respectively. VCC of LCD is connected with the 3.3v pin of ESP32 and GND is connected with the GND of ESP32. The resistor R1 (10k) is used for pull down and connected with the GND of ESP32 and LCD through D15 pin. The buzzer is use for the emergency alert system. The negative pole of the buzzer is connected to the ground of ESP32 and LCD. The positive pole of the buzzer is connected to the D19 pin of ESP32. The resistor R2 (1k) is use for the buzzer control. For the buzzer a T1 2N2222 amplifier is used to amplify the sound. The IR obstacle sensors are used in the system which is connected to ESP32. The IR sensors are uses for the object detection. The sensor U2 is connected through D34, U3 through D35, U4 through D32, U5 through D33, U6 through D25, U7 through TX2, U8 through RX2, U9 through D4, U10 through D5, U11 through D18 pin. All the sensors VCC and GND are connected with the VCC and GND of LCD through ESP32.
5. Result and Discussion
5.1. Device Prototype
The device prototype of the proposed system is shown in Figure 5.
Figure 4. Circuit design of IoT device.
Figure 5. Device prototype of the proposed system.
Description of the device prototype
In Figure 5 the authors showed the device prototype of the proposed system. The proposed IoT device has been set with a public bus. The device has been connected with Wi-Fi after installation. If the password of Wi-Fi is saved from earlier, the device will automatically be connected to the Wi-Fi. Otherwise, it will automatically go to the Access Point mode and broadcast the Wi-Fi by itself; where the users can connect and save the password of the Wi-Fi.
The proposed device will automatically start to upload the data to the cloud, whenever it will be connected to the Wi-Fi network.
The Device has a microcontroller (ESP32), where the IR sensors obstacle is connected. The IR sensors obstacle helps to detect whether there is any object or not. There is also an I2c LCD display to show the seat availability. The proposed device will send data to the cloud and the users can check the information of the bus through the application.
5.2. Real Time Information Based on IoT Device with User, Driver and Owner
Description of data view interface
From Figures 6(a)-(c), we can see the data view interface from where we can get the following information:
· The passenger can select their bus company name which they need and can see the nearest location and available seat in passengers login page. The passengers can also get an Emergency Call facility through the app with their selected number during User Registration.
· Driver can monitor their Current location, available seat and also check if there is any emergency or not in the bus from driver login page.
· Owner can monitor the bus location, fill up seat, checkpoint reached and emergency alert in owner login page.
5.3. Notification from IoT Device
Figure 6. (a) Passenger login; (b) Driver login; (c) Owner login.
Figure 7. (a) Emergency alert for police station; (b) Emergency alert for bus administration.
· When any user press the panic alert button then the admin get an emergency notification and sound. Then the admin can check all the information of the bus.
· The emergency alert notifications also send to the nearest police station when any passenger presses the emergency button.
The authors know that most of the work is done only for locating and monitoring vehicles based on the analysis of the existing public bus management system. The authors developed and implemented a public bus management system with the help of IoT to provide better service in public bus management system. The authors have used IR sensor which detects the object and sends the information to the mobile application. It is possible to get the real time information of the bus such as bus location and seat availability with the help of GPS. Women harassment in public bus has become a common issue nowadays. The authors used panic alert button in every seat of the public bus and an emergency call facility in application to reduce women harassment. The emergency notifications also send to the nearest police station whenever any passenger presses the button. The proposed bus management system is connected with an application which can be used both by the passengers and the bus owners. The owner can monitor the bus with the help of the application and the passengers can get the real time information through this application.