Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

WIGHT — WiFi + Light Control

The name WIGHT comes from combining WiFi and Light. It's a one-host, multi-node system for remotely controlling home light switches over Wi-Fi, designed to be retrofitted onto existing wall switches or used to build standalone smart-light modules throughout a home.

🚧 Status: In progress — core communication and web control are working; this is being actively developed further (see Roadmap below).

Overview

A single Host (ESP32) is meant to run once per home/environment, connecting to Wi-Fi and serving the control interface. It communicates with any number of Node devices — each built around a low-cost ESP01 Wi-Fi module — placed near each individual light/switch, using ESP-NOW (a low-latency, connectionless wireless protocol) instead of routing control traffic through Wi-Fi/MQTT:

  • Host (ESP32, single instance) — connects to the home Wi-Fi, serves a web control page, and relays ON/OFF commands to the right Node over ESP-NOW.
  • Node (ESP01-based, one per light) — sits near the actual light/switch, listens for ESP-NOW messages addressed to it, and drives a relay/optotriac output pin to physically switch the load.

This one-host/many-nodes design means only a single device in the whole house needs to hold an actual Wi-Fi connection — every Node is a cheap, low-power ESP01 that just listens for its own commands, which keeps per-light hardware small and inexpensive to scale across many switches.

Features

  • Wireless control over ESP-NOW (peer-to-peer, no router hop between the two boards after pairing)
  • Simple mobile-friendly web control page served directly from the Host's built-in web server
  • mDNS support — reachable at http://lightcontrol.local on the local network, no need to know the IP
  • Multi-channel design on the Node — supports controlling more than one output/light by adding more pins to channelPins[]
  • Fails safe: Node initializes all outputs to OFF on boot instead of defaulting to "on"
  • CORS-enabled /toggle endpoint, so it can also be triggered from a standalone test page or other clients

Tech Stack

  • Hardware: ESP32 (Host, single unit per home), ESP01 (Node, one per light/switch)
  • Framework: Arduino (via PlatformIO)
  • Wireless protocol: ESP-NOW (Host ↔ Nodes) + WiFi (Host only, for the web server)
  • Language: C++

Project Structure

WIGHT/
├── Host/              # ESP32 — the single Wi-Fi connected device, serves the web UI
│   └── src/main.cpp
├── Node/               # ESP01 — one per light, receives commands, drives the switch
│   └── src/main.cpp

Note: the code in this repo currently targets ESP32 for both boards during development; the Node firmware is being ported/adapted to run on the ESP01's more limited flash and pin count (see Roadmap).

How to Run

  1. Clone this repository
  2. Open the Node/ folder in PlatformIO, flash it to an ESP32 first
  3. Open the Serial Monitor (115200 baud) — the Node prints its MAC address and Wi-Fi channel on boot
  4. Copy that MAC address into Host/src/main.cpp:
    uint8_t nodeMac[] = {0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF}; // <-- paste Node's MAC here
  5. In both Host/src/main.cpp and Node/src/main.cpp, set your own Wi-Fi credentials:
    const char *WIFI_SSID = "YourHomeWiFi";
    const char *WIFI_PASS = "YourWiFiPassword";
  6. Flash the Host/ folder to the second ESP32
  7. From the Host's Serial output, confirm both boards report the same Wi-Fi channel (ESP-NOW requires this)
  8. Visit http://lightcontrol.local (or the printed IP address) from any device on the same network to control the light

Roadmap

  • Port Node firmware to run on the ESP01's limited flash/pin count
  • Persist channel/pairing state across reboots
  • Multiple lights controlled from a single web page (currently one button pair per page)
  • Physical wall-switch input on each Node (manual override alongside wireless control)

What We Learned

This project pushed us into ESP-NOW instead of relying on typical MQTT/HTTP polling — it's much lower latency for local device-to-device control, but requires the two boards to already agree on a Wi-Fi channel, which took some debugging to get reliable across reboots.

Contributors

About

Decentralized home light control architecture powered by ESP32, ESP01, and ESP-NOW.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages