Dhairya Parikh
Published © LGPL

Smart Energy Saver for Your Home

My aim is to minimize the loss of electricity there is when people forget to switch off their fans or lights, through smart home solution.

BeginnerFull instructions provided2 hours25,568
Smart Energy Saver for Your Home

Things used in this project

Hardware components

Photon
Particle Photon
×1
Arduino UNO
Arduino UNO
I just used it for powering my 5V relay , you can even use a breadboard power supply.
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Android device
Android device
×1
Breadboard (generic)
Breadboard (generic)
×1
Relay Module (Generic)
×1
Micro-USB to USB Cable (Generic)
Micro-USB to USB Cable (Generic)
To power the Particle Board
×1

Software apps and online services

Blynk
Blynk
Particle Build Web IDE
Particle Build Web IDE

Story

Read more

Schematics

The Schematic Diagram for connections

Code

The Particle Build code

C/C++
This is the main code for particle programming
#define BLYNK_PRINT Serial  
#include <SPI.h>
#include <blynk.h>

volatile int state = LOW;
char auth[] = "Your Authentication code";
BLYNK_WRITE(V0)   // GPS Trigger
{
  GPSflag = param.asInt();  // Set the flag to 1 or 0
}


BLYNK_WRITE(V1)   // Button that does something if GPSflag is 1
{
  if (GPSflag == 1)   // Check flag
  {
    //  Do something if flag is 1
    digitalWrite(2, high)
    
  }
  else {
    //  Do something else and/or give feedback that something is not allowed in this location
     digitalWrite(2, low)
  }
}
void setup()
{
 Serial.begin(9600);
Blynk.begin(auth);  
attachInterrupt(D2, notifyOnButtonPress, RISING);
}

void notifyOnButtonPress()
{
state = !state;
}

void loop()
{
Blynk.run();
if (state == HIGH) 
{
 Blynk.notify("You are out of your house!");
 delay (200);
 state = LOW;
  }
}

Credits

Dhairya Parikh

Dhairya Parikh

21 projects • 123 followers
Project Developer | IoT and Machine Learning Enthusiast | Open Source Enthusiast |

Comments