An open API service indexing awesome lists of open source software.

https://github.com/lovnishverma/roomcontrol

The Room Control System is a real-time, web-based smart home automation system built using NodeMCU (ESP8266), Node.js, MQTT, SQLite, and WebSockets. It allows users to remotely control and monitor IoT-based electrical appliances with instant, real-time feedback via a dynamic web dashboard that updates without requiring page refreshes.
https://github.com/lovnishverma/roomcontrol

expressjs iot mqtt nodejs research-project smarthome

Last synced: 3 months ago
JSON representation

The Room Control System is a real-time, web-based smart home automation system built using NodeMCU (ESP8266), Node.js, MQTT, SQLite, and WebSockets. It allows users to remotely control and monitor IoT-based electrical appliances with instant, real-time feedback via a dynamic web dashboard that updates without requiring page refreshes.

Awesome Lists containing this project

README

          

# Room Control System (Next-Gen Smart Home Automation)

![poster](https://github.com/user-attachments/assets/2b1131e9-3ba2-44ae-81d6-77204dc058be)

## πŸš€ Overview
The **Room Control System** is a **next-generation, open-source IoT-based automation platform** designed to **control and monitor electrical appliances in real-time**. Unlike traditional smart home systems, this solution is **cost-effective, cloud-independent, and fully customizable**β€”empowering users with **unparalleled control and security** over their smart environments.

Built on a **modern tech stack** leveraging **MQTT, WebSockets, SQLite, and Express.js**, this system delivers **seamless automation, real-time feedback, and AI-driven voice control** without requiring proprietary apps like Alexa, Google Home, or Blynk IoT.

[Project Demonstration] [Watch the Demo Video](https://drive.google.com/file/d/12WnC51pWOMC-PsmbNZV4HloxscDCCj8v/view?usp=sharing) [Watch the Demo Video](https://drive.google.com/file/d/16Wy8lnvUQkwuwW1xyQJ9vPcC_9h-Urk-/view?usp=sharing)

### 🌍 Revolutionizing IoT Automation
- **Completely Open-Source** – No hidden costs, full transparency, and complete control.
- **Independent & Decentralized** – Runs **without cloud dependency** for ultimate privacy.
- **AI-Enabled Voice Commands** – Issue commands directly using **built-in voice recognition**.
- **Self-Hosting Options** – Run it on **Raspberry Pi, VPS, or personal servers**.
- **Designed for Scalability** – Adaptable to **industrial automation, smart classrooms, and home automation**.

πŸ”Ή **Live Deployment:**
🌐 **[Room Control (Live Demo)](https://roomcontrol.glitch.me/login)**
πŸ“‚ **[GitHub Repository](https://github.com/lovnishverma/roomcontrol)**

**HOMEPAGE:**

![image](https://github.com/user-attachments/assets/de3e47d3-4a68-4458-bebc-0fa3dd9fcd90)

**VOICE CONTROL:**

![image](https://github.com/user-attachments/assets/523c4622-7c8d-4054-a5df-893767ab11d1)

## πŸ”₯ Key Features
βœ… **Real-Time Web Control** – Instant response via **WebSockets (Socket.IO)**.
βœ… **MQTT-Based IoT Communication** – Ultra-secure and efficient messaging.
βœ… **Historical Data Logging** – View **past actions, timestamps, and user activity**.
βœ… **End-to-End Security** – **bcrypt password hashing, session-based authentication**.
βœ… **AI-Powered Voice Control** – **No Alexa, No Google Home Needed!** Direct command execution.
βœ… **Automated Scheduling** – Predefine ON/OFF times for smart appliances.
βœ… **Mobile-Friendly UI** – Responsive and accessible from any device.
βœ… **Offline & Local Hosting Support** – Functions **without an internet connection**.
βœ… **Lightweight & Scalable** – Works on low-power devices like ESP8266 & ESP32.

**Real-Time Historical Data:**

![image](https://github.com/user-attachments/assets/40585baa-0148-4642-8f9f-1994a9a626e6)

## πŸ“Œ Why This System is a Game-Changer
| **Existing Systems** | **Room Control System** |
|--------------------|-------------------|
| Requires External Apps (Alexa, Google Home, Blynk IoT) | No additional apps needed – **browser-based** control |
| Expensive Smart Hubs | Uses **affordable ESP8266/ESP32** modules |
| Cloud Dependent | Works **offline or online** (self-hosted) |
| Proprietary & Limited Customization | Fully **open-source** & highly customizable |
| IoT Vendor Lock-In | **Decentralized & user-controlled** |

## πŸ› οΈ Technologies Used
- **Backend:** Express.js, SQLite
- **Frontend:** EJS, Bootstrap
- **Communication Protocol:** MQTT, WebSockets
- **Embedded:** ESP8266, HiveMQ Cloud MQTT
- **Security:** bcrypt, express-session

## πŸ—οΈ Installation Guide
### Prerequisites
- Install **Node.js**
- Set up **ESP8266** with [Arduino IDE](https://www.arduino.cc/en/software/)
- Create an account with [HiveMQ Cloud MQTT](https://www.hivemq.com/)

### 1️⃣ Clone the Repository
```sh
git clone https://github.com/lovnishverma/roomcontrol.git
cd roomcontrol
```

### 2️⃣ Install Dependencies
```sh
npm install
```

### 3️⃣ Configure Environment Variables
Create a `.env` file and add:
```ini
MQTT_BROKER_URL=mqtts://your-hivemq-url
MQTT_USERNAME=your-username
MQTT_PASSWORD=your-password
SESSION_SECRET=your-secret-key
```

### 4️⃣ Start the Server
```sh
npm start
```
Server will run at `http://localhost:3000`.

### 5️⃣ Deploying to a Live Server
- [Glitch](https://glitch.com/)
- [Heroku](https://www.heroku.com/)
- [Vercel](https://vercel.com/)

## βš™οΈ ESP8266 Firmware Setup
### Wiring
- **Relay Module:** GPIO 4 (D2)
- **Buzzer:** GPIO 5 (D1)

### Wi-Fi & MQTT Configuration
```cpp
const char* ssid = "your_wifi_SSID";
const char* password = "your_wifi_password";
const char* mqttServer = "your-mqtt-server";
const int mqttPort = 8883;
const char* mqttUser = "your-mqtt-username";
const char* mqttPassword = "your-mqtt-password";
```
Upload the firmware using Arduino IDE.

πŸ”Ή **Full Code:** [ESP8266 Firmware](https://github.com/lovnishverma/roomcontrol/blob/master/esp8266_code.ino)

## 🌐 API Endpoints
| Endpoint | Method | Description |
|----------|--------|-------------|
| `/toggle-app?state=on` | GET | Turns the switch ON |
| `/toggle-app?state=off` | GET | Turns the switch OFF |
| `/app-status` | GET | Retrieves switch status |
| `/send-command` | POST | Sends command `{ command: '1' '0' }` |
| `/historic-data` | GET | Retrieves historical data |

## πŸ“‘ WebSocket Events
- **`newEntry`** β†’ Broadcasts new historical data
- **`statusUpdate`** β†’ Sends real-time status updates

## πŸ”„ Future Enhancements

πŸš€ **[AR-Powered Automation](https://github.com/lovnishverma/arjs-iot-control)** – Integrate **Augmented Reality-based automation**.

πŸš€ **AI-Powered Automation** – Integrate **machine learning-based automation**.
πŸš€ **Advanced Security** – Implement **OAuth 2.0 & JWT authentication**.
πŸš€ **Multi-Device Synchronization** – Seamless control across multiple devices.
πŸš€ **Smart Energy Management** – AI-powered power consumption analysis.
πŸš€ **Native Mobile App (Flutter)** – Build an **offline-first PWA & mobile app**.
πŸš€ **Raspberry Pi Support** – Run locally on a **self-hosted local server**.

## 🎯 Contribution Guide
1. Fork the repository.
2. Create a new branch: `git checkout -b feature-xyz`
3. Commit changes: `git commit -m "Add new feature"`
4. Push to GitHub: `git push origin feature-xyz`
5. Submit a pull request.

## πŸ”— Deployment & Hosting
πŸ“Œ **Live Deployment:** [Room Control](https://roomcontrol.glitch.me/)
πŸ“‚ **GitHub Repository:** [Room Control](https://github.com/lovnishverma/roomcontrol)
πŸ”Ή **Self-Hosting Options** – Raspberry Pi, VPS, or local servers.

## πŸ“ License
This project is open-source under the **MIT License**. Feel free to **use, modify, and distribute**.

## πŸ“– Research Paper
This project is based on the research paper **[IoT-Based Remote Control and Monitoring of Electrical Appliances](https://journal.nielit.edu.in/index.php/01/article/view/107)**.

## 🀝 Contributors
- **Lovnish Verma** [(@lovnishVerma)](https://github.com/lovnishVerma)
- **Dr. Sarwan Singh** [(@sarwansingh)](https://github.com/sarwansingh)

## πŸ“¬ Contact
For any issues or queries, open an issue in the repository or contact: [princelv84@gmail.com](mailto:princelv84@gmail.com).