\n\n\n)\";\n return html;\n}\n\nvoid sendNotification(String message) {\n // Implement notification system\n // Can use Firebase, Pushover, or custom notification service\n Serial.println(\"Notification: \" + message);\n}\n```\n\n### Phase 3: Mobile App Development\n\n#### Option 1: Blynk App (Recommended for beginners)\n1. Download Blynk app from Play Store/App Store\n2. Create new project and get Auth Token\n3. Add widgets for:\n - Temperature/Humidity display\n - Button widgets for device control\n - LED indicators for status\n - Notification widget for alerts\n\n#### Option 2: MIT App Inventor\n1. Create account at http://ai2.appinventor.mit.edu\n2. Design interface with:\n - Buttons for device control\n - Labels for sensor readings\n - Web component for HTTP requests\n3. Use blocks to connect to ESP32 web server\n\n#### Option 3: Flutter/React Native (Advanced)\nFor custom mobile app development with professional features.\n\n### Phase 4: Testing and Deployment\n\n#### Testing Checklist\n- [ ] WiFi connectivity\n- [ ] Sensor readings accuracy\n- [ ] Device control functionality\n- [ ] Mobile app connectivity\n- [ ] Security alerts\n- [ ] Automatic light control\n- [ ] Web dashboard responsiveness\n\n#### Deployment Steps\n1. Set up permanent power supply\n2. Install in suitable enclosure\n3. Mount sensors in appropriate locations\n4. Configure WiFi credentials\n5. Set up mobile app\n6. Test all functionalities\n7. Create user manual\n\n---\n\n## Software Requirements\n\n### Development Environment\n- **Arduino IDE** (Version 1.8.x or 2.x)\n- **ESP32 Board Package**\n- **USB Driver** (CP2102 or CH340)\n\n### Libraries Required\n```\nWiFi - Built-in\nWebServer - Built-in\nDHT sensor library - by Adafruit\nServo - Built-in\nArduinoJson - by Benoit Blanchon\nPubSubClient - by Nick O'Leary\nBlynk - by Blynk\n```\n\n### Mobile App Options\n1. **Blynk** - Easiest, drag-and-drop interface\n2. **MIT App Inventor** - Educational, block-based programming\n3. **Flutter** - Professional cross-platform development\n4. **React Native** - JavaScript-based mobile development\n\n---\n\n## Circuit Diagram\n\n```\nESP32 Pin Connections:\n=====================\nGPIO 13 \u2190 PIR Motion Sensor (OUT)\nGPIO 14 \u2190 DHT22 Temperature Sensor (DATA)\nGPIO 35 \u2190 LDR Light Sensor (analog)\nGPIO 25 \u2192 Relay 1 (Light Control)\nGPIO 26 \u2192 Relay 2 (Fan Control)\nGPIO 27 \u2192 Relay 3 (Heater Control)\nGPIO 32 \u2192 Relay 4 (Door Lock)\nGPIO 18 \u2192 Servo Motor (Signal)\nGPIO 19 \u2192 Buzzer (Positive)\n\nPower Connections:\n=================\n3.3V \u2192 PIR VCC, DHT22 VCC, LDR (one end)\n5V \u2192 Relay VCC, Servo VCC\nGND \u2192 All component grounds\n```\n\n---\n\n## Mobile App Control Features\n\n### Core Features\n1. **Device Control**\n - Toggle lights on/off\n - Control fan speed\n - Adjust heater temperature\n - Lock/unlock doors\n\n2. **Monitoring**\n - Real-time temperature readings\n - Humidity levels\n - Motion detection status\n - Light sensor readings\n\n3. **Automation**\n - Schedule device operations\n - Set temperature thresholds\n - Automatic light control\n - Security mode activation\n\n4. **Notifications**\n - Motion detection alerts\n - Temperature warnings\n - Device status changes\n - System connectivity status\n\n### App Development Platforms\n\n#### Blynk (Recommended for Students)\n- **Pros**: Easy to use, no coding required, built-in widgets\n- **Cons**: Limited customization, requires internet\n- **Cost**: Free tier available\n- **Setup Time**: 30 minutes\n\n#### MIT App Inventor\n- **Pros**: Educational, visual programming, completely free\n- **Cons**: Basic UI, limited advanced features\n- **Cost**: Completely free\n- **Setup Time**: 2-3 hours\n\n#### Flutter\n- **Pros**: Professional look, cross-platform, highly customizable\n- **Cons**: Requires programming knowledge\n- **Cost**: Free\n- **Setup Time**: 1-2 weeks\n\n---\n\n## Reference Resources\n\n### Online Tutorials\n1. **ESP32 Official Documentation**\n - https://docs.espressif.com/projects/esp32/en/latest/\n\n2. **Arduino IDE ESP32 Setup**\n - https://randomnerdtutorials.com/installing-the-esp32-board-in-arduino-ide-windows-instructions/\n\n3. **Home Automation Projects**\n - https://www.instructables.com/ESP32-Home-Automation/\n - https://create.arduino.cc/projecthub/search?q=home%20automation\n\n### YouTube Channels\n1. **Random Nerd Tutorials**\n - Channel: https://www.youtube.com/c/RandomNerdTutorials\n - ESP32 Playlist: Search \"ESP32 Home Automation\"\n\n2. **TechStudyCell**\n - Channel: https://www.youtube.com/c/TechStudyCell\n - Focus: IoT projects with ESP32\n\n3. **GreatScott!**\n - Channel: https://www.youtube.com/c/greatscottlab\n - Electronics tutorials and projects\n\n4. **DroneBot Workshop**\n - Channel: https://www.youtube.com/c/DroneBotWorkshop\n - Arduino and ESP32 projects\n\n### Sri Lankan Suppliers\n1. **Duino.lk**\n - Website: https://www.duino.lk/\n - Phone: 0710 360 355\n\n2. **LK Tronics**\n - Website: https://lk-tronics.com/\n - Island-wide delivery\n\n3. **Alphatronic**\n - Website: https://alphatronic.lk/\n - Specialized in development boards\n\n4. **Microchip.lk**\n - Website: https://microchip.lk/\n - Arduino and sensor modules\n\n### Books and Documentation\n1. **\"ESP32 Projects Book\"** - Available online\n2. **\"Arduino Home Automation\"** - Multiple authors\n3. **Official ESP32 Programming Guide** - Espressif\n\n---\n\n## Project Timeline\n\n### Week 1: Planning and Component Procurement\n- [ ] Finalize project scope\n- [ ] Order components\n- [ ] Set up development environment\n- [ ] Study circuit diagrams\n\n### Week 2: Basic Hardware Setup\n- [ ] Assemble basic circuit\n- [ ] Test ESP32 connectivity\n- [ ] Test individual sensors\n- [ ] Basic LED control\n\n### Week 3: Software Development\n- [ ] Write sensor reading code\n- [ ] Implement web server\n- [ ] Create basic dashboard\n- [ ] Test device control\n\n### Week 4: Advanced Features\n- [ ] Add automation features\n- [ ] Implement security system\n- [ ] Create mobile app\n- [ ] Test integration\n\n### Week 5: Testing and Documentation\n- [ ] Comprehensive testing\n- [ ] Bug fixes\n- [ ] Documentation\n- [ ] Presentation preparation\n\n---\n\n## Troubleshooting Guide\n\n### Common Issues and Solutions\n\n1. **ESP32 Not Connecting to WiFi**\n - Check SSID and password\n - Verify WiFi signal strength\n - Try different WiFi bands (2.4GHz vs 5GHz)\n\n2. **Sensors Not Reading Correctly**\n - Check wiring connections\n - Verify power supply voltage\n - Test with multimeter\n\n3. **Relay Not Switching**\n - Check relay module power supply\n - Verify logic voltage levels\n - Test with LED first\n\n4. **Mobile App Not Connecting**\n - Check ESP32 IP address\n - Verify network connectivity\n - Test with web browser first\n\n### Safety Precautions\n- Never work with mains voltage without proper supervision\n- Use proper fuses and circuit breakers\n- Ensure proper grounding\n- Test in safe environment first\n\n---\n\n## Future Enhancements\n\n### Possible Upgrades\n1. **Voice Control Integration**\n - Amazon Alexa compatibility\n - Google Assistant integration\n\n2. **Advanced Security**\n - Camera integration\n - Facial recognition\n - SMS alerts\n\n3. **Energy Monitoring**\n - Power consumption tracking\n - Cost analysis\n - Energy-saving recommendations\n\n4. **Machine Learning**\n - Predictive automation\n - Usage pattern analysis\n - Intelligent scheduling\n\n### Scalability Options\n- Multiple room control\n- Centralized monitoring\n- Cloud data storage\n- Remote access via internet\n\n---\n\n## Conclusion\n\nThis smart home automation prototype provides a comprehensive foundation for understanding IoT concepts, embedded programming, and mobile app development. The project is designed to be educational while producing a functional system that can be extended and improved.\n\nThe estimated budget of LKR 7,830 - 12,900 makes this project accessible to students while providing hands-on experience with real-world technologies. The modular design allows for incremental development and testing.\n\n**Key Learning Outcomes:**\n- Microcontroller programming\n- Sensor integration\n- Web server development\n- Mobile app creation\n- IoT system design\n- Network programming\n\n**Project Deliverables:**\n- Functional hardware prototype\n- Complete source code\n- Mobile application\n- Documentation\n- Demonstration video\n\nThis project serves as an excellent foundation for understanding modern IoT systems and can be expanded into more complex automation solutions.\n\n---\n\n*Document Version: 1.0* \n*Last Updated: July 2025* \n*Target Audience: Engineering Students, Sri Lanka*"; document.getElementById('content').innerHTML = marked.parse(rawMarkdown);