Using a compatible Intel-based platform, this project lets you create a smart fire alarm that:
- constantly monitors for unsafe temperature levels.
- issues an audible notification using the buzzer.
- issues a visual notification using the LCD.
- keeps track of fire events, using cloud-based data storage.
- sends text messages to alert others of a possible fire.
For all the samples in this repository, see the General Setup Instructions for required boards and libraries. You need either Grove* or DFRobot* sensors but not both.
| Sensor | Pin |
|---|---|
| Grove* Temperature Sensor | A0 |
| Grove* Buzzer | D5 |
| Grove* RGB LCD | I2C |
| Sensor | Pin |
|---|---|
| Analog Temperature Sensor | A3 |
| Buzzer | A2 |
For more specific information on the hardware requirements see Hardware Details
- MRAA and UPM
- Python 2.7
- Packages as listed in the setup.py file in this directory
- Microsoft Azure*, IBM Bluemix*, AT&T M2X*, AWS*, Predix*, or SAP* account (optional)
- Twilio* account (optional)
You can install the dependencies.
To install the Python* package manager needed to install and run the example:
$ pip install --upgrade pip setuptools
Once all dependencies are installed you can install the example itself with the following command:
$ pip install --src ~/python/examples/ -e "git+https://github.com/intel-iot-devkit/how-to-code-samples.git#egg=iot_fire_alarm&subdirectory=fire-alarm/python"
The pip command will install required Python dependencies, save the source code for the example in ~/python/examples/iot_fire_alarm/ and link the package to the global Python site-packages folder.
To optionally send text messages, you need to register for an account and get an API key from the Twilio* website:
You cannot send text messages without obtaining a Twilio* API key first. You can still run the example, but without the text messages.
Pass your Twilio* API key and authentication token to the sample program by modifying the TWILIO_ACCT_SID and TWILIO_AUTH_TOKEN keys in the config.json file as follows:
{
"ALARM_THRESHOLD": 28,
"TWILIO_ACCT_SID": "YOURAPIKEY",
"TWILIO_AUTH_TOKEN": "YOURTOKEN"
}
When the example is installed through pip the config.json file that holds the configuration for the example lives in ~/python/examples/iot_fire_alarm/fire-alarm/python/iot_fire_alarm/config.json.
To configure the example for the Grove* kit, just leave the kit key in the config.json set to grove. To configure the example for the DFRobot* kit, change the kit key in the config.json to dfrobot as follows:
{
"kit": "dfrobot",
"ALARM_THRESHOLD": 28
}To configure the example for the Arduino 101, add a PLATFORM key with the value firmata to the config.json, as follows:
{
"kit": "grove",
"PLATFORM": "firmata",
"ALARM_THRESHOLD": 28
}To configure the example for sending optional text messages, obtain an API key from the Twilio* web site as explained above, and then add the TWILIO_ACCT_SID and TWILIO_AUTH_TOKEN keys to the config.json file as follows:
{
"kit": "grove",
"ALARM_THRESHOLD": 28,
"TWILIO_ACCT_SID": "YOURAPIKEY",
"TWILIO_AUTH_TOKEN": "YOURTOKEN"
}To configure the example for the optional Microsoft Azure*, IBM Bluemix*, or AWS data store, add the SERVER and AUTH_TOKEN keys in the config.json file as follows:
{
"kit": "grove",
"ALARM_THRESHOLD": 28,
"SERVER": "http://intel-examples.azurewebsites.net/logger/fire-alarm",
"AUTH_TOKEN": "s3cr3t"
}To configure the example for both the text messages and the Microsoft Azure*, IBM Bluemix*, or AWS* data store, add the TWILIO_ACCT_SID, TWILIO_AUTH_TOKEN, SERVER, and AUTH_TOKEN keys in the config.json file as follows:
{
"kit": "grove",
"ALARM_THRESHOLD": 28,
"TWILIO_ACCT_SID": "YOURAPIKEY",
"TWILIO_AUTH_TOKEN": "YOURTOKEN",
"SERVER": "http://intel-examples.azurewebsites.net/logger/fire-alarm",
"AUTH_TOKEN": "s3cr3t"
}For information on how to configure the example for an optional Microsoft Azure*, IBM Bluemix*, AT&T M2X*, AWS*, Predix*, or SAP* IoT cloud server, go to:
https://github.com/intel-iot-devkit/iot-samples-cloud-setup
Once the program is installed and configured as detailed above, you can execute the program by running the following command in an SSH session to the board:
$ python -m iot_fire_alarm
You will see output similar to below when the program is running.
fire alarm
Connecting to MQTT server...
MQTT message published: { d: { value: 'fire alarm', datetime: '2016-04-22T03:17:28.279Z' } }
SMS sent { sid: 'SMdd79f27e8e184ee891225854888ef009',
date_created: 'Fri, 22 Apr 2016 03:17:29 +0000',
Refer to How it Works for details on the functionality.
You can optionally store the data generated by this sample program using cloud-based IoT platforms from Microsoft Azure*, IBM Bluemix*, AT&T M2X*, AWS*, Predix*, or SAP*.
For information on how to connect to your own cloud server, go to:
https://github.com/intel-iot-devkit/iot-samples-cloud-setup
IMPORTANT NOTICE: This software is sample software. It is not designed or intended for use in any medical, life-saving or life-sustaining systems, transportation systems, nuclear systems, or for any other mission-critical application in which the failure of the system could lead to critical injury or death. The software may not be fully tested and may contain bugs or errors; it may not be intended or suitable for commercial release. No regulatory approvals for the software have been obtained, and therefore software may not be certified for use in certain countries or environments.