ESP8266 timer switch

Here are the instructions for building an ESP8266 timer switch for controlling an AC load connected to a wall socket. It uses an ESP-01 module which is programmed to act as a digital ON/Off timer and controls an external relay circuit. The relay circuit must be isolated from the ESP-01 module using an opto-coupler circuit to prevent any electromagnetic interference from the relay coil which may cause reseting of the ESP8266 device.