Things used in this project

Hardware components:
Intel.web.720.405
Intel Edison
×1
Grove 20starter 20kit 20plus 20  20intel c2 ae 20iot2 01
SeeedStudio Grove starter kit plus for Intel Edison
×1
Electric heating pad
×3
386 00
DHT11 Temperature & Humidity Sensor
×3
12002 04
Breadboard (generic)
×5
PC fan
×1
Software apps and online services:
Ha 2up iot
Amazon Web Services AWS IoT
Screen%20shot%202016 06 16%20at%2011.43.43%20am
Johnny-Five
Hand tools and fabrication machines:
09507 01
Soldering iron (generic)

Custom parts and enclosures

Final Product
Ljumo37vhouwobes0aau

Code

device-example.jsJavaScript
modified example code for connecting with cloud that turns on and off light.
/*
 * Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License").
 * You may not use this file except in compliance with the License.
 * A copy of the License is located at
 *
 *  http://aws.amazon.com/apache2.0
 *
 * or in the "license" file accompanying this file. This file is distributed
 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
 * express or implied. See the License for the specific language governing
 * permissions and limitations under the License.
 */


 var five = require("johnny-five");
 var Edison = require("edison-io");
 var board = new five.Board({
   io: new Edison()
 });
//node.js deps

//npm deps

//app deps
//const deviceModule = require('..').device;
//const cmdLineProcess = require('./lib/cmdline');

//begin module

function processTest(args) {
   //
   // The device module exports an MQTT instance, which will attempt
   // to connect to the AWS IoT endpoint configured in the arguments.
   // Once connected, it will emit events which our application can
   // handle.
   //
   const device = deviceModule({
      keyPath: args.privateKey,
      certPath: args.clientCert,
      caPath: args.caCert,
      clientId: args.clientId,
      region: args.region,
      baseReconnectTimeMs: args.baseReconnectTimeMs,
      keepalive: args.keepAlive,
      protocol: args.Protocol,
      port: args.Port,
      host: args.Host,
      debug: args.Debug
   });

   var timeout;
   var count = 0;
   const minimumDelay = 250;

   if (args.testMode === 1) {
      device.subscribe('topic_1');
   } else {
      device.subscribe('topic_2');
   }
   if ((Math.max(args.delay, minimumDelay)) !== args.delay) {
      console.log('substituting ' + minimumDelay + 'ms delay for ' + args.delay + 'ms...');
   }
   timeout = setInterval(function() {
      count++;

      if (args.testMode === 1) {
         device.publish('topic_2', JSON.stringify({
            mode1Process: count
         }));
      } else {
         device.publish('topic_1', JSON.stringify({
            mode2Process: count
         }));
      }
   }, Math.max(args.delay, minimumDelay)); // clip to minimum

   //
   // Do a simple publish/subscribe demo based on the test-mode passed
   // in the command line arguments.  If test-mode is 1, subscribe to
   // 'topic_1' and publish to 'topic_2'; otherwise vice versa.  Publish
   // a message every four seconds.
   //
   device
      .on('connect', function() {
         console.log('connect');
      });
   device
      .on('close', function() {
         console.log('close');
      });
   device
      .on('reconnect', function() {
         console.log('reconnect');
      });
   device
      .on('offline', function() {
         console.log('offline');
      });
   device
      .on('error', function(error) {
         console.log('error', error);
      });
   device
      .on('message', function(topic, payload) {
         console.log('message', topic, payload.toString());

         var relay = new five.Relay({
         pin: 5,
         type: "NC"
       });

         if (Number(payload)==1) {
           relay.close();
         }
         if (Number(payload)==0) {
           relay.open();
         }

      });

}

module.exports = cmdLineProcess;

if (require.main === module) {
   cmdLineProcess('connect to the AWS IoT service and publish/subscribe to topics using MQTT, test modes 1-2',
      process.argv.slice(2), processTest);
}

Credits

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Wrinkle
  • 201
  • 4

Work in progress

We are targeting mostly senior citizens: notifying them to take their medications, or reminding them if they miss one.

Wrinkle

Team git push --force

BitCoin Sensor - LinkIt One
  • 557
  • 14

Full instructions

An IoT solution for monitoring the price of Bitcoin with Visual and Auditory cues pertaining to the volatility of the the CoinDesk exchange.

Solar-powered Water Monitoring System
  • 2,188
  • 11

Full instructions

Build an online water monitoring system that never stops

LinkIt ONE IoT Demo
  • 2,689
  • 11

Full instructions

An IoT demo made by LinkIt ONE.

HTTF Radio
  • 1,719
  • 21

Work in progress

A radio that tunes in the year rather than the frequency.

HTTF Radio

Team HTTF Radio

StormSafe
  • 1,345
  • 11

Work in progress

A personal storm warning device with realtime lightning detection, and GPS-based weather alerts to keep you safe as you walk, hike, or bike!

StormSafe

Team BrainStorm

ProjectsCommunitiesContestsLiveJobsFree StoreBlogAdd projectSign up / Login
Respect project