Network based smoke alarm - using Arduino and iphone

Similar documents
Home center Interface Server. Technical sheet

Added password for IP setup page : Password must be in IP format!

PWM. Solar Charge controller with Ethernet. Solar Smart PWM 20Amp. Hardware Description : Release : 19 June 2014

Home center 2.7 Windows client Installation guide

Smart Wireless Sensor

Advisor Advanced Mobile Application User Manual

Smart Wireless Sensor

Grandstream Networks, Inc. GDS3710 Input/output Connection Guide

Ontech GSM 9040/50. Reference Manual English -1 -

How to use the BTRM in Remote Enclosures

Fall & Medical Alert Sensor

Using ANM Mobile CHAPTER

Avigilon Control Center System Integration Guide

First day: SmartLink Web and SmartPager SmartLink and SmartPager installation Second day: SmartLink and SmartPager Configuration Alarms Management

MultiSite Manager. Setup Guide

Bosch TCU Integration Module Administrator's Guide

Wi-Fi Thermostat. Sensi TM INSTALLATION GUIDE. Models: 1F86U-42WF, UP500W Version: October Emerson Electric Co. All rights reserved.

Guillermo Alberto Pérez Guillen Automation Home

Avigilon Control Center 5 System Integration Guide

Fall & Medical Alert Sensor

Figure 1. Proper Method of Holding the ToolStick. Figure 2. Improper Method of Holding the ToolStick

Sensi TM. Touch Wi-Fi Thermostat INSTALLATION GUIDE. Models: 1F95U-42WF, ST75 Version: October 2017

