6. Install the community rotation-to-phrase node

You’ll download a Node-RED node that can interpret these changes as pitch and rolls, and construct English phrases based on these rotational movements.

  1. Click Manage Palette.
  2. Click Install.
  3. Search for the node-red-contrib-sensor-rotation-to-phrase node and install it.
  4. Drag the function sensor rotation interpreter node onto the canvas.
  5. Wire the output IBM IoT node to the interpreter
  6. Double-click the interpreter node to configure it. Set the following values:
    • Set the sensitivity to 0.5.This value is used by the node to determine whether a rotational motion has taken place. This number needs to be high enough for hand jitters to be ignored and low enough for a motion to be detected.
    • Set the listen/send toggle to Pitch 0 Roll 180.This is the motion that will be used by the node to signal the start and end of a phrase.
    • Set text string values for the remaining pitch and roll motions.You will use these string values to construct sentences that you will use in Lab 4 to direct the actions of the PLAYBULB candle.


  7. Click Done to save your configuration.
  8. Add a Watson text to speech
  9. Add a function node.
  10. Double-click the function node and add the following code:
    msg.payload = msg.speech;
    return msg;
  11. Click Done to save your changes
  12. Add an output play audio node.
  13. Wire your nodes together so that the IBM IoT node connects to the interpreterpayloadtext to speechspeech to payload nodes and ends with the play audio node.
  14. Deploy your changes.