A Person Who Never Made A Mistake Never Tried Anything New.
- Albert Einstein


Accelerometer Sensor Realtime vehicle running Status

Cloud Data Update and Theft monitoring






___________________________________________________________________________________________________________________

#1 Cloud Registration and IOT Web Panel


Elins Technolgies is providing cloud services to create IIOT based applications. These services are free, in order to use these services, register on Elins Cloud Server page as discussed in steps below:

Step1: Click on this icon to register :



Step2: For Registration enter your "Name" and your "email ID".

Step3: Click on "Submit" button.







This is Services page of Elins Cloud Server. Here You can select which Sensor based IIOT Ecosystem Service you wants to use, on this page, you can click on any Icon to open its IIOT Web Panel:







Watch this Video to see the Registration Process:








If you are already Registered User then Login directly through process explained below:

Step1: Click on this icon to Login :



Step2: For Login enter your "Id" which you have recieved after Registration.

Step3: Click on "Submit" button.







This is IIOT Web Panel to see Real-Time vehicle running Status :







Watch this Video to see the Login process:






___________________________________________________________________________________________________________________


#1 Hardware Connections


Accelerometer Hardware connection with Arduino:
Arduino -----Accelerometer
5v ----- Vcc
GND ----- GND
A0 ----- X-axis (Xout)




___________________________________________________________________________________________________________________


#3 Code Explain


NodeMCU required a code to communicate with the cloud server. Let us discuss this code in detail.

Cloud Arduino code: elins_edu_axis_code1.zip, Download it from link below:

Unzip the file and open the .INO file





Tutorial for Accelerometer sensor Code Explain | IOT Learning Kit | Elins Cloud |



This is the Code of NodeMCU to communicate with Elins Cloud Server.


#include < Arduino.h >
#include < ESP8266HTTPClient.h >
#include < ESP8266WiFi.h >

#define LED D0 // DECLARE LED TO PIN D0 (ON BOARD LED)
#define xInput A0 // DECLARE xInput TO PIN A0 (X AXIS OF ACCELEROMETER SENSOR IS TO ANALOG PIN A0)

const char* ssid = "Elins Tech."; // PUT SSID OF YOUR WIFI HERE
const char* password = "jaimatadi21"; // PUT PASSWORD OF YOUR WIFI HERE

// initialize minimum and maximum Raw Ranges for each axis
int RawMin = 0;
int RawMax = 1023;
int xRaw;

// Take multiple samples to reduce noise
const int sampleSize = 10;

// Take samples and return the average value
int ReadAxis(int axisPin)
{
   long reading = 0;
// reading = analogRead(axisPin);
   delay(1);
   for (int i = 0; i < sampleSize; i++)
   {
   reading += analogRead(axisPin);
   }
   return reading/sampleSize;
}


void setup() {
      delay(5000);
      Serial.begin(9600); // INITIALIZE UART SERIAL MONITOR TO DISPLAY EVENTS
      pinMode(LED,OUTPUT); // DECLARE LED PIN AS OUTPUT PIN
      digitalWrite(LED,0); // INITIALIZE LED PIN WITH 0 - ON LED

      Serial.println();
      Serial.println();
      Serial.println();

      WiFi.begin(ssid,password); // START WIFI CONNECTION WITH SSID PASSWORD
      Serial.print("[CONNECTING] WAIT ...");

      while (WiFi.status() != WL_CONNECTED) // WAIT TILL WIFI IS CONNECTED
      {
         delay(100);
         Serial.print(".");
      }

      Serial.println("WIFI CONNECTED SUCCESSFULLY");

         xRaw = ReadAxis(xInput); //TAKE FIRST READING

}

String payload="";
String DeviceId="juvinagrawal651"; // CHANGE IT WITH DEVICE ID RECEIVED FROM CLOUD
HTTPClient http;

int pos;

void loop(){


   //ACCELEROMETER CODE TO FIND RUNNING STATUS OF VEHICLE
   int xRawP = ReadAxis(xInput);
   int xRawN = xRawP - xRaw;


   Serial.print("X :: ");
   Serial.println(xRawN);
   xRaw = xRawP;

   if((xRawN>=-12)&&(xRawN<=12))
   {
      Serial.println("Standing Vehicle");
      pos=0;
   }
   else
   {
      Serial.println("Moving Vehicle");
      pos=1;
   }


// CODE TO UPLOAD SENSOR DATA ON ELINS CLOUD
if(WiFi.status() == WL_CONNECTED)
{
   String URL = "";
      URL = URL + "http://elinstechnologies.com/netobox_v1/http_axis_device.php?id=" + DeviceId + "&pos=" + pos; // CLOUD URL
      http.begin(URL); // MAKE HTTP CONNECTION WITH CLOUD
      http.addHeader("Content-Type", "application/x-www-form-urlencoded"); // SPECIFY CONTENT-TYPE HEADER
      int httpCode = http.GET(); // SEND HTTP GET REQUEST TO CLOUD
      payload = http.getString(); // RESPONSE FROM CLOUD
      Serial.println(payload); // PRINT PAYLOAD
      http.end(); // Close connection


            // BLINK LED TO INDICATE ONE CYCLE OF HTTP REQUEST
            digitalWrite(LED,1);
            delay(500);
            digitalWrite(LED,0);
            delay(500);
            digitalWrite(LED,1);
            delay(500);
            digitalWrite(LED,0);
            delay(500);
}

delay(500);
// END OF CODE
}



___________________________________________________________________________________________________________________


#4 Working Demo


We have completed following steps upto now:
# Elins Cloud Registration (Got IIOT Web Panel from it).
# Cloud Arduino Device Code (NodeMCU is ready and communicating with Elins Cloud)

Now Let us RUN the complete IOT Ecosystem all together. For this follow the steps below:


Step1: Click on this icon to Login :



Step2: For Login enter your "Id" which you have recieved after Registration.

Step3: Click on "Submit" button.




This is IIOT Web Panel to see Realtime vehicle running Status Cloud Data Update and Theft monitoring using accelerometer sensor :







Step4: Give Power supply to IOT Kit, Now device LED is blinking, it means device connected with internet.Now real-time data will be displayed on this IIOT Web Panel. To see How this IIOT Ecosystem Work all together, watch this video :




Working Demo Accelerometer Sensor with Elins Cloud | IOT Learning Kit Extension Board | Elins Technologies



Step5: So in this way, real time data will be displayed on this IIOT Web Panel.

For next tutorial, Click NEXT.




We hope you enjoyed and learn properly how to create

complete IOT Ecosystem.



for any doubt or query email us at info@elinstechnologies.com

or Whatsapp us










# IOT LEARNING KIT




IOT Learning Kit is a development board based on NodeMCU. IOT Learning Kit Includes:
1. NodeMCU.
2. NodeMCU Board with Relay.
3. Extension Board.
4. DHT11 Temperature and Humidity Sensor.
5. Infrared Sensor.
6. SR04 Ultrasonic Sensor.
7. LDR Sensor



Actual Price : Rs.2999
For Now : Rs.1999 Only
Free Delivery
For Details: Whatsapp at +91-8750853539