To monitor live sensor data and control the relays over internet there are lot of projects available on internet, in which this task is achieved with the assistance of 'Broker' like MQTT. This project uses 'CavyIoT' service and is an example of ' IoT project' without complexity of programming code.
Step1: Register your account at https://www.developers.cavyiot.com with your valid email id, it is free. Now login with your registered username and password. After login you have to verify your email. (After successful registration, within five minute you will get email verification code at registered email address). Once the verification is done, you will receive a 'Service-Id' for your IoT device ( here ESP-8266 dev. Board).
select 'Setting->ActivateIoT' menu which is at the upper left side of the page.
Activate IoT service for your device. Screen shots(with instructions in red) below are for your better understanding.
Cavy-IoT service for your named device is activated !
(Your Username, Password and Device are your CavyIoT-Credentials which you will need to replace in the c++ code).
, Step2:(If ESP8266 board in installed in your Arduino IDE Skip this step).
The ESP8266 community created an add-on for the Arduino IDE that allows you to program the ESP8266 using the Arduino IDE and its programming language.
Start Arduino and open Preferences window.
https://arduino.esp8266.com/stable/package_esp8266com_index.jsoninto Additional Board Manager URLs field. You can add multiple URLs, separating them with commas.
- Open Boards Manager from Tools > Board menu and find esp8266 platform.
- Select the version 2.4.0 from a drop-down box.
- Click install button.
- Don’t forget to select your 'NodeMCU 1.0 (ESP-12E Module)' board from Tools > Board menu after installation.
Step 3: make connections as below.
In the code below replace your wifi, wifi-password and CavyIoT-Credentials. Select your 'NodeMCU 1.0 (ESP-12E Module)' board from Tools > Board menu and upload the code.
Step 4: Login to the site https://www.developers.cavyiot.com, then select 'Setting->Control Panel' to access your default control panel.
Now you will have to define control signals so that your 'Control Panel' will work for the code which you just uploaded in step 3. For this Go to 'Setting->Edit Buttons'
Now your control panel is ready to interact with your device.
Done ! Now you can observe live sensor data , send control signals from anywhere in the world via this control panel.
Library CavyIoT.h with Example is at https://github.com/CavyAgrotronics/CavyIoT