You are on page 1of 9

Cross Platform IoT System Using Artificial Intelligence

Introduction
Internet of things is a growing network of everyday object-from industrial machine to consumer
goods that can share information and complete tasks while you are busy with other activities.
With advancement of technology, life is getting simpler and easier in all aspects. Home
automation is becoming popular day by day due to numerous advantages. In an industrial setting,
IIoT is key to processes such as predictive maintenance (PdM), enhanced field service, energy
management and asset tracking. Till now the current development shows that the home
automation system is managed by Emails, texts or some other applications. Significant
investments made by the research community and the industry in the Smart Home space has been
a prime focus with the introduction of devices such as Amazon Echo, Google Home, and
Samsung Smart Things among others.

Detailed Problem Statement and Proposed Solution


Lack of resources established in the present world is initiating everyone towards energy efficient
technologies. It is the necessity to manage the consumption of power due to limited availability
of resources. Furthermore, we saw many home automation technologies introduced over these
years from Zigbee automation to Amazon Echo, Google Home and HomeKit from Apple.
Amazon Echo Dot price is around 4,199₹ with an additional cost of the devices to be connected
to, the total cost of the system reaches over 12,000₹. Apple Home Kit too is pretty more
expensive 24,000₹ basic setup. So, the aim should be to design a cost-effective smart device
which supports in recognizing & eliminating the misuse of electricity.

Uniqueness of the Project


The specific feature of this project is adding Artificial Intelligence enabled Amazon Alexa as an
interface between the user and Cloud IoT platform. Amazon's Alexa voice assistant works really
well on its own, but you can greatly expand the assistant's capabilities by connecting it with the
"If This Then That" (IFTTT) protocol to make specific Applets that "bring different services
together" by connecting up devices and IoT platforms.
Block Diagram

Block Diagram Description


The proposed Cross platform IoT device is suitable for both Industry and Smart Home
Automation. In the industry point of view, we would like to choose Adafruit.IO as our cloud
platform which uses MQTT protocol to communicate with the IoT devices to acquire all the
sensors data and to send user commands. Amazon Echo Dot connects to Alexa – a cloud-based
voice service which is used to control smart home devices with user voice commands. Similarly,
Google Assistant connects to Ok Google cloud services. We want to use these devices as an
interface between various IoT platforms and smart devices. Therefore, we combined IFTTT (If
This Then That) with Amazon web services to create Applets that bring all platforms together.
The Cross Platform IoT device is designed using a Lolin NodeMCU V3, an open source IoT
platform. The NodeMCU microcontroller is integrated with Wi-Fi (ESP8266) from Espressif and
provides GPIO, I2C, PWM pins to interface various sensors and actuators for automation. This
NodeMCU acts as a MQTT broker to publish the sensor data and subscribe feed data from
Adafruit.IO. We can easily switch on and off our appliances up to 10A per channel which allows
us to control a wide range of home appliances or Industrial equipment from anywhere in the
world with the Adafruit.IO. This can be done by installing the IoT Device under any existing
power socket.
Software and Cloud Platform Used

IFTTT is an online service that automates Web-based tasks so that when user-specified events
occur, follow-up tasks are triggered and handled.
MQTT is a publish/subscribe, extremely simple and lightweight messaging protocol which is
ideal for the emerging “machine-to-machine” or “Internet of Things” world of connected devices
where bandwidth and battery power are at a premium.
Adafruit.IO is a cloud service – that makes any project internet connected and displays our data
in real-time by helping our project to connect to other internet enabled devices.

Hardware Used

Amazon Echo Dot is a hands-free smart speaker that is controlled over voice. It connects to
Alexa – a cloud based voice service which is used to control smart home devices, play music,
and set “Routines” to control our devices at scheduled times or with a single voice command.
Lolin NodeMCU V3 is an open source IoT platform-based firmware for the ESP8266 WiFi SOC
from Espressif. The NodeMCU Integrates GPIO, PWM, IIC, 1-Wire and ADC on to a single
board.
Solid State Relay is an electromagnetic switch operated by a relatively small electric current that
can turn on/off individual or group of high-current A.C Home appliances.

