Skip to content

Sonoff, VSCode, ESP8266, IOT

Another Amazon sale, another opportunity. This time is was a 4 pack of basic Sonoff switches. These are $5 boxes controlling a relay via Wifi meaning an app or Alexa. They run off of, and switch, 90-240 VAC and use an ESP8266 for the smarts and radio. As they are easy to take apart and access the ESP and they are cheap, they make good targets for modification and extension, and learning. One example is the Tasmota project

“Provide ESP8266 based Sonoff by iTead Studio and ElectroDragon IoT Relay with Serial, Web and MQTT control allowing ‘Over the Air’ or OTA firmware updates using Arduino IDE.

What you do is to solder a four or five pin header to the circuit board in order to attach a USB to Serial cable. Then you can run the Arduino IDE to update the firmware. Another option is to use PlatformIO with the VSCode IDE,

VSCode or Visual Studio Code is an interesting study itself. Microsoft released it in 2015 as cross platform FOSS (Wikipedia).  The Tasmota Wiki provides step by step instructions. Other ideas raise the question about what compiler the Tasmota process is using. See 

Programming ESP8266 using Visual Studio Code with Arduino Extension by Yoppy Chia

Install the IDE PlatformIO extension for Visual Studio Code (VSCode): Windows, 32-bit Linux

Installing Visual Studio Code for ESP8266

You can start with just using the Sonoff as-is and follow the instructions to set up the eWeLink app or Alexa Skill. From there, the sky’s the limit. Setting up Tasmota and an MQTT system has good step by step instruction as a paved road. That will set you up for code modification or creation and ESP8266 application development. Then you can start to learn about the Integrated Development Environments. And that just a start.