Coder Social home page Coder Social logo

pier9.iot's Introduction

Internet of Things (IoT) for Pier 9

Node.js npm Viewer Platforms License

Note: For using this sample, you need a valid oAuth credential for the translation / extraction portion. Visit this page for instructions to get on-board.

Note: It also relies on the https://github.com/cyrillef/PlougonvelinNode Project which is the real brain running on a BeagleBone Black device which controls the shutters, lights, and sensors.

Live demo at

http://pier9.autodesk.io/

Description

This sample uses the Autodesk Forge Viewer to display my house, and has a Forge Viewer IoT Extension to connect to my house BeagleBone Black IoT implementation via a secured socket.io connection. However, the security layers is implemented on the BeagleBone Black device.

Dependencies

This sample is dependent of Node.js and few Node.js extensions which would update/install automatically via 'npm':

  1. Node.js

    Node.js - built on Chrome's JavaScript runtime for easily building fast, scalable network applications. You can get Node.js from here

    Node.js modules:

    "express": "4.x",
    "morgan": "1.x",
    "request": "*",
    "socket.io": "0.9.x",
    "view-and-data": "^1.0.6",
    "bower": "^1.6.5"
    
  2. Require.js - RequireJS is a JavaScript file and module loader. It is optimized for in-browser use, but it can be used in other JavaScript environments, like Rhino and Node. Using a modular script loader like RequireJS will improve the speed and quality of your code., available here.

  3. jquery.js - jQuery is a fast, small, and feature-rich JavaScript library. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers. With a combination of versatility and extensibility, jQuery has changed the way that millions of people write JavaScript., available here.

  4. smoothie - A JavaScript Charting Library for Streaming Data, available here

All these libraries can be install via bower "async": "1.4.2", "jquery": "2.1.4", "requirejs": "2.1.17", "domReady": "2.0.1", "view-and-data-toolkit": "*", "smoothie": "~1.27.0", "requirejs-plugins": "~1.0.3"

Setup/Usage Instructions

The sample was created using Node.js and javascript.

Deploy on Heroku

Deploy

Once the Heroku server is setup, go on your Heroku Dashboard, select this new server, next Settings, and press the 'Reveal Config Vars.' button.

Create 3 variables like this:

a. PORT = 80

b. CONSUMERKEY = <your consumer key>

c. CONSUMERSECRET = <your consumer secret>

Next restart the server.

Deploy on a server or local machine

  1. Download and install Node.js (that will install npm as well)

  2. Download this repo anywhere you want

  3. Execute 'npm install', this command will download and install the required node & bower modules automatically for you.

    npm install
    
  4. Set your credential keys to run the sample: use system environment variables

    • Define a CONSUMERKEY and CONSUMERSECRET system variables from the console or script which will launch the server.
      • Windows
      set CONSUMERKEY=xxx
      
      set CONSUMERSECRET=xxx
      
      • OSX/Linux
      export CONSUMERKEY xxx
      
      export CONSUMERSECRET xxx
      
      or passing on the command line to the Node.js process
      sudo [PORT=<port>] CONSUMERKEY=xxx CONSUMERSECRET=xxx node server.js
      

      Replace keys placeholder xxx with your own keys.
  5. Edit file ./html/js/app-init.js line #39-41, and set your model URN
    Edit files in ./html/data to describe your model / sensors settings.

  6. You are done for the setup, launch the node server using the command '[sudo] node server.js'. sudo is required only on OSX and Linux.

    • Windows
    [set PORT=<port>]
    node start.js
    
    • OSX/Linux
    sudo [PORT=<port>] node server.js
    

    Note: the port argument can be omitted and default to port 80. If port 80 is already in use by another application (like Skype, or IIS, or Apache, ...), you can use any other free port such as 8000, 3000, etc... But in the next section you would need to specify the port to use, i.e. http://localhost[:port]/
  7. If you choose option b. for setup, launch http://localhost[:port]/setup.html, otherwise you are good to go with http://localhost[:port]/


License

This sample is licensed under the terms of the MIT License. Please see the LICENSE file for full details.

Written by

Hans Kellner, Autodesk, Inc.
OCTO

Alex Chein, Autodesk, Inc.
PDG

Cyrille Fauvel (Autodesk Developer Network)
http://www.autodesk.com/adn
http://around-the-corner.typepad.com/

pier9.iot's People

Contributors

cyrillef avatar

Watchers

whaison avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.