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.
- Host: GitHub
- URL: https://github.com/lovnishverma/roomcontrol
- Owner: lovnishverma
- License: mit
- Created: 2025-03-18T18:15:17.000Z (7 months ago)
- Default Branch: master
- Last Pushed: 2025-06-24T18:30:49.000Z (4 months ago)
- Last Synced: 2025-06-24T19:46:05.239Z (4 months ago)
- Topics: expressjs, iot, mqtt, nodejs, research-project, smarthome
- Language: JavaScript
- Homepage: https://roomcontrol.glitch.me/
- Size: 17.2 MB
- Stars: 8
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Room Control System (Next-Gen Smart Home Automation)

## π 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:**

**VOICE CONTROL:**

## π₯ 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:**

## π 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).