In this tutorial we will show how to build WiFi door/window sensor connected to EasyIoT Cloud. We will use ESP8266, magnetic switch and Arduino IDE.
Door/window sensor historical chart.
-ESP8266 WiFi module
|ESP8266 ESP-01 Serial WIFI Wireless Transceiver Module|
|ESP8266 ESP-03 Serial WIFI Wireless Transceiver Module|
|ESP8266 ESP-12 Serial WIFI Wireless Transceiver Module|
|ESP8266 ESP-05 Serial WIFI Wireless Transceiver Module|
|ESP8266 ESP-07 Serial WIFI Wireless Transceiver Module|
|ESP8266 Lua Nodemcu WIFI Network Development Board|
-Door/window magnetic switch
|10 pcs MC-38 Wired Door Window Sensor Magnetic Switch|
-3.3V power supply (battery or regulator)
|5pcs 3.3V regulator module 800mA|
|2xAA 3V Battery Holder Box Case Wire|
See buying guide at the end of tutorial for details.
EasyIoT Cloud configuration
Register to EasyIoT Cloud service. If you do not receive registration email check spam folder. If it's not there contact us and we will activate your account.
No EasyIoT Cloud configuration is needed - module is Plug And Play. We need just security token to connect to EasyIoT Cloud. Go to Configure->Tokens and press button Add token. Remember this token - you will need this token later in program. If you remove token from you account later module will stop sending values to EasyIoT Cloud. One token can be used with more than one device.
Program is written in Arduino ESP8266 IDE. See Arduino ESP8266 IDE tutorial how to connect ESP8266 module to computer to upload program. Program is available at our GitHub. You will also need EIoTCloudRestApi library V1.0. Instructions how to install EIoTCloud REST V1.0 are here.
In program set access point name and password and security token we generated before.
#define AP_USERNAME "xxx"
#define AP_PASSWORD "xxx"
#define TOKEN "xxx"
If you are change GPIO pin on ESP8266 then also change GPIO pin in program.
In our case we use NodeMcu ESP8266, but you can use any other ESP8266 with FDTI programmer. For power supply you can use 2 AA batteries or 3.3V regulator (see buying guide).
One wire of magnetic switch connect to GPIO5 and other to ground and that's it.
See more tutorials at http://iot-playground.com/build
To support this site and EasyIoT framework development please buy in our store.