Building a smart light switch with ESP8266 that works without neutral wire solves one of the biggest challenges in Indian home automation. Most Indian homes, especially older ones, have switches wired with only the live (phase) wire — no neutral wire in the switch box. This tutorial shows how to make a DIY smart light switch using ESP8266 that operates without a neutral wire, specifically designed for Indian 230V 50Hz electrical standards.
Table of Contents
- Why No-Neutral is Common in India
- Circuit Design for No-Neutral Operation
- Components Required in India
- Safety Considerations for 230V
- Building the Circuit
- ESP8266 Firmware with ESPHome/Tasmota
- Installation in Indian Switch Box
- Frequently Asked Questions
Why No-Neutral is Common in India
In most Indian homes built before 2010, electrical wiring runs the live wire through the switch to the light fixture, with neutral returning directly to the fixture. This means the switch only has access to the live wire — no neutral is present in the switch box.
This differs from newer Indian wiring standards (IS 732) and European/American wiring where both live and neutral are brought to the switch for low-voltage smart switch operation. For no-neutral smart switches to work in India, they must borrow a tiny trickle of current through the light bulb to power themselves.
Circuit Design for No-Neutral Operation
A no-neutral smart switch works by stealing power through the load (light bulb):
- When light is OFF: A tiny current (0.5–5mA) flows from Live, through the smart switch electronics, through the bulb, to Neutral. This powers the ESP8266’s standby circuits.
- When light is ON: Full mains power flows through the relay/TRIAC, and the smart switch gets power via a small bypass capacitor power supply.
Key requirement: The light bulb must tolerate this small leakage current when “off”. LED bulbs with some compatibility issues may flicker — this is discussed in the FAQ below.
Components Required in India
- ESP8266 (WEMOS D1 Mini or ESP-12F): ₹150–₹250
- HLK-PM01 5V module OR capacitive power supply: HLK-PM01 (₹80–₹150) is far safer for beginners — isolated AC/DC converter. Capacitive power supply (cheaper but dangerous — not isolated)
- MOC3021 Optocoupler + BT136 TRIAC: ₹20–₹40 total. For solid-state switching (silent, no relay click)
- OR 5V relay + opto-isolation: ₹20–₹40 for relay circuit
- Touch or push button: ₹10–₂0 — preserves manual control
- PCB and enclosure: Custom or repurpose existing switch box enclosure
SAFETY WARNING: This project involves 230V mains electricity. Incorrect wiring is dangerous and potentially fatal. If you are not confident working with mains voltage, hire a licensed electrician in India. Always work with power disconnected at MCB.
Safety Considerations for 230V
- Always turn off MCB before working in switch box
- Use properly rated components for 230V AC India
- Maintain minimum 8mm creepage distance between mains and low-voltage circuits on PCB
- Use HLK-PM01 or similar certified isolated PSU — NOT bare capacitive power supply in any accessible product
- Enclose all mains voltage parts in insulated box (IP20 or better)
- In India, the BIS mark (IS:13947 for switches) applies to commercial products — DIY is for personal use only
Building the Circuit
/* Circuit connections for no-neutral switch (with relay): */
// 230V AC Mains
// L (Live) ──────────────────────┬────── To Relay COM
// │
// └── HLK-PM01 L input
//
// N (Neutral, from light fixture)── HLK-PM01 N input
// (NOT in switch box, at fixture)
//
// Relay contact:
// COM ──── Live in
// NO ──── To Light L
// (N returns to fixture directly)
//
// HLK-PM01 5V output → ESP8266 5V
// ESP8266 D1 (GPIO5) → Relay control (via transistor or relay module)
// Touch button → ESP8266 D2 (GPIO4, INPUT_PULLUP)
// In practice for no-neutral: use HLK-PM01 AC/DC module
// Connect: L to Live wire, N to neutral (at junction box or fixture)
// Output: 5V DC for ESP8266 + relay
// But for TRUE no-neutral (only 2 wires in switch box):
// Power is stolen through load:
// L ─── Switch electronics ──── Load L ──── Load N ─── N (at panel)
// Current path when off: tiny current through ESP8266 PS + bulb
ESP8266 Firmware with ESPHome/Tasmota
# ESPHome configuration for smart switch (no neutral):
esphome:
name: living-room-switch
esp8266:
board: d1_mini
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
api:
ota:
logger:
# Manual fallback button
binary_sensor:
- platform: gpio
pin:
number: D2
mode: INPUT_PULLUP
inverted: true
name: "Wall Button"
on_press:
then:
- switch.toggle: relay
# Relay control
switch:
- platform: gpio
pin: D1
name: "Living Room Light"
id: relay
restore_mode: RESTORE_DEFAULT_OFF # Safe default after power cut
# Tasmota configuration (via console):
# Set module type (WEMOS D1 Mini):
# Module: Generic (18)
# GPIO5: Relay1
# GPIO4: Switch1
# Set power restore state to OFF (safety):
PowerOnState 0
# Configure MQTT:
MqttHost 192.168.1.100
MqttTopic living_room_switch
# Add to Home Assistant as MQTT switch or auto-discover via HA integration
Installation in Indian Switch Box
Standard Indian modular switch boxes (87mm wide) can accommodate a D1 Mini with small relay module:
- Use a grid frame (frame plate) to mount PCB behind the faceplate
- Retain the existing wall button for manual control — wire to ESP8266 GPIO as input
- Leave adequate space for wiring inside the gang box
- Use proper cable glands or strain relief for wiring entry
- Power-cycle test 10+ times before final installation to verify stable operation
For two-way switches (used in Indian staircase and corridor lighting), two smart switches on the same circuit require careful configuration — each switch must be aware of the other’s state.
Frequently Asked Questions
Why does my LED bulb flicker with no-neutral smart switch?
Flickering occurs because the small standby current (needed to power the smart switch) passes through the LED driver, causing partial activation. Solutions: Use a resistor bypass (1–5Ω, 2W between live and neutral at the fixture), or use a bulb with a true zero-standby-current LED driver. Most quality Indian brands (Philips, Havells LED) handle this better than cheap bulbs.
Can this work with Indian 3-pin plug points too?
Smart switch modules are for wall switches controlling lights and fans — not plug points. For smart plug points, use a different approach: a smart socket (inline switch) that has both live and neutral connections available.
What is the load rating for DIY no-neutral smart switch?
Component-dependent: HLK-PM01 supports up to 600W load. BT136 TRIAC supports 4A (900W at 230V). A 10A relay supports 2300W. Most Indian ceiling lights are 20–60W, well within these ratings. For ceiling fans (60–80W) or geysers (2000W), verify your relay rating carefully.
Does a no-neutral smart switch work with Indian ceiling fans?
The relay/TRIAC switching part works, but fan speed control requires a different approach (TRIAC-based dimmer or capacitor switching). A no-neutral smart switch can turn a ceiling fan on/off but cannot control speed without additional circuitry specifically designed for Indian induction motor fans.
Are there ready-made no-neutral smart switches for India?
Yes — commercial options include Aqara H1 (Zigbee, works with HA), Shelly 1 (requires neutral but ultra-compact), and various Chinese brands on Amazon India. These are tested, certified, and safer than DIY for non-technical users. Prices range ₹800–₹2500 per switch.
Add comment