Things used in this project

Hardware components:
11026 02
Jumper wires (generic)
×1
826 04
Male/Female Jumper Wires
×1
Adafruit industries ada64 image 75px
Solderless Breadboard Half Size
×1
Kidde i9040 9V Ionization Smoke Detector
×1
Soldering Iron
×1
Electrical Solder
×1
Mfr 25frf52 1k sml
Resistor 1k ohm
×1
Mfr 25fbf52 4k75 sml
Resistor 4.75k ohm
×1
Mfr 25fbf52 475r sml
Resistor 475 ohm
×1
Photon new
Particle Photon
×1
Vishay semiconductor ild74 image 75px
Opto-Isolator
×1
Multimeter
×1
USB Power Supply
×1
PCB Project Board
×1
Software apps and online services:
Pushbullet
Q8wtlimqnp04fzhtr9v5
IFTTT Maker service

Schematics

Cicuit Diagram
Circuit Made in Fritzing
Fritzing fmjxopiatu
Schematic
Photon/Opto Schematic
Camera capture eo5us0fiw7

Code

Code for Photon 1 (in circuit)C/C++
Code to notify Pushbullet, photon 2, and for graphing
#include "elapsedMillis/elapsedMillis.h"


#define SMOKE_READ_INTERVAL 1000


#define SMOKE_FIRST_ALARM 10000 //10 seconds
#define SMOKE_SECOND_ALARM 60000 //1 minute
#define SMOKE_THIRD_ALARM 300000 //5 minutes
#define SMOKE_FOURTH_ALARM 600000 //10 minutes
#define SMOKE_FIFTH_ALARM 900000 //15 minutes

#define SMOKE_NOTIF "SMOKE"

elapsedMillis smoke_timer;
elapsedMillis smoke_alarm_timer;

int smoke_alarms_array[5]={SMOKE_FIRST_ALARM, SMOKE_SECOND_ALARM, SMOKE_THIRD_ALARM, SMOKE_FOURTH_ALARM, SMOKE_FIFTH_ALARM};
int smoke_alarm_index = 0;
bool smoke_detected = false;
unsigned long smoke_next_alarm = 0;

int SMOKE_SENSOR = D7;


void setup() {
 pinMode(SMOKE_SENSOR, INPUT);
 


 
 
RGB.control(true);


RGB.brightness(0);


delay(1000);


RGB.control(false);

}

void loop() {
    

    smoke_check();
    
    if (smoke_detected) {
        smoke_notify_user();
    }
}

/*******************************************************************************
 * Function Name  : smoke_check
 * Description    : check smoke sensor at SMOKE_READ_INTERVAL, turns on led on D7 and raises alarm if smoke is detected
 * Return         : 0
 *******************************************************************************/
int smoke_check()
{
    if (smoke_timer < SMOKE_READ_INTERVAL) {
        return 0;
    }
    
    
    smoke_timer = 0;

    if (digitalRead(SMOKE_SENSOR)) {

        
        if (smoke_detected){
            return 0;
        }
        
        smoke_detected = true;
    
        
        smoke_alarm_timer = 0;

        
        smoke_alarm_index = 0;
        smoke_next_alarm = smoke_alarms_array[0];
        
    } else {
        
        smoke_detected = false;
    }
    return 0;
}

/*******************************************************************************
 * Function Name  : smoke_notify_user
 * Description    : will fire notifications to user at scheduled intervals
 * Return         : 0
 *******************************************************************************/
int smoke_notify_user()
{

    if (smoke_alarm_timer < smoke_next_alarm) {
        return 0;
    }

    
    
    smoke_alarm_timer = 0;
    
    
    if (smoke_alarm_index < arraySize(smoke_alarms_array)-1) {
        smoke_alarm_index = smoke_alarm_index + 1;
        smoke_next_alarm = smoke_alarms_array[smoke_alarm_index];
    }

    
    Particle.publish("smoke_has_been_detected_27", "Smoke detected! Save the cats!", 60);
    
    
    Particle.publish("pushbullet", "Smoke detected! Save the cats!", 60);
   
   return 0; 
}
Photon 2 D7 Flash CodeC/C++
Code to flash D7 when smoke alarm goes off
int boardLed = D7;


void setup()
{
    Particle.subscribe("smoke_has_been_detected_27", flickerled);
    Serial.begin(230400);
    pinMode(boardLed,OUTPUT); // Our on-board LED output
    Particle.subscribe("smoke_has_been_detected_27",button);
}
void flickerled (const char *event, const char *data)
{

    if(strcmp(data, "Smoke detected! Save the cats!")==0)
{
        digitalWrite(boardLed,HIGH);
        Serial.println("Smoke detected! Save the cats!");
}
}
void button(const char *event, const char *data)
{
    if(strcmp(data,"buttonpressed")==0)
    {
        digitalWrite(boardLed,LOW);
        delay(15000);
}
}

Credits

Img 20170204 152218 354 pymil8cfai
Kathryn Lawther

Mechanical Engineering Student @ UNCC with a focus in Motorsports

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

AquaNiner Pet Hydration Monitor
Intermediate
  • 382
  • 14

Full instructions

Using two Photons, IFTTT and ThingSpeak, get notifications for when your furry friend needs water and monitor how much they're drinking.

Hot Shot Hoops
Intermediate
  • 530
  • 13

Full instructions

No need to keep track of the number of baskets you make when shooting hoops. Hot Shot Hoops does the work for you.

Hot Shot Hoops

Team IOT Basketball

Temperature Mirror
Intermediate
  • 381
  • 8

Full instructions

The Temperature Mirror incorporates a digital display to allow its user to readily view time, temperature, humidity, and light.

Temperature Mirror

MEGR3171 Team 49

Pet Feeder
Intermediate
  • 414
  • 7

Full instructions

Automated pet food dispenser to feed our pets when we are not at home by using an IoT device.

Teacher Tracker
Intermediate
  • 176
  • 4

Full instructions

If you want to know when a professor comes back to his/her office so you can ask annoying questions then this an option

LightAlert
Intermediate
  • 138
  • 4

Full instructions

As the great Terry Crews once said "that's 49 cents of milk spilt over the table! Somebody's gonna drink that!" But instead... electricity.

Add projectSign up / Login
Respect project