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.
Contents
3. EasyIoT Cloud configuration
Introduction
Door/window sensor historical chart.
Materials
-ESP8266 WiFi module
ESP8266 ESP-01 Serial WIFI Wireless Transceiver Module | |
$2.11 | |
$17.00 |
ESP8266 ESP-03 Serial WIFI Wireless Transceiver Module | |
$2.07 | |
$2.15 |
ESP8266 ESP-12 Serial WIFI Wireless Transceiver Module | |
$2.06 | |
$1.75 |
ESP8266 ESP-05 Serial WIFI Wireless Transceiver Module | |
$1.88 |
ESP8266 ESP-07 Serial WIFI Wireless Transceiver Module | |
$2.18 | |
$1.88 |
ESP8266 Lua Nodemcu WIFI Network Development Board | |
$7.43 | |
$2.65 |
-Door/window magnetic switch
10 pcs MC-38 Wired Door Window Sensor Magnetic Switch | |
$3.19 | |
$7.00 |
-3.3V power supply (battery or regulator)
5pcs 3.3V regulator module 800mA | |
$1.12 | |
$1.56 |
2xAA 3V Battery Holder Box Case Wire | |
$0.99 | |
$0.99 |
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
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.
Hardware
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
Buying guide
To support this site and EasyIoT framework development please buy in our store.
Comments
sketch_apr29b:163: error: invalid conversion from 'const char*' to 'uint8_t {aka unsigned char}' [-fpermissive]
pinMode(INPUT_PIN, INPUT_PULLUP);
^
In file included from sketch\sketch_apr29b.ino.cpp:1:0:
RSS feed for comments to this post