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

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

Particle Photon Based Security System with Alerting
Intermediate
  • 1,335
  • 20

Full instructions

Be alerted to any door or window opening and closing in your house on your smart phone.

My Guardian for the Workshop
Intermediate
  • 195
  • 4

Full instructions

Device will send emails if the door or window has been opened, and will monitor the temperature and humidity of the place.

Happy Plant Notifier
Intermediate
  • 289
  • 5

Full instructions

Get a text or call if your plant is getting too dry, along with a nice LCD display giving information regarding your plant's health.

Smart and Safe Outdoor Plant Watering System
Intermediate
  • 2,512
  • 18

Monitors soil moisture and weather forecasts to give plants just the water they need. Safe garden hose hookup for season long watering.

Christmas Gift Box
Intermediate
  • 3,684
  • 595

Full instructions

Christmas Gift Box plays music and sends an email when it is opened.

NodeMCU Post on Facebook, Twitter, LINE, Telegram & Email
Intermediate
  • 22
  • 0

A simple IoT test to monitor analog values of 6 potentiometers from multiplexed ESP8266 NodeMCU, then post it on social media.

Sign up / LoginProjectsPlatformsTopicsContestsLiveAppsBetaFree StoreBlog