In this tutorial we will show how to build WiFi internet connected switch connected to EasyIoT Cloud. We will use ESP8266, solid state relay and Arduino IDE. Switch can be controlled by WEB application, native Android application or button.
Improved version of this switch can be found here:
This internet switch is “plug and play” – it will automatically set all EasyIoT Cloud settings, so no configuration in EasyIoT Cloud is needed.
Material for switch cost about 5$.
WARNING!! You will play with LIVE MAINS!! Deadly zone!!
If you don’t have any experience and are not qualified for working with MAINS power I will not ecourage you to play arround! Do NOT use it without proper Knowledge about MAINS circuits ! Do NOT use it without a proper FUSE on MAINS line! Max current for solid state in this tutorial is 2A – suitable for room light only.
Step 1: Material
- ESP8266 WiFi module
- Solid State Relay 2A 240V
- 3.3V 600mA AC-DC step down module
- Push Button switch
- NPN Transistor TO-92 2N2222
- 1000uF electrolytic capacitor
- resistor, 1K, 47K
Click to buying guide for ESP8266 internet connected swith.
Step 2: EasyIoT Cloud Registration
Register to EasyIoT Cloud. You will need username and password later in program. Also use username and password to access EasyIoT Cloud and control your device from computer or mobile phone. Also EasyIoT Cloud Android application is available.
Step 3: Program
Program is written in Arduino ESP8266 IDE. See Arduino ESP8266 IDE tutorial how to connect ESP8266 module to computer to upload program. Program can be downloaded from GitHub. You will also need MQTT client library. Add this library to library folder in Arduino IDE. Program uses EasyIoT Cloud MQTT API.
In program change following lines to set access point username and password and your EasyIoT Cloud username and password:
#define AP_SSID “xxx”
#define AP_PASSWORD “xxx”
#define EIOTCLOUD_USERNAME “xxx”
#define EIOTCLOUD_PASSWORD “xxx”
Read more: ESP8266 – 5$ internet connected switch