Things used in this project

Hardware components:
Photon new
Particle Photon
×2
SunFounder 2 Channel DC 5V Relay
×1
Water Solenoid Valve
×1
BRK 7010B Hardwire Smoke Alarm
×1
Software apps and online services:
Q8wtlimqnp04fzhtr9v5
IFTTT Maker service
Particle
Google sheets
Google Sheets

Schematics

The smoke detector circuit diagram
Smoke diagram lreaez4uoi
The relay and water valve circuit diagram
Water valve circuit b3xjitgsbt

Code

Smoke detector codeArduino
const int sensorPin = D3;  
const int ledPin =  D7;
int rssi =0;

void setup()
{
  pinMode(sensorPin, INPUT);
  pinMode(ledPin, OUTPUT);
  Particle.publish("State", "0",PRIVATE);
  Particle.variable("RSSI", &rssi, INT);
}


void loop()
{
  int  sensorSignal; 
  int i;
  int j;
  int n=60; //Published Low state every 60 minutes
  int m=60; //Published WiFi strength every 60 seconds 

   for (i = 0; i < n; i++) 
   {
        for (j = 0; j < m; j++) 
        {
           sensorSignal = digitalRead(sensorPin);
           if ( sensorSignal == HIGH)  
           {
                digitalWrite(ledPin, HIGH); 
                Particle.publish("State", "1",PRIVATE);
                delay(15000);
            }
            else
            {
                digitalWrite(ledPin, LOW);
            }
            delay(1000);
        }
        rssi = WiFi.RSSI();
        Particle.publish("rssi", String(rssi), 60, PRIVATE);
   } 
  Particle.publish("State", "0",PRIVATE);
}
Relay and water solenoid valveArduino
int openValve(String command);
const int valvePin = D7;
int rssi =0;

void setup()
{
 
  Particle.function("valve", openValve);
  Particle.variable("RSSI", &rssi, INT);
  pinMode(D7, OUTPUT);
}

void loop()
{
    rssi = WiFi.RSSI();
    Particle.publish("rssi", String(rssi), 60, PRIVATE);
    delay(60000);
}

int openValve(String command)
{

  if(command == "open")
  {
   digitalWrite(valvePin, HIGH);
   delay(10000);
   digitalWrite(valvePin, LOW);
       Particle.publish("Reopen", "Reopen Valve",PRIVATE);
        delay(1000);
    return 1;
  }
  else return -1;
}

Credits

0b5f0cfaf1dbd8f9e726efc9697b0454
vinh phan

My name is Vinh Phan. I am an Engineering student at UNC Charlotte.

Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Run Google Assistant on Your Amazon Echo
Intermediate
  • 1,787
  • 14

Full instructions

This is an implementation of the Google Assistant API wrapped as an Alexa skill.

DIY Smart Assistant Speaker/Lamp (Google Home or Alexa)
Intermediate
  • 1,885
  • 5

Full instructions

DIY build using 3D printed enclosure and parts, a recycled Bluetooth speaker, a Raspberry Pi, and a Philips Hue light bulb.

Other Clocks
Intermediate
  • 183
  • 3

Work in progress

A combination of 3 different clocks in one frame.

ConnectTheDots with Particle Azure IoT Hub Integration
Intermediate
  • 554
  • 6

Protip

This project will allow you to connect your Particle device into an Azure IoT Hub for viewing data in real-time through an ASP.NET web app!

Edison Candle
Intermediate
  • 416
  • 6

Work in progress

Soothing LED candle based on the Intel Edison running Android Things.

Android Robocar
Intermediate
  • 2,969
  • 22

Full instructions

Build your own small autonomous car with Android Things.

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login