Overview of the Series

Warnings:

  • Not that simple, it is full stack.
  • IoT Not necessarily required
  • Think on your feet
  • Lots of Holes
  • Think of the problem at hand

Good Things:

  • Get a feel of complete Stack
  • Learn a lot
  • Be able to make a decision
  • Build something cool

The IoT Architecure

The Devices

The Connectivity

The Cloud and the Internet

We have the Data? Now what

Concrete Examples

Example 1

A simple IOT demo with Explore ESP8266

#include <DHT.h>
#include <Wire.h>
#include <ESP8266WiFi.h>
#include "font.h"
#define offset 0x00    // SDD1306                      // offset=0 for SSD1306 controller
//#define offset 0x02    // SH1106                       // offset=2 for SH1106 controller
#define OLED_address  0x3c

String apiKey = "things_speak_api_key";
char ssid[20] = "wifi ssid";
char password[20] = "wifi password";

char TempValue[15];
String str;

const char* server = "api.thingspeak.com";
#define DHTPIN 5 // what pin we're connected to
DHT dht(DHTPIN, DHT11,15);

WiFiClient client;

void setup() {
  Serial.begin(115200);             // for debugging
  Wire.begin(0,2);                                // Initialize I2C and OLED Display
  init_OLED();                                    
  reset_display();
  clear_display();
  delay(10);

  sendStrXY("Connecting to ",0,0);
  sendStrXY(ssid, 3, 0);
  // Setup the Internet
  WiFi.begin(ssid, password);
  int pos  = 0;
  while (WiFi.status() != WL_CONNECTED) {

    delay(500);
    pos++;
    sendStrXY(".", 5, pos);
  }

  sendStrXY("connected", 5, 0);
  clear_display();
  delay(100); 
  
  //Setup the display Screen
  sendStrXY("Explore Embedded" ,0,0);
  sendStrXY("Temp:",3,0);
  sendStrXY("Humidity:",4,0);
  sendStrXY("InternetOfThings",7,0);
  
}

//String TempValue;

void loop() {

       float h = dht.readHumidity();
       float t = dht.readTemperature();
       char tvalue[5], hvalue[5];
       if (isnan(h) || isnan(t)) {
        Serial.println("Failed to read from DHT sensor!");
        return;
      }

    
         str = String(t);
         str.toCharArray(tvalue,15); 
         sendStrXY(tvalue,3,10);

         str = String(h);
         str.toCharArray(hvalue,15); 
         sendStrXY(hvalue,4,10);

         if (client.connect(server,80)) {  //   "184.106.153.149" or api.thingspeak.com
              String postStr = apiKey;
                     postStr +="&field1=";
                     postStr += String(t);
                     postStr +="&field2=";
                     postStr += String(h);
                     postStr += "\r\n\r\n";
           
               client.print("POST /update HTTP/1.1\n"); 
               client.print("Host: api.thingspeak.com\n"); 
               client.print("Connection: close\n"); 
               client.print("X-THINGSPEAKAPIKEY: "+apiKey+"\n"); 
               client.print("Content-Type: application/x-www-form-urlencoded\n"); 
               client.print("Content-Length: "); 
               client.print(postStr.length()); 
               client.print("\n\n"); 
               client.print(postStr);
                     
           
               Serial.print("Temperature: ");
               Serial.print(t);
               Serial.print(" degrees Celcius Humidity: "); 
               Serial.print(h);
               Serial.println("% send to Thingspeak");    
            }
            client.stop();
             
            Serial.println("Waiting...");    
            // thingspeak needs minimum 15 sec delay between updates
            delay(20000);  
     

}

Example 2: Air Quality Egg

Resources

Example 3: Starling

Resources

Explore IoT Kit

IoT the Hackers way

Setting up the ESP8266 with Arudino

Reading Temperature and Humidity

How?

Low cost stuff!

ESP8266

Custom Cloud

 

IoT the Hackers way

By Sandeep Patil

IoT the Hackers way

  • 564