Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
Aarush Sood
Published © GPL3+

Iot based mini home automation

Here I have made a little demonstration of my idea from my previous project(controlling led with esp8266) into app controlled lamp.

IntermediateProtip3 hours790

Things used in this project

Hardware components

Relay (generic)
×1
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Lamp Holder, B22d Lamps
Lamp Holder, B22d Lamps
×1
LED Light Bulb, Frosted GLS
LED Light Bulb, Frosted GLS
×1
ESP8266 ESP-12E
Espressif ESP8266 ESP-12E
×1

Software apps and online services

MIT App Inventor 2
MIT App Inventor 2
ThingSpeak API
ThingSpeak API

Story

Read more

Schematics

Complete circuit

Now you just need to click on 'Lamp on/off' ,but after clicking any one of them you need to wait for a few seconds(like 15 sec) as ThingSpeak is paid and we are using free version of it so there is some delay.

Output!!!

Code

Lamp on/off code

C/C++
Add the channel Id and API key from ThingSpeak!!!
#include <ESP8266WiFi.h>

WiFiClient  client;
unsigned long counterChannelNumber = 1446xx2;                // Channel ID
const char * myCounterReadAPIKey = "706NXxxxxxFFEG98JF4";      // Read API Key
const int FieldNumber1 = 1;                                 // The field you wish to read
const int FieldNumber2 = 2;                                 // The field you wish to read

void setup()
{
  pinMode(13,OUTPUT);
  Serial.begin(115200);
  Serial.println();

  WiFi.begin("wifi name", "password");    // write wifi name & password           

  Serial.print("Connecting");
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(500);
    Serial.print(".");
  }
  Serial.println();
  Serial.print("Connected, IP address: ");
  Serial.println(WiFi.localIP());
  ThingSpeak.begin(client);
}

void loop() 
{
 int A = ThingSpeak.readLongField(counterChannelNumber, FieldNumber1, myCounterReadAPIKey);
 Serial.println(A);
 digitalWrite(13,A);
}

Credits

Aarush Sood
5 projects • 9 followers
Technology enthusiast , ECE graduate from India. An electronics hobbyist who loves working with arduino's and esp's.

Comments