A comprehensive IoT solution for smart home automation with mobile app control, voice integration, energy monitoring, and security system.
- Control lights, thermostats, and other smart devices
- Real-time device status monitoring
- Brightness and temperature control
- Individual device management
- Voice commands for device control
- Text-to-speech feedback
- Support for natural language commands
- Voice-activated device switching
- Real-time power consumption tracking
- Energy usage statistics
- Cost calculation
- Hourly and daily consumption charts
- Peak power detection
- Door/window sensors
- Motion detection
- Alarm system with notifications
- Arming/disarming controls
- Security event logging
- React Native - Mobile application framework
- Arduino - IoT device programming
- MQTT - Message queuing telemetry transport
- AWS IoT - Cloud IoT platform integration
IoT Smart Home System/
βββ src/
β βββ screens/ # React Native screens
β β βββ HomeScreen.js
β β βββ DevicesScreen.js
β β βββ EnergyScreen.js
β β βββ SecurityScreen.js
β β βββ VoiceScreen.js
β βββ services/ # Business logic services
β β βββ mqttService.js
β β βββ awsIoTService.js
β β βββ deviceService.js
β β βββ energyService.js
β β βββ securityService.js
β β βββ voiceService.js
β βββ theme.js # App theme configuration
βββ arduino/ # Arduino device code
β βββ smart_light/
β βββ energy_monitor/
β βββ security_sensor/
β βββ thermostat/
βββ config/ # Configuration files
βββ README.md
- Node.js 14+ and npm
- React Native development environment
- Arduino IDE
- ESP8266 or ESP32 development board
- MQTT broker (local or cloud)
-
Install dependencies:
npm install
-
Configure connection:
- Copy
config/config.example.jstoconfig/config.js - Update MQTT broker URL and AWS IoT credentials
- Copy
-
Run the app:
# For Expo npm start # For iOS npm run ios # For Android npm run android
-
Install Arduino IDE:
- Download from https://www.arduino.cc/en/software
-
Install ESP8266/ESP32 Board Support:
- File β Preferences β Additional Board Manager URLs
- Add ESP8266/ESP32 board URLs (see
arduino/libraries.md)
-
Install Required Libraries:
- PubSubClient (MQTT)
- ArduinoJson (JSON parsing)
- DHT sensor library (for thermostat)
-
Configure and Upload:
- Open the appropriate
.inofile - Update WiFi credentials and MQTT broker settings
- Select your board (ESP8266 or ESP32)
- Upload to device
- Open the appropriate
-
Install Mosquitto:
# Windows (using Chocolatey) choco install mosquitto # macOS brew install mosquitto # Linux sudo apt-get install mosquitto mosquitto-clients
-
Start Mosquitto:
# Default port 1883 mosquitto -p 1883 # With WebSocket support (port 8083) mosquitto -p 1883 -c /path/to/mosquitto.conf
-
Mosquitto Configuration (for WebSocket):
listener 1883 protocol mqtt listener 8083 protocol websockets
- Mosquitto Cloud: https://mosquitto.cloud/
- HiveMQ: https://www.hivemq.com/
- AWS IoT Core: Use AWS IoT configuration
-
Create AWS IoT Thing:
- Go to AWS IoT Console
- Create a new Thing
- Download certificates
-
Configure Policy:
- Create IoT policy with permissions:
{ "Effect": "Allow", "Action": ["iot:Connect", "iot:Publish", "iot:Subscribe", "iot:Receive"], "Resource": "*" }
- Create IoT policy with permissions:
-
Update Configuration:
- Add endpoint to
config/config.js - Configure credentials (Cognito/IAM roles recommended)
- Add endpoint to
- Navigate to Devices tab
- View all connected devices
- Toggle devices on/off
- Adjust brightness (for lights) or temperature (for thermostat)
- Navigate to Energy tab
- View real-time power consumption
- Check hourly and daily consumption charts
- Monitor energy costs
- Navigate to Security tab
- Arm/disarm security system
- View sensor status
- Check recent security events
- Navigate to Voice tab
- Tap "Start Listening"
- Speak commands:
- "Turn on [device name]"
- "Turn off [device name]"
- "Brightness 50 [device name]"
- "Temperature 22 [device name]"
device/{deviceId}/control- Send commands to devicesdevice/{deviceId}/status- Receive device status updates
energy/monitoring- Energy consumption data
security/alarm- Security alarmssecurity/sensor- Sensor status updatessecurity/control- Security system controlsecurity/motion- Motion detection events
- LED connected to GPIO pin with PWM support
- Optional: LDR (Light Dependent Resistor) for ambient light sensing
- ACS712 Current Sensor (5A, 20A, or 30A variant)
- Optional: Voltage divider for voltage measurement
- Magnetic Reed Switch (for door/window)
- OR PIR Motion Sensor (for motion detection)
- Optional: Buzzer for local alarm
- DHT22 or DS18B20 temperature sensor
- Optional: Relay module for HVAC control
- Connection failed: Check MQTT broker URL and network connectivity
- Devices not updating: Verify MQTT subscriptions and message format
- Voice not working: Ensure microphone permissions are granted
- WiFi not connecting: Verify SSID and password
- MQTT not connecting: Check broker IP address and port
- Sensor readings incorrect: Verify pin connections and sensor calibration
- Create new Arduino sketch in
arduino/directory - Implement MQTT communication following existing patterns
- Add device type to
deviceService.js - Create UI components in appropriate screen
- Modify services in
src/services/for business logic changes - Update screens in
src/screens/for UI changes - Adjust configuration in
config/config.js
This project is provided as-is for educational and development purposes.
For issues and questions:
- Check Arduino libraries installation
- Verify MQTT broker connectivity
- Review configuration files
- Check device logs and serial output
Contributions are welcome! Please ensure:
- Code follows existing patterns
- Arduino code includes proper error handling
- Mobile app code is properly tested
- Documentation is updated
Note: This is a comprehensive IoT smart home system. Ensure all devices are properly configured and secured before deployment in production environments.