Introduction: Danger Detector
Danger Detector is a gas and smoke detector built utilising an Intel Edison and Grove sensors.
Step 1: What It Is and Where to Place the Device
The Danger Detector is a personal device that alerts a person of FIRE,Co2 and NATURAL DISASTERS. The FIRE and CO2 are NOT dependent on the availability of the internet.This detector is unlike a detector that is used in the household but has the ability to be placed safely in sleeping areas while traveling.With it's magnetized backing it can be placed easily on most doors that are usually found in hotels. We recommend placing the device just above eye level near the opening for maximum exposure and you will be reminded to take it with you when leaving. Push notification in your smart phone is now available.
Step 2: Features
This device will also alert a wristband that vibrates for deaf individuals.Natural Disasters such as Tornadoes,Severe Storms, and Flash Floods will be included as part of the warning system where the internet is available.
Step 3: Getting Started - What You Will Need.
Our team constructed this project at the Intel® IoT Roadshow in Boston, Massachusetts held in March 2015. Intel graciously provided us with both an Edison development board and a Grove Starter Kit Plus, Intel IoT Edition. The only other items used were
- plastic Sterilite 5.3 cup box from Wal Mart.
- magnetic tape
- Grove Gas Sensor(MQ2) also provided by Intel a set of Grove Home Automation sensors for our team.
Step 4: Connecting the Hardware
If you attend an Intel hackathon they will walk you through setting up and testing your Intel Edison. If you are doing this on your own you will find instructions on their IoT website.
Once you have your Edison up and running you should remove the Grove base shield from the Starter Kit and place it on your Edison board.
Next you should attach the Grove boards as follows:
- Grove LED to socket D2
- Grove Buzzer to socket D5
- Grove Gas Sensor to socket A0
If you refer to the photo at the left you will see these connections.
Step 5: The Software
We used Intel's free C/C++ Application Development Toolkit (ADT) - (Eclipse) to develop our software in C++. Since the Edison runs Linix, one has the choice of many languages.
Step 6: Testing the Project
If the sensor detects either gas or smoke the buzzer will sound and the LED flash.
We used a BIC lighter and a paper towel in a tin can to test our project.
First we released butane gas from the BIC lighter without lighting the flame. This should set off the alarm.
Next we used the lighter to set a paper towel on fire in a tin can. We then blew out the flame so that the paper smoldered and produced smoke. This also set off the alarm.
Once you are satisfied everything is working you can place everything in a plastic box. By fixing magnetic tape to the box, you can temporarily attach the box to any steel door.
Here is the program:
#include <unistd.h>
#include <iostream>
#include "mq3.h" #include "grove.h" #include "buzzer.h" #include <signal.h>
#include <stdlib.h>
#include <sys/time.h>
#include "mraa/gpio.h"
#define TRIGGER 200
int is_running = 0; uint16_t buffer [128]; upm::MQ3 *sensor = NULL;
void sig_handler(int signo) { printf("got signal\n"); if (signo == SIGINT) { is_running = 1; } }
//! [Interesting] int main(int argc, char **argv) { // Create the Grove LED object using GPIO pin 2 upm::GroveLed* led = new upm::GroveLed(2); mraa_gpio_context gpio = NULL; gpio = mraa_gpio_init(5); mraa_gpio_dir(gpio, MRAA_GPIO_OUT);
// Print the name std::cout << led->name() << std::endl;
// Attach gas sensor to A0 sensor = new upm::MQ3(0); signal(SIGINT, sig_handler);
thresholdContext ctx; ctx.averageReading = 0; ctx.runningAverage = 0; ctx.averagedOver = 2;
// Infinite loop, ends when script is cancelled // Repeatedly, take a sample every 2 milliseconds; // find the average of 128 samples; and // print a running graph of the averages using a resolution of 5 while (!is_running) { int len = sensor->getSampledWindow (2, 128, buffer); if (len) { int thresh = sensor->findThreshold (&ctx, 30, buffer, len); sensor->printGraph(&ctx, 5); if (thresh > TRIGGER) { led->on(); mraa_gpio_write(gpio, 1); sleep(1); } else { led->off(); mraa_gpio_write(gpio, 0); sleep(1); } } mraa_gpio_write(gpio, 0); led->off(); }
// std::cout << "exiting application" << std::endl; // Delete the Grove LED object delete led; return 0; } //! [Interesting]
Step 7: Still to Come
Because of time constraints we were not able to implement all the features we wanted during the hackathon. Still left undone are:
Selecting a vibrating bracelet with Bluetooth connectivity to serve as an additional alarm.
Connecting the Edison to the Internet to both receive alarms such as weather alerts as well as provide notifications of alarm conditions via SMS etc.
Adding additional sensors to detect other hazards and someone opening the door unexpectedly (a break in).
Better packaging - we put our project in a rather large plastic container and powered it with the wall-wart provided with the Edison. Clearly a much smaller container with a battery would be more suitable for traveling.
Step 8: Final Thoughts
While we had a lot of fun with this project t is clearly not ready for prime time. In particular "real" fire alarms undergo extensive testing and are generally approved by a testing agency such as Underwriters Laboratory.
For the next version of this project perhaps a improvement would be to utilise a commercially available detector that has been tested an approved and which provides an alarm output connection. We could then connect the output of the alarm to an input pin of the Edison to have the best of both worlds.