element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Upcycle It
  • Challenges & Projects
  • Design Challenges
  • Upcycle It
  • More
  • Cancel
Upcycle It
Blog [Upcycle It] WiFi Connected Smoke Detector #5: Monitor The Monitor
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: vlasov01
  • Date Created: 23 Apr 2017 1:05 AM Date Created
  • Views 586 views
  • Likes 3 likes
  • Comments 2 comments
  • monitor
  • node.js
  • slack
  • cronitor
Related
Recommended

[Upcycle It] WiFi Connected Smoke Detector #5: Monitor The Monitor

vlasov01
vlasov01
23 Apr 2017
<< Previous

Project Index

Next>>

 

Questions about risk management

In the comments to my last week blog post mcb1 and DAB brought to my attention importance of exception handling.

The following questions needs to be answered:

  1. What happens when communication from a detector not received in a preset time?
  2. How to verify connections and operating of sensors?
  3. What happens when there is more then one detector in the same area and one of them stops reporting?
  4. What happens when the only detector is in 'maintenance' or removed?

 

Make it safer

I decided to revisit the original design to address the first and the second question. At least I'll know when I'm at risk.

I've added two new error processing components. One is internal Error Processing deployed on Intel Edison. It's main responsibility is to communicate errors from other processing components and monitor detectors disconnects. In addition, it will establish a heartbeat communication with External Monitoring. In case internal Error Processing fails, the External Monitoring will detect loss of communication and will send alert ("deadman switch").

 

image

External Monitoring

On the role of External Monitoring I'm considering a Cronitor service. It has capability to detect disconnection, has integration with Slack. This integration with Slack channel requires only configuration changes.

image

Cronitor service has several options. I've chosen Free Cronitor option. This service is free for a single monitor, but can be extended if required.

The code for the hearbeat is pretty straightforward:

// Heartbeats API setup
var heartbeats = require('heartbeats');

// a heart that beats every 5 minutes.
var heart = heartbeats.createHeart(5*60*1000);
var request = require('request');

heart.createEvent(1, function(count, last){
var ping = 'https://cronitor.link/'+process.env.CRONITOR_MONITOR+'/complete?auth_key='+process.env.CRONITOR_AUTH_TOKEN;

request(ping, function (error, response, body) {
   if (!error && response.statusCode == 200) {
     console.log(body);
   }
 });
});

 

When the monitor goes done, then Cronitor communicates alert to Slack and sends another message when heartbeat recovers:

image

I still need to add functionality to Error Processing component. But it will be covered next week. Stay tuned.

  • Sign in to reply

Top Comments

  • mcb1
    mcb1 over 8 years ago +2
    It's always important to consider the 'exceptions'. I've seen some glaringly obvious (to the people that fix things) problems that the designer overlooked in theor quest to deal with the 'normal' process…
  • DAB
    DAB over 8 years ago +2
    Welcome to the wonderful world of Risk Analysis. In system design you have to look at all of the possibilities and establish redundancy so that the system remains reliable, even in somewhat strained conditions…
  • DAB
    DAB over 8 years ago

    Welcome to the wonderful world of Risk Analysis.

     

    In system design you have to look at all of the possibilities and establish redundancy so that the system remains reliable, even in somewhat strained conditions.

     

    The absence of data can be just as valuable as measured data.

     

    Understanding all of the information available helps you make a more robust design.

     

     

    DAB

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • mcb1
    mcb1 over 8 years ago

    It's always important to consider the 'exceptions'.

    I've seen some glaringly obvious (to the people that fix things) problems that the designer overlooked in theor quest to deal with the 'normal' process.

     

    Providing you have the two options (Disconnect Appliances, Notify Homeowner) you can always tweak it as you progress.

     

    Mark

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube