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.
- Click Manage Palette.
- Click Install.
- Search for the node-red-contrib-sensor-rotation-to-phrase node and install it.
- Drag the function sensor rotation interpreter node onto the canvas.
- Wire the output IBM IoT node to the interpreter
- 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.
- Click Done to save your configuration.
- Add a Watson text to speech
- Add a function node.
- Double-click the function node and add the following code:
msg.payload = msg.speech;
- Click Done to save your changes
- Add an output play audio node.
- Wire your nodes together so that the IBM IoT node connects to the interpreter, payload, text to speech, speech to payload nodes and ends with the play audio node.
- Deploy your changes.