A Beginner-Friendly IoT Lab Code Generator for MSc/MCA Practicals (Programs 5-17)
A complete, beginner-friendly Python package and CLI tool designed specifically for MSc / MCA Semester 3 IoT Laboratory practicals.
iotlabkit generates complete, readable, production-grade project code for Programs 5 through 17, supporting two interchangeable presentation modes:
In university IoT laboratory curricula, students often face hurdles configuring diverse communication protocols (HTTP REST, MQTT, CoAP), cloud databases (Supabase, Firebase, ThingsBoard), and machine learning pipelines (Decision Trees, Linear Regression, Random Forests).
iotlabkit solves this by automating the boilerplate generation while maintaining 100% genuine code, real APIs, and authentic datasets. It does not generate fake sensor readings or synthetic ML data. Every project generated is self-contained and immediately runnable.
Strictly implements Programs 5 through 17 from the syllabus. Programs 1–4 and 18 are excluded.
Verify you have Python 3.9 or higher installed:
python3 --version # Output should be Python 3.9.x, 3.10.x, 3.11.x, 3.12.x, or 3.13.x Linux (Ubuntu / Debian) sudo apt update sudo apt install -y python3 python3-pip python3-venv Linux (Fedora / RHEL) sudo dnf install -y python3 python3-pip Windows (PowerShell) Download the official Python installer from python.org. During installation, make sure to check the box: "Add Python to PATH".
Always use a Python virtual environment to keep your system packages clean.
# Create a virtual environment named .venv python3 -m venv .venv # Activate the virtual environment source .venv/bin/activate On Windows (PowerShell) # Create a virtual environment named .venv python -m venv .venv # Activate the virtual environment .\.venv\Scripts\Activate.ps1 (If PowerShell shows an execution policy error, run: Set-ExecutionPolicy -Scope Process -ExecutionPolicy RemoteSigned)
Install iotlabkit in editable development mode directly from this repository:
python3 -m pip install -e . Windows python -m pip install -e . To install optional extra dependencies (e.g. for ML or dashboards):
pip install -e ".[all]" # Install all dependencies pip install -e ".[analytics]" # Pandas, Matplotlib, Requests pip install -e ".[ml]" # Scikit-learn, Joblib, Pandas, Matplotlib pip install -e ".[iot]" # Paho-MQTT, Requests, Python-dotenv pip install -e ".[dashboard]" # Streamlit Verify installation:
iotlabkit --version # Output: iotlabkit 1.0.0 7. Listing Practicals (list) To view all supported programs and their operational flags:
========================================================================================== iotlabkit — MSc/MCA IoT Laboratory Practicals (Programs 5-17) ========================================================================================== ID | Title | Net | Keys | Broker | Data | Server ------------------------------------------------------------------------------------------ --- Communication and Application Layer --- 5 | HTTP REST API + Cloud Database + Dashboard | Yes | Yes | No | No | Yes 6 | MQTT + Cloud Database + Dashboard | Yes | Yes | Yes | No | No 7 | ThingsBoard + MQTT Telemetry | Yes | Yes | Yes | No | No 8 | CoAP Client and Server Environmental Monit... | No | No | No | No | Yes ... 8. Inspecting a Practical (info) To view detailed prerequisites, objectives, generated files, and viva questions for any program:
iotlabkit info 8 iotlabkit info 15 9. Generating a Project (create) Generate a practical project using its program number:
Generates complete educational code with detailed docstrings, architecture diagrams, step-by-step instructions, and comprehensive viva Q&A:
iotlabkit create 5 iotlabkit create 12 iotlabkit create 15 Exam Mode (--mode exam) Generates concise, focused, production-grade code designed for laboratory examination submission:
iotlabkit create 5 --mode exam iotlabkit create 15 --mode exam Custom Output Directory & Overwrite Flags # Generate into a custom directory name iotlabkit create 8 --output my_coap_lab # Overwrite existing files without interactive prompt iotlabkit create 8 --force 10. Installing Project Dependencies Each generated project contains a self-contained requirements.txt:
cd lab05 pip install -r requirements.txt (Note: Program 8 uses pure standard library and requires zero external pip packages!)
For programs requiring cloud integration (Programs 5, 6, 7, and 10), each generated project includes a .env.example template.
# Linux / macOS: cp .env.example .env # Windows (PowerShell): Copy-Item .env.example .env Open .env in any text editor (VS Code, Notepad, Nano). Supabase Setup (Programs 5, 6, 10) Sign up at supabase.com. Create a project. Open the SQL Editor and run the provided supabase_schema.sql file. Copy your Project URL and anon public key into .env: SUPABASE_URL=https://your-project-ref.supabase.co SUPABASE_KEY=your-anon-public-key Firebase Setup (Programs 5, 6, 10 Alternative) Open Firebase Console. Create a project -> Build -> Realtime Database. In .env: CLOUD_PROVIDER=firebase FIREBASE_DATABASE_URL=https://your-project.firebaseio.com ThingsBoard Setup (Program 7) Sign up at thingsboard.cloud. Navigate to Entities -> Devices -> Add new device (e.g. Lab_Sensor_01). Copy the Access Token from Device Details. In .env: THINGSBOARD_ACCESS_TOKEN=your-device-access-token Offline Fallback Guarantee: If cloud credentials are not supplied, Programs 5, 6, and 10 automatically fall back to local JSON caching (data/local_*.json) so you can complete and test the practical offline without internet!
# Terminal 1: Start REST Server python server.py # Terminal 2: Stream Sensor Telemetry python client_sender.py # Terminal 3: Launch Web Dashboard streamlit run dashboard.py Program 6 — MQTT + Cloud DB + Dashboard # Terminal 1: Start Subscriber python subscriber.py # Terminal 2: Publish Real Readings python publisher.py # Terminal 3: View Dashboard streamlit run dashboard.py Program 7 — ThingsBoard + MQTT python main.py # Follow `thingsboard_dashboard_guide.md` to configure ThingsBoard widgets. Program 8 — CoAP Client and Server (Zero Dependencies!) # Terminal 1: Start CoAP Server python server.py # Terminal 2: Query CoAP Server python client.py # Continuous live observation: python client.py --watch 3 Program 9 — Online & Local MQTT Brokers # Online Mode (HiveMQ Public Cloud Broker): python subscriber.py --broker online python publisher.py --broker online # Local Mode (Mosquitto Edge Broker): python subscriber.py --broker local python publisher.py --broker local Program 10 — CoAP Environmental Monitoring (Open-Meteo) # Terminal 1: CoAP Server (fetches Open-Meteo & serves CoAP) python coap_env_server.py # Terminal 2: CoAP Client (queries CoAP & stores to DB) python coap_env_client.py # Terminal 3: Dashboard streamlit run dashboard.py Program 11 — ISS Location Tracking # Collect 100 live orbital points at 5-second intervals (~8.3 minutes): python collector.py --count 100 --interval 5 # Compute orbital statistics & generate trend plots: python analyzer.py # View interactive orbit map: streamlit run dashboard.py Program 12 — USGS Earthquake Analysis # Retrieve past 7 weeks of live seismic data from USGS: python fetch_data.py # Compute statistical distribution & plots: python analyzer.py # Launch interactive seismic dashboard: streamlit run dashboard.py Program 13 — Weather Analysis (Kochi) # Fetch hourly meteorological data from Open-Meteo: python fetch_weather.py # Compute Pearson correlation & trend curves: python analyzer.py # Launch dashboard: streamlit run dashboard.py Program 14 — Air Quality Analysis (Kochi) # Fetch hourly PM10, PM2.5, and US AQI: python fetch_air_quality.py # Calculate particulate statistics & WHO threshold curves: python analyzer.py # Launch dashboard: streamlit run dashboard.py Program 15 — Decision Tree Room Occupancy Classifier # Train Decision Tree model and export artifacts: python train.py # Classify occupancy for a new sensor reading: python predict.py --temp 23.2 --humidity 27.2 --light 426 --co2 721 # Launch Streamlit predictor: streamlit run dashboard.py Program 16 — Linear Regression Temperature Prediction # Inspect actual dataset columns: python column_inspection.py # Train Linear Regression model (MAE, RMSE, R²): python train.py # Predict temperature for new readings: python predict.py --dewp -16.0 --pres 1020.0 --pm25 120.0 --wind 2.0 Program 17 — Random Forest Air Quality Classification # Train Random Forest classifier across 6 CPCB classes: python train.py # Predict air quality bucket for new pollutant readings: python predict.py --pm25 85 --pm10 140 --no2 32 --co 1.2 --so2 15 --o3 45 # Launch interactive dashboard: streamlit run dashboard.py 14. Running Diagnostics (doctor) Check your Python environment, installed tools, and optional packages:
iotlabkit doctor The doctor tool safely checks environment variables without exposing sensitive secret values.
Cause: The client was started before the corresponding server was active. Fix: Keep Terminal 1 running with the server (python server.py) before running the client script in Terminal 2.
Cause: Package was not installed in editable mode or virtual environment is not activated. Fix: Activate your virtual environment and run pip install -e ..
Cause: Mosquitto service is not running on your computer. Fix:
Cause: Invalid SUPABASE_KEY or missing anon key. Fix: Check that your .env contains the full anon key from Project Settings -> API.
pip uninstall iotlabkit -y License This project is licensed under the MIT License. Datasets and APIs used belong to their respective creators:
iot mqtt coap rest-api machine-learning data-analytics education laboratory code-generator
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
None of the files in this release were uploaded with provenance metadata.
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.




