Skip to content

Real-time AMTS bus tracker with Arduino-powered seat monitoring. Live seat availability + complete route info in one smart web app.

License

Notifications You must be signed in to change notification settings

hetgardi/SmartBus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

AMTS Bus Tracker with Real-Time Seat Monitoring

A comprehensive web application for the Ahmedabad Municipal Transport Service (AMTS) that combines bus route information with real-time seat occupancy monitoring using Arduino sensors. This system provides commuters with detailed bus schedules, routes, fares, and live seat availability data.

๐ŸšŒ Features

Bus Information System

  • Detailed Route Information: Complete bus routes with stops and timings
  • Real-time Schedules: Current bus timings and frequency
  • Fare Calculator: Accurate fare information for different route segments
  • Contact Information: AMTS office details and support

Real-Time Seat Monitoring

  • Live Seat Status: Real-time occupancy monitoring using ultrasonic sensors
  • Visual Seat Map: Interactive bus seat layout with availability indicators
  • Arduino Integration: Hardware sensor integration for accurate seat detection
  • Simulation Mode: Fallback mode when hardware is not connected

Technical Features

  • Responsive Design: Works seamlessly on all devices
  • RESTful API: Clean backend API for seat status
  • Real-time Updates: Live data refreshing every second
  • Error Handling: Graceful fallback to simulation mode

๐Ÿ› ๏ธ Technologies Used

  • Frontend: React.js, Bootstrap 5, CSS3
  • Backend: Node.js, Express.js
  • Hardware: Arduino Uno, Ultrasonic Sensor (HC-SR04)
  • Communication: Serial Port Communication, REST API
  • Tools: CORS for cross-origin requests

๐Ÿ“‹ Prerequisites

  • Node.js (v14 or higher)
  • npm (v6 or higher)
  • Arduino IDE (for hardware setup)
  • Arduino Uno with ultrasonic sensor (optional - has simulation mode)

๐Ÿš€ Installation & Setup

1. Clone the Repository

git clone https://github.com/hetgardi/D.E-CURSOR.git
cd D.E-CURSOR

2. Install Dependencies

npm install

3. Hardware Setup (Optional)

If you want to use the real sensor:

  1. Connect HC-SR04 ultrasonic sensor to Arduino:
    • VCC โ†’ 5V
    • GND โ†’ GND
    • Trig โ†’ Pin 9
    • Echo โ†’ Pin 10
  2. Upload the Arduino code from arduino/seat_sensor.ino
  3. Connect Arduino to your computer
  4. Update the COM port in server.js (line 17)

4. Run the Application

Start the Backend Server

npm run start-server

The server will run on http://localhost:3001

Start the Frontend (in a new terminal)

npm start

The application will be available at http://localhost:3000

๐Ÿ“ Project Structure

D.E-CURSOR/
โ”œโ”€โ”€ arduino/
โ”‚   โ””โ”€โ”€ seat_sensor.ino          # Arduino sensor code
โ”œโ”€โ”€ public/
โ”‚   โ””โ”€โ”€ index.html               # HTML template
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”‚   โ”œโ”€โ”€ BusTracker.js        # Bus routes and schedules
โ”‚   โ”‚   โ”œโ”€โ”€ BusTracker.css       # Bus tracker styles
โ”‚   โ”‚   โ”œโ”€โ”€ SeatMap.js           # Real-time seat map
โ”‚   โ”‚   โ””โ”€โ”€ SeatMap.css          # Seat map styles
โ”‚   โ”œโ”€โ”€ App.js                   # Main application component
โ”‚   โ”œโ”€โ”€ App.css                  # Application styles
โ”‚   โ”œโ”€โ”€ index.js                 # React entry point
โ”‚   โ””โ”€โ”€ index.css                # Global styles
โ”œโ”€โ”€ server.js                    # Express backend server
โ”œโ”€โ”€ package.json                 # Project dependencies
โ””โ”€โ”€ README.md                    # This file

๐Ÿ”Œ API Endpoints

GET /api/seat-status

Returns the current seat occupancy status.

Response:

{
  "status": "free" | "occupied",
  "mode": "sensor" | "simulation"
}

๐ŸŽฏ How It Works

Seat Monitoring System

  1. Hardware Mode: Arduino with ultrasonic sensor detects seat occupancy
  2. Serial Communication: Arduino sends status via USB serial port
  3. Backend Processing: Node.js server reads serial data and serves via API
  4. Frontend Display: React app fetches and displays real-time seat status
  5. Simulation Mode: When hardware is unavailable, system runs in demo mode

Bus Information System

  • Comprehensive AMTS route database
  • Real-time schedule display
  • Interactive fare calculator
  • Mobile-responsive design

๐Ÿš€ Available Scripts

  • npm start - Start React development server
  • npm run start-server - Start backend API server
  • npm run build - Build production bundle
  • npm test - Run test suite

๐Ÿ”ง Configuration

Serial Port Configuration

Update the COM port in server.js:

const serialPath = 'COM5'; // Change to your Arduino port

Sensor Calibration

Adjust distance threshold in arduino/seat_sensor.ino:

if (distance > 0 && distance < 10) { // Adjust threshold as needed
    Serial.println("occupied");
}

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“ž Contact

For questions or support:

๐Ÿ“ License

This project is open source and available under the MIT License.

๐Ÿ”ฎ Future Enhancements

  • Multiple sensor support for all seats
  • Mobile application
  • Real-time GPS bus tracking
  • Digital ticket booking integration
  • Push notifications for seat availability
  • Historical occupancy analytics
  • Integration with city transport systems

About

Real-time AMTS bus tracker with Arduino-powered seat monitoring. Live seat availability + complete route info in one smart web app.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published