Voice and app home automation with energy saving
Smart plugs are common but each brand has its own app, and lights and fans are often left on in empty rooms. A single controller for a room's switches, with app, voice and manual control and auto-off when the room is empty, saves energy.
- Parts
- ₹2,040
- Build
- 12 weeks
- Board
- ESP32
- Objectives
- 6
Block diagram
- Wall switchesStill work by hand
- Radar presence sensorKnows when the room is empty
- Temperature sensorRuns the fan by heat
- Current sensorMeasures what is drawn
- ESP32Talks to the app and voice assistant
- 4-channel relaySwitches lights, fan and socket
- Cloud dashboardStores readings, plots trends and sends alerts+
- Phone appShows readings and sends commands over Bluetooth+
Objectives
- To switch four loads from a phone app, a voice assistant and the existing wall switches, with each always showing the true state.
- To turn loads off after 10 minutes with no presence.
- To run the fan automatically above a set temperature.
- To measure energy saved in one room over a week.
- To publish readings over MQTT and show them on a live dashboard with threshold alerts.
- To monitor and control the system from a phone over Bluetooth.
Parts and specifications
- ESP32 DevKit V1Dual-core 240 MHz, 520 KB SRAM, Wi-Fi + Bluetooth, 3.3 V logic, 12-bit ADC (use ADC1 pins when Wi-Fi is on)₹450Buy
- 5 V relay module (4 channel)Four 10 A 250 V AC relays, opto inputs, separate JD-VCC for coil supply₹220Buy
- RCWL-0516 radar motion sensor3.2 GHz Doppler, 5 to 7 m, sees through plastic, 2 s hold, 3.3 V output₹120Buy
- DHT22 temperature and humidity sensor−40 to 80 °C ±0.5 °C, 0 to 100% RH ±2%, one reading every 2 s, single-wire₹250Buy
- ACS712 current sensor (20 A)Hall effect, 100 mV/A for the 20 A version, output centred at 2.5 V, 2.1 kV isolation₹150Buy
- HLK-PM01 5 V mains module or 5 V adapter₹250
- Switchboard, sockets, bulbs and MCB₹600
Total about ₹2,040 at typical online prices. Tap a part for its pinout and datasheet notes.
Design calculations
Each load toggles when either the app or the wall switch changes, like a staircase switch: state = previous state XOR change.
20 A module: 100 mV/A around 2.5 V. After the divider the ESP32 sees 1.67 V at zero. 0.3 V p-p change (scaled back ×1.5) ≈ 0.45 V → 4.5 A peak.
A 60 W fan and two 18 W tube lights left on 3 hours a day in an empty room waste 96 × 3 = 0.29 kWh a day ≈ 105 units a year.
Pin map
| Signal | Pin or connection |
|---|---|
| Relays 1 to 4 | GPIO 26, 27, 32, 33 (active-low) |
| Wall switch inputs 1 to 4 | GPIO 13, 14, 15, 4 through optocouplers or low-voltage switches |
| RCWL-0516 OUT | GPIO 34 |
| DHT22 | GPIO 18 |
| ACS712 OUT | GPIO 35 via 10 kΩ / 20 kΩ divider (5 V module) |
Firmware outline
- Connect to Wi-Fi and the cloud (ESP RainMaker or Sinric Pro) which links Google Assistant and Alexa.
- Read wall switches with debounce; on change toggle the matching relay and report the new state.
- On app or voice commands set the relay and report back so all controls agree.
- If no presence for 10 minutes, turn everything off; if the room is hot and occupied, turn on the fan.
- Every minute measure current and add to an energy total.
Test plan
| Test | Expected result |
|---|---|
| Voice: 'turn on light 1' | Relay on within 2 s, app updated |
| Wall switch flipped | Load toggles and app shows it |
| Room left empty | Loads off after 10 minutes |
| Wi-Fi off | Wall switches still work |
These rows start your results table when you plan the project.
Viva practice
Say your answer out loud first, then check. The first 2 answers are free; Maker opens all 5.
Make it yours
One or two upgrades for a mini project, two to four for a major one.
Datasheets and sources to cite
- Espressif ESP RainMaker documentation
- RCWL-0516 notes
- IS 732 (wiring of electrical installations)
About this project
How much does the voice and app home automation with energy saving project cost?
About ₹2,040 for the parts in the base list: ESP32 DevKit V1, 5 V relay module (4 channel), RCWL-0516 radar motion sensor, DHT22 temperature and humidity sensor, ACS712 current sensor (20 A), HLK-PM01 5 V mains module or 5 V adapter, Switchboard, sockets, bulbs and MCB.
How long does it take?
About 8 weeks for the base project, built on an ESP32. Each upgrade adds time.
Which branches is it suitable for?
Electronics and Communication, Electrical and Electronics, Computer Science / IT (IoT, AI), Diploma (any electronics branch), as a mini or major project.
Which pins and design calculations does it use?
Relays 1 to 4 on GPIO 26, 27, 32, 33 (active-low); Wall switch inputs 1 to 4 on GPIO 13, 14, 15, 4 through optocouplers or low-voltage switches; RCWL-0516 OUT on GPIO 34. Worked calculations on this page: two-way switching, current from acs712, energy saving.
How do I test it?
Voice: 'turn on light 1': Relay on within 2 s, app updated. Wall switch flipped: Load toggles and app shows it. Room left empty: Loads off after 10 minutes. Wi-Fi off: Wall switches still work.
What are the objectives?
To switch four loads from a phone app, a voice assistant and the existing wall switches, with each always showing the true state. To turn loads off after 10 minutes with no presence. To run the fan automatically above a set temperature. To measure energy saved in one room over a week.