TA12-100 is a non-invasive sensor for measuring alternating current. This split-core type of
sensor can be clipped around either a live or a neutral wire (Used for monitoring power
consumption).
The MQ-135 Gas sensor makes it easy to monitor ammonia, benzene, Methane, CO2
concentrations and alcohol air concentration levels using our I2C Mini Module form factor.
BME680 from Bosch contains temperature, humidity, barometric pressure, and VOC gas sensing
capabilities in the environment in one small package.
A passive infrared sensor (PIR sensor) is an electronic sensor that measures infrared (IR) light
radiating from objects in its field of view and triggers a high logic output.

References
1. Dr. Sneha Matriaya, Dr. Ravindra Purwar, Voice Controlled Home Automation Using
Amazon Echo Dot, IOSR Journal of Computer Engineering (IOSR-JCE), e-ISSN:
22780661, p-ISSN: 2278-8727, Volume 20, Issue 3, Ver. III (May. - June. 2018), PP 16-
19.
2. IFTTT: https://ifttt.com/discover
3. https://www.pocketlint.com/SmartHome/SmarHomenews
4. https://learn.adafruit.com/adafruit-io/mqtt-api
5. IoT: https://internetofthingsagenda.techtarget.com/definition /IoT-device
6. https://www.ijarnd.com/manuscripts/v3i3/V3I3-1257.pdf
Speed Monitoring with SMS Alert

 Ublox - Arduino
 GND - GND
 TX - Digital pin (D3)
 RX - Digital pin (D4)
 Vcc - 3.3 V

Code for Speed Detection:

#include <TinyGPS++.h>
#include <SoftwareSerial.h>

static const int RXPin = 4, TXPin = 3;


static const uint32_t GPSBaud = 9600;

// The TinyGPS++ object


TinyGPSPlus gps;

// The serial connection to the GPS device


SoftwareSerial ss(RXPin, TXPin);