Dry Contact Probe DCP (#30008)

CG500SKE SKYEYE GATEWAY USER MANUAL VERSION OCTOBER Disclaimers and Copyright

Skyresponse ThingWorx Extension. Version 1.0. User Guide

IndigoVision Alarm Panel. User Guide

How to modify Volvo Alarm Siren after it has given Message: Alarm system Service Required Ver. 1.2

Avigilon Control Center System Integration Guide

Wi-Fi 3-IN-1 Trio Sensor

Wise&Cute WSC Series IP Cameras User-Manual

WHAT HAPPENS NEXT FOR ADT SMART BUSINESS CUSTOMERS

Midco SmartHOME Quick Start Guide. Learn how to protect the things that matter most using this Midco SmartHOME instruction guide.

Avigilon Control Center System Integration Guide

IRIS Touch Firmware Enhancements and Additions from Version to Version

Patriot Systems Limited

Ion Gateway Cellular Gateway and Wireless Sensors

Code Alert Series 30 Software User Guide

FortiNAC. Lightspeed Single Sign-On Integration. Version: 8.x Date: 8/29/2018. Rev: B

CODE ALERT Enterprise Software User Guide

Avigilon Control Center System Integration Guide

Section 1. Overview. The Kaleidescape Premiere System. System Components

Homework 5: Theory of Operation and Hardware Design Narrative

Dishwasher Load-Unload Indicator. Jitendra Tailor

USER S GUIDE. AXIS Cross Line Detection

Cold chain monitoring technologies. Facility monitoring

IndigoVision. GAI-Tronics Integration Module. Administrator's Guide

IRIS Touch Quick Installation & Maintenance Guide. Version 1.0

Avigilon Control Center 5 System Integration Guide

Web Services are based on Apache and Tomcat servers. The html/jsp (tags, beans) are fully customisable and extendable.

Fratech Multipath-IP

Operation Manual Fighter ProVision Software. Version: 0.0 Revision: 1

Avigilon Control Center 5 System Integration Guide

Characteristics of different sensors used for Distance Measurement

This Tech Note provides detailed procedures to configure Remote Response objects to trigger an alarm and acknowledge it via or SMS.

NextGen Home Security. Quick Reference Guide

IP & SMS Alarm Communicator

BlackBerry AtHoc Networked Crisis Communication Siemens Indoor Fire Panel Installation and Configuration Guide Release Version 7.

IntesisBox BACnet/IP Server - Notifier ID3000 series

APP Function Introduction

Android Controlled Fire Fighting Robot

Section 5. Control Systems

International Journal of Scientific & Engineering Research Volume 9, Issue 2, February-2018 ISSN

Network Hardware and wiring (quiz)...

DC-RMCU1 DC-Powered Remote Monitoring and Control Unit Owners Guide

Avigilon System Integration Guide. Avigilon Control Center with AMAG Symmetry Security Management System 7.0

IRIS Touch 400 & 600 Range Installation Manual. Honeywell Galaxy Range. Version 2.0

Sensor Report. University of Florida Department of Electrical and Computer Engineering EEL5666 Intelligent Machines Design Laboratory

WiFi GSM APP Smart Home Security System

Made possible by an innovative licensing scheme, which allows individual hardware configuration, up to the maximum configuration:

IRIS Touch Quick Installation & Maintenance Guide. Version 1.0

Front page TBA from Marketing. Network and Device Monitoring. Starter Kit

Figure 1. Proper Method of Holding the ToolStick. Figure 2. Improper Method of Holding the ToolStick

MiNi Server environment MoNitoriNg SySteM

Figure 1. Proper Method of Holding the ToolStick. Figure 2. Improper Method of Holding the ToolStick

Grove - Laser PM2.5 Sensor (HM3301)

Roo232 User Guide. Revision 1.0. Copyright 2006 RoboDynamics Corp

Alarm Panel [ PRELIMINARY HARDWARE MANUAL ] USER MANUAL. v1.0a. May 7, 2008 D-OC-UM

ibox Modbus Server Gateway for the integration of Notifier ID3000 / ID3002 / ID60 / ID50 fire panels in Modbus enabled monitoring and control systems

HikCentral Web Client. User Manual

ocbridge Plus SPECIFICATION 3. COMPONENTS Wireless sensors receiver, battery СR2032, manual, instalation CD.

Operation Manual For model CM706E

Security designed for your lifestyle

Lighting Xpert Insight User Manual

For ios devices MYQ-G0301 MYQ-G0301C MYQ-G0301-D MYQ-G0301LA

ICC INDUSTRIAL CONTROL COMMUNICATIONS, INC.

Avigilon Control Center 5 System Integration Guide. with STENTOFON AlphaCom. INT-STENTOFON-C-Rev1

entri Series HE1U-XX12-BMS-MU Series

Smart Combiners Installation Guide. For Obvius A89DC-08 sensor modules

Refrigerator/Freezer Guard Models VM605, VM605E. Property Guard Models VM610, VM610E. Temperature Monitor and Alarm

IOT ENABLED FOREST FIRE DETECTION AND ONLINE MONITORING SYSTEM

Digijock Home Security

Controllers. Centralization of Access Control Devices Made Easy. Installer Guide

Paradox Integration Module Settings Guide

NU2 Smart Power Supply (SPS) Manual

AK-CS On Board Guide

FS Mircom FX2000 Fire Alarm Panel

USER MANUAL FOR OPERATING SYSTEM

Portable Fire Detector

Secure Setup. 1. Download the app. Visit the App Store, Google Play, or to download the free Canary app on your smartphone.

CompleteView SightLogix Sensor Setup Manual. CompleteView Version 4.7.1

Transcription:

Network based smoke alarm - using Arduino and iphone 1 of 12

Introduction How cool would it not be to check the status of your smoke alarm through an mobile app over Internet?! I would say very cool and totally necessary! So in this document I will describe the technical solution of my network based smoke alarm. The technical solution is rather simple. When smoke hits the smoke alarm (detector), the smoke alarm will send out voltage to its buzzer. That voltage will be read by an analog input pin on the Arduino. The Arduino will post the value to a web server (running PHP/MySQL). In the other end of the system, an iphone app will continuously read the values and notify the user if a high voltage value is found. 2 of 12

Table of contents INTRODUCTION 2 TABLE OF CONTENTS 3 PREREQUISITES 4 CREDITS 4 EQUIPMENT 4 SYSTEM OVERVIEW 5 BREADBOARD VIEW 5 BUILD INSTRUCTIONS 6 SETUP THE HARDWARE 6 SETUP THE SOFTWARE 6 MODIFY THE SMOKE ALARM 7 CONNECT THE SMOKE ALARM TO THE ARDUINO THROUGH A COUPLING PLATE 7 TEST THE MODIFIED SMOKE ALARM 7 MODIFY THE ANALOGREADSERIAL 8 DEVELOP THE WEB SITE 9 DEVELOP AN APP 9 POSSIBLE IMPROVEMENTS 11 REFERENCES 11 3 of 12

Prerequisites All build steps are not described in detail (some are just mentioned breifly). So this document requires that the reader have a basic knowledge of electronics and software development. Don t forget to ask www.google.com when you need help. Credits Thanks to my employer HiQ [5] that gave me time to finalize this project and also thanks to Jakob Selbing who supported with electric skills. Equipment All the equipment I used in this experiment is listed below. Some parts can be changed to similar solutions. E.g. if you don t have a Mac, you can use a PC and create an Android app instead. 1. Arduino Mega 2560 rev3, http://www.kjell.com/sortiment/el/elektronik/mikrokontroller/arduino /arduino- mega- 2560- rev3- p87861 2. Arduino Ethernet Shield rev3, http://www.kjell.com/sortiment/el/elektronik/mikrokontroller/arduino /arduino- ethernet- shield- rev3- p87864 3. Coupling plate, http://www.kjell.com/sortiment/el/elektronik/elektroniklab/kopplings platta- lodfri- p36251 4. Cables for coupling plate, http://www.kjell.com/sortiment/el/elektronik/elektroniklab/bygelsladd ar- 140st- p36254 5. Thin wires that can be used for soldering 6. Housegard HG- 102 smoke alarm, http://www.teknikmagasinet.se/db.pl?tf=product_link.html&link=&artnr =570477&title=Brandvarnare%20optisk& 7. Computer with Arduino development environment, http://arduino.cc/en/main/software 8. Computer with Apple Xcode development environment (in my case MacBook Air), http://www.apple.com/se/macbookair/specs.html 9. Two 5,6K ohm resistors, e.g. http://www.clasohlson.com/se/motst%c3%a5ndssats/pr363840000 10. RJ- 45 Ethernet cable 11. USB cable for Arduino programming (upload of application) 12. Soldering iron 13. Solder 14. Optional: multimeter 15. Web server with PHP & MySQL 4 of 12

System overview The remote controlled smoke alarm system consists of four main parts, microcontroller, smoke alarm, web server and an smoke alarm app (for iphone). 1. Upload smoke alarm status PHP & MySQL Web server 3. Receive smoke alarm status 2. Request smoke alarm status Smoke alarm app Microcontroller Smoke alarm Figure 1 - Overview of the remote controlled smoke alarm. When smoke hits the detector in the smoke alarm, the IC circuit will send out ~10 volt on pin 7. The Arduino that is connected to the smoke alarm on pin 7 and its ground will detect that the voltage raises from 0 to 5 volt. Since the Arduino only can handle 0-5 volts, two resistors on the coupling board will reduce the voltage from 10 to 5 volt. When the Arduino reads the voltage on the analog input pin 0, it will send the value to the web server with a HTTP GET request message. The web server running PHP receives the request message and stores the information in a MySQL database. The phone with the smoke alarm app continuously polls the web server for the smoke alarm status, if it receives a status value that indicate smoke (>0 volt) it will notify the user. Breadboard view 5 of 12

By Mikael Johansson, The ground (GND) and analog input 0 (A0) pin is used on the Arduino. On the smoke alarm the IC (BL59S10) I/O pin (number 7) and ground is used. Figure 2 - Breadboard view. Build instructions The instructions below should be read in chronological order. Setup the hardware Put the Arduino Ethernet Shield rev3 on top of the Arduino Mega 2560 rev3 (the two units is from now called the Arduino ). Connect the Arduino with a RJ- 45 Ethernet cable to Internet and a USB cable to the computer. Setup the software Download and install the Arduino development environment from http://arduino.cc/en/main/software. Install Apache webserver with PHP, MySQL and phpmyadmin or create an account at a web hotel that provide such services. Download and install Xcode. Xcode is free as long as you do not need to run the app on real hardware. There is a very good inbuilt iphone and ipad simulator in Xcode that can be used for this purpose. Xcode can be 6 of 12

downloaded for free from Mac OS X App Store (or https://developer.apple.com/xcode/). Modify the smoke alarm Open up the smoke alarm (HG- 102) and take out the circuit board. Verify that the 9 volt battery is not connected to the circuit board. Solder a thin (red) wire on the dot in front of the IC s pin 7 and a thin (black) wire on the ground, see Figure 3 below. Figure 3 - Modification of the smoke alarm circuit board. Do not connect the red wire on pin 7 directly to the Arduino since it has almost 10 volt, which is more than the Arduino is made for. If you have a multimeter you can now add the 9 volt battery and measure the voltage on the newly soldered red and black wire when you press the test button. It should be around 10 volt. When the test button is un- pressed the multimeter should measure 0 volt. Connect the smoke alarm to the Arduino through a coupling plate Connect the newly soldered ground (black) wire and pin 7 (red) wire to the coupling plate as shown in Figure 2. Add two resistors at 5,6 K ohm as shown in the same figure. Since the output voltage from the smoke alarm circuit is around 10 volt, it must be reduced for the Arduino which only can handle 0-5 volt. This is made by using a voltage divider (see [2] for more information). Connect the other wires as shown in the figure. The wires to the Arduino are connected to the ground (GND) and analog input 0 (A0) pins. Test the modified smoke alarm It is now time to test the modifications. Open the Arduino development environment and from the File menu select Examples > 01.Basics > AnalogReadBasics. This example is a good starting point for this development since it continuously reads and displays the voltage on analog input pin 0 (A0). 7 of 12

Start and configure the Arduino development environment (see [3] for more information). Go to menu Tools > Board and select Arduino Mega 2560 or Mega ADK Go to menu Tools > Serial Port and select something like/dev/tty.usbmodem (can differ). Open an example program from menu File > Examples > 01.Basics > AnalogReadSerial. Upload the code to the Arduino and show the Serial Monitor (menu Tools > Serial Monitor). Press the test button on the smoke alarm circuit and verify that the Arduino detects the voltage that should be around 4-5 volt. Modify the AnalogReadSerial Save the AnalogReadSerial as something else (e.g. FireAlarmReporter). The FireAlarmReport needs to be modified to report the voltage to the web server using the Ethernet library [4]. Sorry, but I will not go into details here so you have to learn by your self how to use it. In this experiment, the FireAlarmReporter sends HTTP GET requests to http://complexit.se/arduino/rval.php?sid=1&v=4, where rval.php is the PHP file that will save the data to the MySQL server, sid is an own- defined ID for this fire alarm reporter unit and v is the voltage value. Code snippet that can be useful: char url_host[] = "www.complexit.se"; EthernetClient client; int sensor_id = 1; int sensor_value = 0; int reportsensorstatus() { Serial.println("Reporting status..."); size_t printed = client.print("get "); client.print("/arduino/rval.php?"); client.print("sid="); client.print(sensor_id); client.print("&v="); client.print(sensor_value); client.println(" HTTP/1.0"); client.println("host: www.complexit.se"); //Needed for shared hosts client.println(); Serial.print("Sent "); Serial.print(printed); Serial.println(" bytes."); } The code snippet above can be used to report the value (sensor_value) to the web server. Save the return value from analogread(a0) into sensor_value before invoking the reportsensorstatus method. 8 of 12

As you can see in the code I have added the comment //Needed for shared hosts. That line is required if your webserver s ip number is shared with other websites (common for web hotels). The line will tell the web server which one its websites that want to receive the HTTP GET request method. Develop the web site Now when the Arduino can send the smoke alarm voltage values with HTTP GET request messages, it is time to fetch those messages. That will be done with PHP and MySQL. I use three files on the webserver: rval.php (register values), gval.php (get values) and cfg.php (webserver configuration). The cfg.php file is included from the rval.php and gval.php files. The following code is used for receiving the variables in the HTTP GET request: $sensor_id = $_GET['sid']; $sensor_value = $_GET['v']; The sensor_id and sensor_value is then saved into a table. To create the table that will store the smoke alarm values, I recommend phpmyadmin (http://www.phpmyadmin.net/). The gval.php is the file that the app will read, so it takes a sensor id as input and returns the sensor s value to the app. The data sent to the app is in my solution in XML format. A code snippet from my gval.php is: $sensor_id = $_GET['sid']; echo get_response_message_xml(get_sensor_status($sensor_id)); The sensor id is saved to sensor_id in the same way as in rval.php. The get_sensor_status is a method that looks into the database for the latest voltage value for the given sensor_id. The get_response_message_xml is a method that presents a given input value in a XML format. That XML format is also known by the app. Develop an app Since I have a Mac and an iphone, the decision of making an iphone app for this experiment wasn t so difficult. If you have a Mac but no iphone you can test your app in the iphone/ipad simulator. If you don t have a Mac, this can be done in Eclipse by using the Android SDK [6]. Open Xcode and start a new project of type ios Application > Tabbed Application. On the first tab I placed the status of the smoke alarm and two web camera views. The second tab can be good for adding and removing sensors or other devices you might want to monitor. In the first tab (FirstViewController.m) that is automatically generated by Xcode, I placed a NSTimer that continously polls the gval.php file and then updates an UILabel with the sensor status. The UILabel will show ALARM! or OK, depending of the received value from the gval.php. The XML data is downloaded by the download method that uses the NSURLConnection class. A short code snippet that might help: 9 of 12

-(NSData *)download:(nsstring *)server { /* code removed */ NSURL *serverurl = [[NSURL alloc] initwithstring:server]; serverurlrequest = [NSMutableURLRequest requestwithurl:serverurl]; NSData *rawdata = [NSURLConnection sendsynchronousrequest:serverurlrequest returningresponse:&resp error:&err]; if(!rawdata) { NSLog(@"Check Internet connection."); return nil; } httpurlresponse = (NSHTTPURLResponse *)resp; switch ([httpurlresponse statuscode]) { case 200: { /* code removed / return rawdata; } break; default: { NSLog(@"Unhandled statuscode=%d", [httpurlresponse statuscode]); break; } } return nil; } The download method returns NSData* on success or nil on failure. The NSData* is then (outside the download method) converted to an UTF- 8 encoded NSString*. To get the actual smoke alarm voltage value, I implemented a XML parser that is compatible with the NSXMLParser class. It takes the UTF- 8 NSString and returns the smoke alarm status. When all your code are in place, just press Command + R to run your app on either a real iphone (require to buy developer license) or in the iphone simulator. When I did this I could not resist to also add my IP cameras to the app. I added two DCS- 932L web cameras. If the app says ALARM! I can now also verify that visually in real time. 10 of 12

Figure 4 - The smoke alarm app in an iphone simulator. Possible improvements My impression of the smoke alarm detector HG- 102 is that it is not so sensitive. It require, in my opinion, rather much smoke before it starts to alert. If I will make this again I would choose another smoke alarm detector. It is also overkill to have an Arduino Mega 2560 rev3 for this purpose. There are cheaper alternatives like Arduino Uno that is also compatible to the Arduino Ethernet Shield rev3. It is also possible to connect additional wires to the smoke alarm in order to control the buzzer. That can be useful if you want to remote test the smoke alarm. Or why not joke with the persons in the room References [1] BL59S10 data sheet, URL: http://html.alldatasheet.com/html- pdf/164341/belling/bl59s10/294/1/bl59s10.html [2] Voltage divider, URL: http://en.wikipedia.org/wiki/voltage_divider [3] Getting started w/ Arduino on MacOSX, URL: http://arduino.cc/en/guide/macosx [4] Arduino Ethernet library, URL: http://arduino.cc/en/reference/ethernet [5] HiQ, http://www.hiq.se/ 11 of 12

[6] Android SDK, http://developer.android.com/sdk Updated 9/11/12 10:57 AM 12 of 12