×

CavyIoT for Developers

Index

  • Introduction
  • How it works
  • Getting Started (with your ESP8266)
  • Gauge Demo
  • Information about Control Panel and settings
  • Circuit diagram and example code for ESP8266
  • Introduction

       CavyIoT system is very easy to understand and with adequate knowledge of basic electronics like sensors, microcontroller, arduino, ESP-8266, Internet and programming language C and C++, developers can build and deploy any challenging IoT project of automation.

    How it works

    The following flow diagram illustrates the complete working of CavyIoT system:

    The main components of CavyIoT system are IoT-Device, Control Panel and CavyIoT Server.

    IoT-Device: The term IoT-Device in CavyIoT system means is an electronic device, which

  • is capable of reading live data from sensors.
  • is capable of uploading received data to CavyIoT server.
  • is capable of receiving Control Signal from the server, for remotely controlling relays of the system.
  • For example ESP-8266 development board has all this capabilities and is available in cheap price.

    Control Panel:

    It is a GUI based software accesiable over internet and is capable to monitor live data uploaded to server from the IoT-Device as well as, is also capable to send control signal for remotely controlling relays of 'IoT-Device'.
    On control panel you have canvas gauges and buttons. You can set gauge parameters of your choise for monitoring sensor data, you can set unit, min value, max value,steps, major ticks,minor ticks,highlights color. You can see Demo here.

        Similarly all the buttons also can be customized to send the control signal. When you click on the button, the label of button is send as Control Signal to your device.

    (The last control signal issued is displayed below the buttons on Control Panel)


    In button setting each button has 3 parameters as,

  • 'SUB' is the subject . And by default for four buttons are defined as from 'SUB1' to 'SUB4' as the first parameter.
  • ACT1 is second parameter, and it is for 'Action-1'
  • ACT2 is third parameter, and it is for 'Action-2'
  •     You can set these parameters meaningfully as per your requirement by selecting 'Edit Buttons' option in 'Settings Menu'. This is very useful when if your aim is to control electric device like bulb,fan, heater, blower and so on, with the help of external relays.
    For example,

         if the bulb is connected to the relay, and input of relay to the Pin D7 of 'ESP-8266'. In this case you may set subject as 'BULB', and controlling actions for the bulb are 'ON' and 'OFF' so you may set 'Act1' as 'ON' and 'Act2' as 'OFF'.

         After the setting done, with the help of this button on control panel. You can send the meaningful control signals 'BULB_ON' and 'BULB_OFF' to your IoT-Device (development board). You can process the received control signals to switch bulb 'ON' and 'OFF' by feeding the HIGH/LOW of your development boards Pin D7, at the related relay drivers input.


    CavyIoT Server:    Its role is like a mediator between IoT-Device and Control Panel. The 'IoT-Device' send sensor data to the server, for monitoring live data received and also receives Control Signal from the server for controlling its relays from remote location.


    CavyIoT service grants subscriber the permission, to access the 'control panel'. The control panel is for monitoring live data, as well as is for sending 'control signals ' from anywhere anytime, to his IoT-device through the internet .

    Getting Started

    Step 1-
    (Information about Control Panel and settings)

        Login first and then Activate IoT service. For activating IoT service Device Name and Service_id is required. Device name in combination with your username work as a key, to validate your 'IoT-Device' on CavyIoT server. It is unique and cannot be changed.
         Device name('IoT-Device') is required for programming ESP-8266 so as to communicate with CavyIoT server.


    Activate IoT service (Screenshots)-


    Screenshot-1

    Screenshot-2

    Screenshot-3

    Screenshot-4

    Screenshot-5

    Screenshot-6



         As per last screenshot the control panel for your named device is ready to interact with your device (eg:ESP-8266). The objective of 'Remote Control Panel' is to display data received from IoT device, and if the user clicks button on the control panel then is to send control signal to the IoT device.
    The procedure of sending 'sensor data' to server for 'data visualization' in 'Remote control panel', and receiving 'control signal' for the device is possible with a 'few lines of code in (c++)'.


        From the step wise screenshot given below, You will be more clear about the setting of the meaningful parameters for buttons, which are intented to work with an Example code.
        An Example code below is for monitoring live temperature, humidity and for controlling Four LED using CavyIoT service via control panel.


    Edit Buttons (Screenshots)



    Screenshot-1

    Screenshot-2

    Screenshot-3

    Screenshot-4



    Step-2

    (Circuit diagram and example code for ESP-8266)



    See Tutorials here.
  • Connection Details and Control panel for the example code-


  • Remote Control panel IoT-device


  • Click to download CavyIoT library with an example code


  • #include "CavyIoT.h"
    #include "DHT.h" // including the library of DHT11 temperature and humidity sensor
    CavyIoT myIoTdevice; 
    DHT dht(D3, DHT11);
    #define LED1 D5
    #define LED2 D6
    #define LED3 D7
    #define LED4 D8 
    void setup()
      {
      pinMode(D5, OUTPUT);
      pinMode(D6, OUTPUT);
      pinMode(D7, OUTPUT);
      pinMode(D8, OUTPUT);
      digitalWrite(LED1, LOW);
      digitalWrite(LED2, LOW);
      digitalWrite(LED3, LOW);
      digitalWrite(LED4, LOW);
      Serial.begin(9600);  
      WiFi.begin("WifiSSID","WiFiPASSWORD");//Internet access
       while (WiFi.status() != WL_CONNECTED)
           {
            delay(500);
            Serial.print(".");            
            }  
      myIoTdevice.begin("username","password","device"); //CavyIoT credentials
      dht.begin();
       }
    
    void loop() {
     
      if(myIoTdevice.Update("temp",dht.readTemperature(),"humi",dht.readHumidity())!=ERROR)
        { 
        if( myIoTdevice.Button(0)=="LED1_ON"){ digitalWrite(LED1, HIGH); }else { digitalWrite(LED1, LOW); }
        if( myIoTdevice.Button(1)=="LED2_ON"){ digitalWrite(LED2, HIGH); }else { digitalWrite(LED2, LOW); }
        if( myIoTdevice.Button(2)=="LED3_ON"){ digitalWrite(LED3, HIGH); }else { digitalWrite(LED3, LOW); }
        if( myIoTdevice.Button(3)=="LED4_ON"){ digitalWrite(LED4, HIGH); }else { digitalWrite(LED4, LOW); }
        }
        else{
            Serial.println("communication failure !");
            }
       delay(5000);//Delay must be 5000 ,if it less than 5000 server may block your account
      }//End of loop
    

    Contact CavyIoT

    Thanks for your interest in CavyIoT. Please provide us with your business contact details and we will get back to you as soon as we can regarding your request.

    Contact Us







    Welcome to CavyIoT !
    Contact for business enquiry.