IoT Power Strip

The device that allows to turn on/off two pairs of the outlet sockets via Web browser through Wi-Fi. Based on ESP8266 and Arduino Mini.

Similar projects worth following
IoT Power Strip is a DIY device that allows to turn on/off two pairs of the outlet sockets via Web browser through Wi-Fi.
It doesn't require any infrastructure besides the Wi-Fi enabled device with HTTP browser (e.g.: smartphone, tablet, laptop). That means that you don't need some IoT server to be installed in your intranet (like MQTT server or Web Server), you even don't have to have internet access to operate the IoT Power Strip.

The software features:
* Operate secondary controller ports through Web Interface;
* HTTP Server with optional authentication for 2 users;
* Wi-Fi configurable through Web interface (both connecting to existing Wi-Fi network and creating a new Wi-Fi AP with the option of disabling AP on successfull connectin to Wi-Fi network);
* In AP mode all the DNS queries are resolved to ESP8266 IP address;
* Ports Control UI configurable via Web UI;
* Send raw UART commands through Web interface;
* Built-in IDE for editing the software through

A year ago I decided to make a simple device with a web interface for reliably turning on/off a couple of mains sockets via Wi-Fi. I thought that ESP-01 (having GPIO0 and GPIO2 available), and 2-channel Relay Module would be enough for that, and with NodeMCU writing a software would be not a problem at all.

During the prototyping of the device, the set of requirements were expanded a little:

  • Wi-Fi shall be configurable through Web Interface (both Access Point (AP) and connection to another Wi-Fi network). Setting up Wi-Fi shall not turn on/off the mains sockets.Ssuch a trivial thing like moving Power Strip from one place (with one Wi-Fi network) to another (with another Wi-Fi network or without it) shall not prevent re-setting Wi-Fi with the Web UI;
  • The device shall work even without Wi-Fi network available (detect it during start up, and turn on th AP where a smartphone can connect);
  • Some functions of UI shall be accessible to admin only, some - to user (2 security roles); the credentials shall be configurable through Web UI;
  • Controls for turning on/off shall be configurable through Web interface;
  • Web IDE shall exist for quick fixing / small enhancements. Web IDE shall work without Internet access (ad-hoc intranet created by ESP8266 AP shall be enough).

The requirements (especially the requirement about ports state reliability) influenced not only the software, but the hardware.
At first it turned out, that my ESP-01 instance may restart itself if I touch any wire (including GND and the output contacts of the relay module). I thought that there is something wrong with my ESP module, and replaced it with another one, but the second module behaved the same. After quickly browsing ESP-related Internet resources and checking the wiring, I found that I am probably unique to have this problem (it seems that ESP8266 just confused me with Mr. Bean, and acted accordingly).
Secondly, I found that http server can easily run out of memory when handling several requests simultanously, and restart as the result (under NodeMCU 0.9.5 with about 22k of RAM available for lua).
And last but not least, I didn't want the ports state to be changing when I will be playing with the lua software in runtime via Web IDE.
I hope that the reasons mentioned above answer the potential quetion you might have: "Why did you overkill the schema with the Arduino board in addition to the ESP8266 which itself could do everything?". IMHO an extra cheap Arduino Mini clone is a fair price for extra runtime hackability.

The project is open source, it is not hard to reproduce (especially if you own a 3D printer and necessary skills), and the components are achievable and relatively cheap.

View all 9 components

View all 2 project logs

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates