/smart-bus-stop

IoT project aimed to improve public transport; enabling fast, easy and accessible mobility.

Primary LanguagePythonMIT LicenseMIT

🚏 IoT-powered smart bus stop

To improve city mobility, enabling faster, easier and safer public transport for the user and at the same time, lower management costs for the administrators.

📝 Abstract

This project was developed as the final project for the Master's Degree in the CS IoT course. Its main focus is to improve public transportation, particularly city buses. The aim is to create a smart bus stop that enables easier access to the service and enhances it through a network of such stations.

In our vision, each smart bus stop will be equipped with a digital kiosk/totem device and a button board. A solar panel may also be provided to the station to make it self-sufficient during sunny hours.

The totem will allow people to see the real-time locations of public services, along with the estimated transit times through various stations. It will also make it possible to purchase tickets on the spot. An NFC/RFID reader will make authentication possible with smartphones and other physical devices (provided, for example, to the elderly who do not own modern mobiles).

A button will be provided for people with disabilities to alert the bus driver to give help or attention.

Once the network of smart stops is established, it will be possible to perform statistical analysis and forecasting on the use of a certain line, allowing better allocation of resources (such as adding or deleting a bus, "dynamic" lines, etc). The project aims to reduce maintenance costs for public administrations. An ideal solution uses an AI-powered camera to count people waiting at the stops and a server that checks if the upcoming bus's maximum capacity would be exceeded, calling for an additional bus.

The project was developed on Arduino and Esp32 dev-board. Although all the parts work smoothly, some components have been simplified (e.g., omitting some security best practices) since more realistic solutions would have been too time-consuming.

Authors: Giacomo Salici @jacksalici and Francesco Marcucci @MRTCc, University of Modena and Reggio Emilia

🏗 Actors and Architecture

The main actors of the project are the bus stop, the bus stop help button, the bus itself and the main server.

Actor Component Link
Main Server (Overview) Flask Server Details and code
Prophet forecasting Details and code
Bus Stop (Overview) Arduino Details and code
Bus Stop Help button (Overview) Esp32 Details and code
Bus Client (Overview) GPS Tracker Details and code

System Design and Architecture - Created with Miro

Main server 🧠

The main server manages a Flask server [code] that offers frontends to the stops. It is subscribed to all MQTT topics and it couples the information of each bus and its next stop. All the details, along with the seat bookings are stored in an SQLite database that represents a digital twin of public transport.

The server receives via MQTT the location of each bus and fetches using Open Route Service the ETA to its next station and sends all the data to it. It receives also the number of seats busy.

From each station, moreover, the server receives the number of people awaiting there and if someone requests help using the specific button. The request is forwarded via MQTT to the upcoming bus.

The count of the people in the crowd is presented to the system administrators on a specific page. Bus lines that can't manage all the people are highlighted.

For the developers, the server has an API endpoint that let to fetch real-time data from the stops such as the number of people there.

Lastly, we develop with Prophet a forecasting model [code] to predict the number of people waiting in the stops in a future moment based on the past recorded data. Since it is just a demo project the recorded data was generated using a script, so the model is not accurate.

Bus Stop 🚏

Each bus stop has a kiosk loaded on the server offered front-end. Users can use a real-time-updated map to see the location of the bus, along with the actual number of busy seats on that bus.

Users can book a seat by logging in using an NFC reader. An Arduino board [code] sends to the serial port the UID of the NFC tag (or smartphone). It is read on the front-end using the experimental web serial port API. Since the project is just a demo we used the UID as the authentication key ignoring that it would be a severe vulnerability in an actual realization.

Bus Stop Help Button 🕹

Each stop is provided with an ESP32 board that let people toggle a button to call for help [code]. The board is separated from the Arduino NFC reader for the sake of modularity and the decoupling principle.

The same ESP32 board read the value of a potentiometer that simulates the presence of an AI-powered camera that counts people.

Bus Client 🚍

Each bus is tracked with a GPS sensor. For the demo, we created a smartphone app [code] that sends the location and that allows the user to set the number of busy seats and the next stop.

📺 Presentations

During the final presentation, we were asked to present a commercial/marketing-oriented presentation and a more technical one. Both are written in Italian.

💡 Acknowledgement

Other useful links: