Fire Alarm System using ioShield-A & SNS service
This tutorial explains how to make the fire alarm system using ioShield-A & send the alarm message to SNS (such as facebook, twttter and etc) when the temperature rise up higher than threshold.
System Composition
Sensor Device
- Sensor device is responsible for sensing the temperature and sending to Cloud server
- KL-25Z ( MCU Board, mbed enabled ) + ioShield-A(Ethernet) + DS18B20
Cloud Server ( Xively )
- It collects sensing data
- If the collected data is higher than threshold, the cloud server creates the trigger and sends it to Proxy server
Proxy Server (Zapier )
- When the trigger information is received by Cloud server, Proxy server publish the message to any SNS service
User Service
In this posting, we are going to sends the message to the Facebook. The Zapier provides more SNS services such as Gmail, Twitter, Evernote, Tumbler, Github and etc.
Below is system block diagram.
Sensor Devices
- KL-25Z (mbed enable MCU board) + WIZ550io (W5500)
Both of ioShield-A & KL-25Z are compatible with Arduino board in hardware. Therefore, if you connect some signals in ioShiled-A, it is possible to use it with KL-25Z for Ethernet connection. Please see below picture for signal connection.
After then, add some female connectors to connect with the sensor board.
- DS18B20 ( Temperature Sensor )
We are going to use DS18B20for temperature sensor. Its specification & features are as below.
– Digital temperature conversion and output – Advanced single-bus data communication
– Maximum 12-bit resolution, accuracy up to ±0.5 degrees Celsius
– Parasitic mode available
– Temperature detection range: -55 ° C ~ +125 ° C (-67 ° F ~ +257 ° F)
– Built-in EEPROM and temperature limit
– Supply Voltage: 3.3V to 5V
– Temperature range :-55 °C ~ +125 °C
– Interface: Digital – Size:22x32mm
Connect the DS18B20 with ‘ioShield-A + KL25Z’
– Red Line : 3.3V VCC
– Black Line : GND
– Green Line : D3
Xively Server Configuration
For the detail fo Xively Server configuration, please refer to the post, “Temperature Monitoring System using Xively Server & WizFi250-EVB”
We are going to send the alarm message to the Facebook, when the temperature rises up higher than 28ºC. By referring below, adds the triggers. You must remember “HTTP POST URL” for Zapier configuration.
1. Login to zapier
2. Make a New Zap
3. Choose a trigger and action
– Select “Web Hook” & “Catch Hook” at the “When this Happens” category
– Select “Facebook” & “Post to Timeline” at the “Do This” category
※ You can select another SNS service
4. Select a Web Hook account : Input “HTTP POST URL” which was created in the Xively.
5. Connect to Facebook account
6. Input the contents for Facebook message when Trigger creates.
7. You can ignore “Test this Zap”
8. Name and turn this Zap on : Name the zap and click “Trun Zpa on” button.
If all above steps are successfully finished, you can see below screen.
Download Firmware
- Connect to mbed site and run mbed web compiler
- If you search w5500 at the mbed search window, you can find W5500-Ethernet-Interface Makers Repository site.
- Connect to the site and search ‘WIZ550io_Xively_Demo Example’
- Click ‘Import Program’ button
- Add ‘WIZ550io_Xively_Demo Example’ to the Program workspace of the Compiler
- Adding Xively FEED ID & API Key to the source Code
12 | #define XI_FEED_ID xxxxxxxxxxxxxx // set Xively Feed ID (numerical, no quoutes)#define XI_API_KEY “xxxxxxxxxxx” // set Xively API key (double-quoted string) |
The Channel ID (which was set at the Xively Serve) and datastream_id should be same as below (In this posting, Channel ID is set as “Channel_Test1”)
12 3 4 | feed.datastreams[0].datapoint_count = 1;xi_datastream_t* orientation_datastream = &feed.datastreams[0]; strcpy( orientation_datastream->datastream_id, “Channel_Test1” ); xi_datapoint_t* current_orientation = &orientation_datastream->datapoints[0]; |
3. Compile Source Code
If you click ‘compile’ at the web compiler, a binary file is created.
4. Download binary file to KL25Z board
If you copy the binary file into the driver of KL25Z board, the firmware download is completed
Run Application
Connect the LAN Cable to the sensor device, and input the power. Through a serial terminal, you can monitor all process about temperature sensing & data transmission to Xively server.
If the data is transmitted to Xively Server, the feed value of Request Log is updated
If the temperature gets higher than 28ºC, it is notified to Zapier server. Zapier will sends the alarm message to the Facebook.
COMMENTS