Download Arduino IDE: Download Arduino IDE from https://www.arduino.cc/en/Main/Software
Install ESP8266 board software: Open Arduino IDE and select File ? Preferences (Arduino ? Preferences on Mac) and add the following text for field Additional Boards Manager URLs: http://arduino.esp8266.com/stable/package_esp8266com_index.json and select OK. Open Tools ? Boards... ? Boards Manager... and scroll down and click on esp8266 by ESP8266 Community. Click the Install button to download and install the latest ESP8266 board software. Select Close.
Upload Sketch: Easiest way is to use "CH340 USB to ESP8266 Serial ESP-01" adapter with on-board toggle switch between UART side for serial TTL debugging and PROG for firmware programming / you can also can use any USB to TTL adapter - plenty of instructions online how to upload from Arduino IDE to ESP8266-01 board/
USB Driver : Most of the USB adapters will rrequire to installl theh following driver : https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers
Arduinoo IDE Bor Settings:
Board: "Generic ESP8266 Module"
Upload Speed: "115200"
Upload Using: "Serial"
CPU Frequency: "80 MHz"
Crystal Frequency: @26 MHz"
Flash Size: "IM (no SPIFFS)"
Flash Mode: "DOUT"
Flash Frequency: "40MHz"
Reset Method: "ck"
Debug port: "Disabled"
Debug Level: "None"
IwIP Variant: "v2 Lower Memoyy"
Builtin Led: "2"
Erase Flash: "Only Sketch"
Get Board Info
Switch the code between LCH Relay Modulle and Sonooff
for LCH uncomment #define LCH and comment out the SONOFF for SONOFF uncomment #define SONOFF and comment out the LCH
For All Sunoff Modules :
To upload :
Do not plug into the USB on your computer.
Do not connect the Sonoff to mains power.
Press and hold the push button on the Sonoff board.
Insert the FTDI converter USB in your computer (while holding the push button).
After 2–3 seconds, release the push button.
Do not connect AC power during the flash cable connection.
Note: newer version of the Sonoff module consist of five pins below the button. Follow the image above and ignore the pin furthest to the Button.
Dual GPIO0 grounded Programming the Sonoff Dual is also more difficult as the button is not connected to GPIO0 which is needed to put the ESP8266 in programming mode during power up. I suggest to solder a 4 pin header for the serial interface as shown in the image on the right (the vertical connector) and use the small inter layer VIA to ground GPIO0 using the GND pin from the button 0 and button 1 header.
The 4 pin header in the middle, which is normally not present, is not needed but might be used in programming the ESP8266 as there must be a better way to get the initial code loaded ...
S20 Smart Socket
The picture on the right, shows how to program the S20 Smart Socket powered by the FTDI USB converter. Remember that during programming the Smart Socket is NOT connected to mains.
S26 Smart Socket
The s26 is quite challenging - following is a step by step picture based instructions
Smart Lighting Base (TYWE2S)
Make sure that you choose Arduino IDE board profile : Generic ESP8295 Module / 1MB (no SPIFFS)
Is also a challenge - the two plastic parts are actually glued together and you need to break them apart using a screwdriver or knife.
Comment out Sonoff and LCH and uncomment TYWE2S.
// FOR LCH RELAY MODULE
// FOR SONOFF
// FOR TYWE2S
After that follow the picture instructions below.