I would like to present simple circuit which allow to control device via relay with usage of web server running on ESP8266 board. The main component is ESP8266 board which allow to run script in LUA language. This ESP8266 board is connected with relay module via pin headers. Here is relay module:
Coil of relay is driven by NPN transistor from GPIO16 pin (PIN0) of ESP8266 board. Here is schematic of relay module:
To ESP8266 board was uploaded code (init.lua) which do following things: - creates WiFi software access point with static IP address, - sets PIN D0 as output and proper state, - creates web server with simple HTML page which allow to control relay remotely.