Giter Club home page Giter Club logo

iot-nodered's Introduction

Important Note

Node-RED nodes are moved from this repository to following individual repositories,

Node-RED sample

This node-red code has 2 sample programs

  1. Quickstart Flow
  2. Registered Flow

Quickstart Flow

This has a single flow Quickstart Flow from device

This is the sample program to send the following events from the Raspberry Pi to the Quickstart messaging service of IBM Watson IoT Platform.

The events that are emitted in this sample are:

  • CPU temperature
  • CPU Load
  • Simulated Sine wave to demonstrate the different events can be pushed to IoT Portal and visualized.

Connect

  1. Log in to Raspberry Pi. (Default login Username: pi Password: raspberry)
  2. Install node red from npm registry by running sudo npm install node-red
  3. Install iotcloudDev from npm registry by running sudo npm install node-red-contrib-iotclouddev
  4. cd to the node red directory
  5. Note down the MAC address of your raspberry pi which is needed for the quickstart site.
  6. Start Node-RED with sudo node red.js -f raspi_quickstart_event.json. (This file is present in the samples directory of the same folder, from where you downloaded this README.md)
  7. Open http://:1880/ in browser
  8. Double-click IoT device out and provide the following details a. For Connection select "Quickstart Mode" b. For Org Id enter "Quickstart" without quotes c. For DeviceType "iotsample-nodered" without quotes d. For DeviceID "b827ebb030a1" without quotes e. For AuthToken, keep it blank
  9. The device immediately starts publishing events. 10.These events can be seen on the quickstart dashboard by providing the MAC Address.

Registered Flow

This has 2 flows

  1. Registered Flow from device
  2. Registered Flow to device

Registered Flow from device

This is the sample program to send the following events from the Raspberry Pi to the Registered messaging service of IBM Watson IoT Platform.

The events that are emitted in this sample are:

  • CPU temperature
  • CPU Load
  • Simulated Sine wave to demonstrate the different events can be pushed to IoT Portal and visualized.

Connect

  1. Log in to Raspberry Pi. (Default login Username: pi Password: raspberry)
  2. Install node red from npm registry by running sudo npm install node-red (No need to do this step, if its done previously)
  3. Install iotcloudDev from npm registry by running sudo npm install node-red-contrib-iotclouddev (No need to do this step, if its done previously)
  4. cd to the node red directory
  5. Note down the MAC address of your raspberry pi which is needed for the registered flow
  6. Register organization, device id, authorization tokens as these are needed for registered flow
  7. In the
  8. Start Node-RED with sudo node red.js -f raspi_registered_event.json. (This file is present in the samples directory of the same folder, from where you downloaded this README.md)
  9. Open http://:1880/ in browser
  10. Double-click IoT device out and provide the following details a. For Connection select "Registered Mode" b. For Org Id enter the org id obtained after registering your organization, for e.g. "w8wx0" without quotes c. For DeviceType enter the deviceType as entered while registering the device, for e.g. "iotsample-raspberrypi" without quotes d. For DeviceID enter the deviceid as entered while registering the device, for. e.g. "b827ebb030a1" without quotes e. For AuthToken, provide the Auth Token thats returned, after registering the device
  11. The device immediately starts publishing events. 10.These events can be subscribed to by using either an application deployed on Bluemix or using an MQTT subscriber

Registered Flow to device

This is the sample program which subscribes to events sent to Raspberry Pi from the Registered messaging of IBM Internet of Things service.

Connect

  1. Log in to Raspberry Pi. (Default login Username: pi Password: raspberry)
  2. Install node red from npm registry by running sudo npm install node-red (No need to do this step, if its done previously)
  3. Install iotcloudDev from npm registry by running sudo npm install node-red-contrib-iotclouddev (No need to do this step, if its done previously)
  4. cd to the node red directory
  5. Note down the MAC address of your raspberry pi which is needed for the registered flow
  6. Register organization, device id, authorization tokens as these are needed for registered flow
  7. In the
  8. Start Node-RED with sudo node red.js -f raspi_registered_event.json. (This file is present in the samples directory of the same folder, from where you downloaded this README.md)
  9. Open http://:1880/ in browser
  10. Double-click IoT device In and provide the following details a. For Org Id enter the org id obtained after registering your organization, for e.g. "w8wx0" without quotes b. For DeviceType enter the deviceType as entered while registering the device, for e.g. "iotsample-raspberrypi" without quotes c. For DeviceID enter the deviceid as entered while registering the device, for. e.g. "b827ebb030a1" without quotes d. For AuthToken, provide the Auth Token thats returned, after registering the device e. For Command, provide '+' to get all commands f. For format, provide "json"
  11. The device immediately starts subscribing to events. 10.These events can be published to by using either an application deployed on Bluemix or using an MQTT subscriber

Troubleshooting and Development

  • Check the node-red.out file for diagnostics from Node-RED.
  • You can connect a browser to port [raspberrypi-address:1880] in order to develop the flow in the Node-RED UI, activate debug nodes to show events emitted.
  • If git is not installed, install it using sudo apt-get install git

iot-nodered's People

Contributors

amitmangalvedkar avatar jeffdare avatar sathipal avatar knolleary avatar dwc1 avatar dceejay avatar slaupster avatar amcgail avatar benbakowski avatar timjacobi avatar jospaul1 avatar

Watchers

Spencer Tom Tafadzwa Chirume avatar  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.