Pete Hoffswell
Published © MIT

Snowmelt System Monitor

My town of Holland, Michigan has a large snowmelt system. We need a way to monitor its performance over time. IoT to the rescue!

AdvancedShowcase (no instructions)Over 1 day3,410

Things used in this project

Hardware components

AT&T IOT Starter Kit
This great kit has a NXP FRDM-K64F MCU and an Avnet M14A2A Cellular Shield
×1
Grove starter kit plus for Intel Edison
Seeed Studio Grove starter kit plus for Intel Edison
Simply a must have for quick prototyping!
×1
Rain/Snow Sensor
×1
Adafruit Waterproof DS18B20 Digital temperature sensor
Adafruit Waterproof DS18B20 Digital temperature sensor
×1

Software apps and online services

AT&T M2X
AT&T M2X
AT&T Flow
AT&T Flow
PubNub Publish/Subscribe API
PubNub Publish/Subscribe API
mbed cloud IDE and Compiler

Hand tools and fabrication machines

mbed
Arm mbed

Story

Read more

Code

Snowmelt

C/C++
The snowmelt code is hosted at developer.mbed.org. From here, you can easily import it to your mbed IDE workspace. Just follow the link https://developer.mbed.org/users/petehoffswell/code/SnowMelt_Dist/
https://developer.mbed.org/users/petehoffswell/code/SnowMelt_Dist/

PubNub EON Charts

HTML
This code reads data and plots the data in various ways.
<html>
  <head>
    <script type="text/javascript" src="https://pubnub.github.io/eon/v/eon/1.0.0/eon.js"></script>
    <link type="text/css" rel="stylesheet" href="https://pubnub.github.io/eon/v/eon/1.0.0/eon.css"/>
  </head>
  <body>

    <center><h1>Smowmelt Monitor</h1></center>
    <div id="airtemp">Air Temp</div>
    <div id="probe0"></div>
    <div id="probe-overtime"></div>
    <div id="light"></div>
    <div id="wind"></div>

    <script>
      var pubnub = new PubNub({
        publishKey: 'pub-KEY',
        subscribeKey: 'sub-KEY'
      });
      eon.chart({
        pubnub: pubnub,
        channels: ['SnowMelt'],
        history: true,
        transform: function(m) {
          return {
            eon: {
              probe0: m.eon.probe0
            }
          }
        },
        generate: {
          bindto: '#probe0',
          data: {
            type: 'gauge',
          },
          gauge: {
            label:{
                format: function(value, ratio){
                  return value;
                  },
                },
            min: 0,
            max: 80
          },
          color: {
            pattern: ['#FF0000', '#FFFF00', '#00FF00'],
            threshold: {
              values: [20, 35, 50]
            }
          }
        }
       });
    </script>


    <script>
      var pubnub = new PubNub({
        publishKey: 'pub-c-1aa40d5d-c3f2-4694-a46c-9959c4573ce5',
        subscribeKey: 'sub-c-3c30710c-c491-11e6-add0-02ee2ddab7fe'
      });
      eon.chart({
        pubnub: pubnub,
        channels: ['wx'],
        history: true,
        transform: function(m) {
          return {
            eon: {
              temperature: m.eon.temperature
            }
          }
        },
        generate: {
          bindto: '#airtemp',
          data: {
            type: 'gauge',
          },
          gauge: {
            label:{
                format: function(value, ratio){
                  return value;
                  },
                },
            min: 0,
            max: 80
          },
          color: {
            pattern: ['#FF0000', '#FFFF00', '#00FF00'],
            threshold: {
              values: [20, 35, 50]
            }
          }
        }
       });
    </script>


    <script>
      var channel = "SnowMelt";
      eon.chart({
        channels: [channel],
        history: true,
        flow: true,
        transform: function(m) {
          return {
            eon: {
              probe0: m.eon.probe0
            }
          }
        },

        pubnub: pubnub,
        limit: 144,
        generate: {
          bindto: '#probe-overtime',
          data: {
            type: 'area',
            labels: true
          },
          axis: {
             x: {
               label: ""
             },
             y: {
               label: ""
            }
          },
          tooltip: {
            show: true
          },
          point: {
            show: true
          }
        }
      });
    </script>



    <script>
      var channel = "SnowMelt";
      eon.chart({
        channels: [channel],
        history: true,
        flow: true,
        transform: function(m) {
          return {
            eon: { light: m.eon.light }
          }
        },

        pubnub: pubnub,
        limit: 144,
        generate: {
          bindto: '#light',
          data: {
            type: 'area',
            labels: true
          },
          axis: {
             x: {
               label: ""
             },
             y: {
               label: ""
            }
          },
          tooltip: {
            show: true
          },
          point: {
            show: true
          }
        }
      });
    </script>

    <script>
      var channel = "wx";
      eon.chart({
        channels: [channel],
        history: true,
        flow: true,
        transform: function(m) {
          return {
            eon: {
                wind_mph: m.eon.wind_mph,
                wind_gust_mph: m.eon.wind_gust_mph,
                   }
          }
        },

        pubnub: pubnub,
        limit: 144,
        generate: {
          bindto: '#wind',
          data: {
            type: 'area',
            labels: true
          },
          axis: {
             x: {
               label: ""
             },
             y: {
               label: ""
            }
          },
          tooltip: {
            show: true
          },
          point: {
            show: true
          }
        }
      });
    </script>

<!--
   <iframe allowfullscreen="" border="0" frameborder="0" height="530" mozallowfullscreen="" scrollong="no" src="https://live1.brownrice.com/embed/cityofholland1/?skin=glow" width="740"></iframe>
-->
</body>
</html>

Credits

Pete Hoffswell

Pete Hoffswell

10 projects • 63 followers
Network Engineer for All the People. Internet advocate. Microcontroller Fan. Maker.

Comments