The AIoT Smart Learning Platform is a multidisciplinary educational application that combines gamified e-learning methodologies with Artificial Intelligence (AI) and Internet of Things (IoT) integrations. The system is designed to provide highly personalized learning paths, context-aware AI tutoring, and real-time physical health monitoring using external hardware sensors (YoloBit).
- Hierarchical Progression: Structured learning paths divided into Skill Trees, Skills, Levels, Lessons, and Exercises.
- Engagement Mechanics: Experience points (XP), daily streaks, achievements, leaderboards, and a health (hearts) system.
- Spaced Repetition Flashcards: Automated flashcard generation utilizing the SM-2 algorithm for optimized memory retention.
- AI Tutor: A context-aware chatbot capable of assisting students with specific lessons and generating dynamic coding or conceptual exercises.
- AI Arena: Dynamically generated challenges that adapt to the user's proficiency level.
- Personalized Paths: AI-driven analytics that suggest subsequent skills based on the user's weak and strong areas.
- Sensor Integration: Real-time data ingestion from YoloBit hardware (Temperature, Humidity, Light, Motion).
- Dynamic Alerting: Configurable thresholds for health warnings, such as prolonged sitting duration, poor lighting, or suboptimal room temperature.
- AI Health Suggestions: Contextual recommendations to improve the user's physical learning environment based on sensor data.
- Role-Based Access Control: Secure access for administrators versus standard users.
- Content Management: Full CRUD capabilities for the hierarchical curriculum structure.
- Student Analytics: Detailed views of individual student progress, XP history, and health alerts.
- System Configuration: Dynamic configuration of IoT sensor thresholds via the database, avoiding hardcoded application restarts.
The report could be access here
- Framework: React 19, TypeScript, Vite
- State Management: Zustand
- Styling & UI: Tailwind CSS, shadcn/ui, framer-motion
- Data Visualization: Recharts
- Routing: React Router DOM
- Framework: FastAPI (Python)
- Database: PostgreSQL with SQLAlchemy ORM
- Authentication: JWT (JSON Web Tokens)
- AI Services: Groq/Gemini API integration
- Protocol: MQTT
- Scripts: Python-based bridges (
mqtt_bridge.py,sensor_simulator.py) connecting hardware endpoints to the FastAPI backend.
- Node.js (v18 or higher)
- Python (v3.10 or higher)
- PostgreSQL
- MQTT Broker (e.g., Mosquitto or Adafruit IO)
Ensure PostgreSQL is running. Create a database for the project and configure the connection string in the backend environment variables.
Navigate to the backend directory, install dependencies, and seed the database.
cd backend
pip install -r requirements.txt
# Reset and seed the database with initial configurations and curriculum
python seed_data.py
# Start the FastAPI server
uvicorn main:app --reloadNavigate to the frontend directory, install dependencies, and start the development server.
cd frontend
npm install
# Start the Vite development server
npm run devTo simulate or connect real IoT data, run the middleware scripts in separate terminal instances.
cd iot_middleware
# Terminal A: Start the MQTT Bridge
python mqtt_bridge.py
# Terminal B: Start the Sensor Simulator (if hardware is unavailable)
python sensor_simulator.py.
├── backend/ # FastAPI application
│ ├── main.py # Application entry point
│ ├── models.py # SQLAlchemy database schemas
│ ├── schemas.py # Pydantic validation models
│ ├── routers/ # API endpoints (auth, learning, admin, health, etc.)
│ ├── services/ # Business logic (AI processing, health monitoring)
│ └── seed_data.py # Database initialization script
├── frontend/ # React application
│ ├── src/
│ │ ├── components/ # Reusable UI components
│ │ ├── layouts/ # Structural layouts (Sidebar, Header)
│ │ ├── pages/ # View components (Dashboard, Admin, LessonPlayer)
│ │ ├── store/ # Zustand global state
│ │ └── lib/ # Utility functions and API configuration
├── iot_middleware/ # IoT connection layer
│ ├── mqtt_bridge.py # Subscribes to MQTT and POSTs to backend
│ └── sensor_simulator.py# Generates mock sensor data
└── README.md
Once the backend server is running, the interactive API documentation is automatically generated by FastAPI.
- Swagger UI:
http://localhost:8000/docs - ReDoc:
http://localhost:8000/redoc
- Ensure all new endpoints are strongly typed using Pydantic schemas.
- Maintain the English localization standard across all user-facing interfaces and backend responses.
- When modifying the database schema (
models.py), update theseed_data.pyscript accordingly to maintain a reproducible development environment.
This project is fully containerized and can be deployed using Docker Compose.
-
Build and start all services (first-time setup):
docker-compose up --build
-
Run in detached mode (subsequent runs):
docker-compose up -d
-
Stop the project:
docker-compose down
The IoT Simulator (sensor_simulator.py) requires a non-interactive mode when running in Docker. This is managed via the SIMULATOR_MODE environment variable in docker-compose.yml.
- Value 1: Auto mode (default).
- Value 2: Manual mode (not recommended for Docker as it lacks interaction).
Note: Ensure SIMULATOR_MODE is set to 1 or 2 in docker-compose.yml before building to avoid interactive input errors.
View logs for all services:
docker-compose logs -fView logs for specific services:
- Database (PostgreSQL):
docker-compose logs -f db - MQTT Broker (Mosquitto):
docker-compose logs -f mqtt - Backend (FastAPI):
docker-compose logs -f backend - Frontend (React Vite):
docker-compose logs -f frontend - IoT Middleware (Bridge & Simulator):
docker-compose logs -f iot_middleware