void setup(){
  Serial.begin(9600);
  ss.begin(GPSBaud);
}
void loop(){
  // This sketch displays information every time a new sentence is correctly encoded.
  while (ss.available() > 0){
    gps.encode(ss.read());
    if (gps.location.isUpdated()){
      // Latitude in degrees (double)
      Serial.print("Latitude= ");
      Serial.print(gps.location.lat(), 6);      
      // Longitude in degrees (double)
      Serial.print(" Longitude= ");
      Serial.println(gps.location.lng(), 6);
    
      // Raw latitude in whole degrees
      Serial.print("Raw latitude = ");
      Serial.print(gps.location.rawLat().negative ? "-" : "+");
      Serial.println(gps.location.rawLat().deg);
      // ... and billionths (u16/u32)
      Serial.println(gps.location.rawLat().billionths);
   
      // Raw longitude in whole degrees
      Serial.print("Raw longitude = ");
      Serial.print(gps.location.rawLng().negative ? "-" : "+");
      Serial.println(gps.location.rawLng().deg);
      // ... and billionths (u16/u32)
      Serial.println(gps.location.rawLng().billionths);

      // Raw date in DDMMYY format (u32)


      Serial.print("Raw date DDMMYY = ");
      Serial.println(gps.date.value());

      // Year (2000+) (u16)


      Serial.print("Year = ");
      Serial.println(gps.date.year());
      // Month (1-12) (u8)
      Serial.print("Month = ");
      Serial.println(gps.date.month());
      // Day (1-31) (u8)
      Serial.print("Day = ");
      Serial.println(gps.date.day());

      // Raw time in HHMMSSCC format (u32)


      Serial.print("Raw time in HHMMSSCC = ");
      Serial.println(gps.time.value());

      // Hour (0-23) (u8)


      Serial.print("Hour = ");
      Serial.println(gps.time.hour());
      // Minute (0-59) (u8)
      Serial.print("Minute = ");
      Serial.println(gps.time.minute());
      // Second (0-59) (u8)
      Serial.print("Second = ");
      Serial.println(gps.time.second());
      // 100ths of a second (0-99) (u8)
      Serial.print("Centisecond = ");
      Serial.println(gps.time.centisecond());

      // Raw speed in 100ths of a knot (i32)


      Serial.print("Raw speed in 100ths/knot = ");
      Serial.println(gps.speed.value());
      // Speed in knots (double)
      Serial.print("Speed in knots/h = ");
      Serial.println(gps.speed.knots());
      // Speed in miles per hour (double)
      Serial.print("Speed in miles/h = ");
      Serial.println(gps.speed.mph());
      // Speed in meters per second (double)
      Serial.print("Speed in m/s = ");
      Serial.println(gps.speed.mps());
      // Speed in kilometers per hour (double)
      Serial.print("Speed in km/h = ");
      Serial.println(gps.speed.kmph());

      // Raw course in 100ths of a degree (i32)


      Serial.print("Raw course in degrees = ");
      Serial.println(gps.course.value());
      // Course in degrees (double)
      Serial.print("Course in degrees = ");
      Serial.println(gps.course.deg());

      // Raw altitude in centimeters (i32)


      Serial.print("Raw altitude in centimeters = ");
      Serial.println(gps.altitude.value());
      // Altitude in meters (double)
      Serial.print("Altitude in meters = ");
      Serial.println(gps.altitude.meters());
      // Altitude in miles (double)
      Serial.print("Altitude in miles = ");
      Serial.println(gps.altitude.miles());
      // Altitude in kilometers (double)
      Serial.print("Altitude in kilometers = ");
      Serial.println(gps.altitude.kilometers());
      // Altitude in feet (double)
      Serial.print("Altitude in feet = ");
      Serial.println(gps.altitude.feet());

      // Number of satellites in use (u32)


      Serial.print("Number os satellites in use = ");
      Serial.println(gps.satellites.value());

      // Horizontal Dim. of Precision (100ths-i32)


      Serial.print("HDOP = ");
      Serial.println(gps.hdop.value());
  }
 }
}

Sim 900A Module to send messages with triggers:

 AT+CMGF=1 // Set the GSM module in text mode


AT+CMGS=\"+YYxxxxxxxxxx\"\r // Input the mobile number| YY is country code
“the message” with stopping character (char)26 // ASCII of ctrl+z
AT+CMGF=1 // Set the GSM Module in text mode
AT+CNMI=2,2,0,0,0 // AT Command to receive live sms

#include <SoftwareSerial.h>
SoftwareSerial mySerial(9, 10);
void setup()
{
  mySerial.begin(9600);   // Setting the baud rate of GSM
  Serial.begin(9600);    // Setting the baud rate of Serial Monitor
delay(100);
}
void loop()
{
  if (Serial.available()>0)   
switch(Serial.read())  
{    
case 's':       SendMessage();       break;    
case 'r':       RecieveMessage();       break;  
}
 if (mySerial.available()>0)   
Serial.write(mySerial.read());

void SendMessage()

mySerial.println("AT+CMGF=1");    //Sets the GSM Module in Text
delay(1000);  // Delay of 1000 milli seconds or 1
mySerial.println("AT+CMGS=\"+91xxxxxxxxxx\"\r");
// Replace x with mobile number  
delay(1000);  
mySerial.println("I am SMS from GSM Module");
// The SMS text you want to send  
delay(100);   
mySerial.println((char)26);
// ASCII code of CTRL+Z  
delay(1000);
}

void RecieveMessage()

mySerial.println("AT+CNMI=2,2,0,0,0");
// AT Command to receive a live SMS  
delay(1000);  

You might also like