In this tutorial, we will awning how to a body Wi-Fi-enabled, Internet-controlled about-face affiliated to EasyIoT Cloud with four relays and one ESP8266. We will use the Arduino IDE to affairs the ESP8266.
This Internet-connected about-face is a simplified adaptation of my ESP8266 internet affiliated switch. The affairs cipher is simplified — it’s not plug-and-play, with a hard-coded configuration, but it uses four relays instead of aloof one. You can calmly extend the program to ascendancy added relays with a distinct ESP8266. Relays can be controlled from anywhere in the apple — you aloof charge an Internet connection.
Devices can be controlled over the EasyIoT Cloud interface or the built-in Android application.
If you don’t accept any acquaintance and aren’t able to assignment with MAINS, I wouldn’t animate you to comedy around!
Do NOT use this after able ability about MAIN circuits and after a able FUSE.
Max accepted for solid accompaniment in this tutorial is 2A — acceptable for allowance ablaze only.
First, annals to EasyIoT Cloud. We will add DO modules manually. Go to Configure->Modules. If there are audience modules, you do not charge to delete them all. Press Add Module. Change the bore blazon to Digital Output DO (MT_DIGITAL_OUTPUT) and save it. It’s important to bethink the bore ID. If this is your aboriginal bore in your configuration, the bore ID should be 1. Next, add added DO modules, in our case three more, but it can be abased on your affairs and cardinal of relays.
The affairs is accounting in the Arduino ESP8266 IDE. Check out the Arduino ESP8266 IDE tutorial to see how to affix a ESP8266 bore to a computer to upload a program. The affairs can be downloaded from our GitHub. You will additionally charge the MQTT applicant library. Add this library to the library binder in the Arduino IDE. Our affairs uses the EasyIoT Cloud MQTT API.
In the program, change the EasyIoT Cloud username and password:
#define EIOTCLOUD_USERNAME “xxx”
#define EIOTCLOUD_PASSWORD “xxx”
Also, set up your Wi-Fi admission point name and password:
#define AP_SSID “xxx”#define AP_PASSWORD “xxx”
If you use altered DO pins than the absence D0, D1, D2, D3, change those pins.
In the program, additionally change the bore ID to accord to those in the user interface:
#define MODULE_ID_1 1
#define MODULE_ID_2 2
#define MODULE_ID_3 3
#define MODULE_ID_4 4
The easiest way to analysis affairs is to use an ESP8266 LUA bulge MCU board. Aloof affix it via USB anchorage and you can analysis the program. If you use this board, you can additionally uncomment #define DEBUG to see alter messages. The Flash on on the ESP8266 lath will assignment as a on to manually change about-face state. The onboard LED displays the about-face state.
In our case, we use NODEMCU ESP8266, but you can use any added blazon of ESP8266 with all pins exposed. In our program, we affix D0, D1, D2, and D3 in a circuit, which controls the relays. The relays are application 5V. ESP8266 is application 3.3V. To affix the 3.3V ESP8266 to the 5V broadcast module, we use one NPN transistor 2N2222. The affiliation is apparent below:
The GND is common, the ESP8266 is on 3.3V, and the broadcast bore is on 5V. You can use a broadcast bore with added relays (2, 4, 8).
And there’s your switch! As a note, modules can be manually renamed in EasyIoT Cloud agreement to clothing your needs!
How To Have A Fantastic Circuit Diagram Alternating Relay Switch With Minimal Spending | Circuit Diagram Alternating Relay Switch – circuit diagram alternating relay switch
| Welcome for you to my blog, with this period I am going to show you concerning circuit diagram alternating relay switch