Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


...

Info
titleGoal


Excerpt

Build a control loop between sensors and actuators. Understand that the IoT is composed of different technologies communicating together.

Table of Contents

The Setup

In this setup, three Philips HUE lamps are connected (through a Philips HUE bridge) to the instructor's computer. A program runs on that computer which connects to the Watson IoT Platform and subscribes to device commands for the Philip HUE lamps. This allows you to send commands into the Watson IoT Platform to control the lamps.

Gliffy
imageAttachmentIdatt110823201
namebluemix_setup_part5
diagramAttachmentIdatt110823192

Info
titleGeeky detail

The instructor created three devices of device type "lamp'' on the Watson IoT Platform, one for each lamp in the room.

What runs on the instructor's computer is an instance of Node-RED and the Philips HUE drivers. These drivers implement the Philips HUE bridge API.

The Node-RED instance connects to the Watson IoT Platform, listens for commands for the three "lamp" devices, and forwards the contents of those commands to the Philips HUE drivers.

Turn On the Light!

First, create a new flow (tab) on your Node-RED instance. You need to send a JSON command to Bluemix with the following payload:

Code Block
{"on":true}

The instructor's computer is listening for commands addressed to the following devices ids: HUElamp_1HUElamp_2HUElamp_3

Image Removed

Follow the same pattern to turn the light off.

Change the light color

Here is the JSON format to change the light color. Can you make the light turn red?

Code Block
{"sat":254, "bri":254, "hue":20000}

The hue parameter corresponds to a color value between 0 and 65535.
You can change those values independently.
Refer to the Philips HUE bridge API for the full list of parameters (you have to create an account).

Control the lamp with a sensor

Instead of clicking on Node-RED manually to control the lights, use the sensor input to automate things.

Temperature sensor

Change the color depending on the temperature.

Magnetic Switch (door)

Turn the light on when the door is open.

Accelerometer

Change the brightness of one lamp depending of the angle of your mote.

...

Once you have completed Part 4, sky is the limit. Explore a couple of possibilities where to go from there.



If you have finished the rest of the unplugfest early, build something with the building blocks you just learnt about. Here are some ideas:

  • Build a dashboard to visualize the motes' data (hint: use the Node-RED node-red-dashboard extension)
  • Create a control loop: switch the buzzer on when the door closes
  • Implement your own idea!


Note
iconfalse
titleNavigation

Filter by label (Content by label)
showLabelsfalse
showSpacefalse
sorttitle
excerptTypesimple
cqllabel = "unplugfest"

...