Add a Cloudant database node

To encode a picture, you need to send the picture to a Cloudant database. To do that, you add a Cloudant database named pictures to the Node-RED flow.

To use Cloudant database nodes, you need to add this capability to the Node-RED installation on the Raspberry Pi.

  1. Open a terminal and run the following commands:
    cd ~/.node-red
    npm install node-red-node-cf-cloudant

    When you refresh the Node-RED flows running on the Raspberry Pi, you should see these additional nodes under storage:
  2. In the flow editor, use the new cloudant node and drag an output cloudant node (the bottom one) onto the canvas for the Raspberry Pi flow. Output nodes have the logo on the right side of the node.
  3. Create a database named pictures in the Cloudant database dashboard in the boilerplate application that you created earlier.
  4. Get the user name, password, and URL from the boilerplate dashboard under the Connection tab. Click View Credentials and copy the credentials to the database (user name, password, and the URL).
  5. On the Raspberry Pi, enter the credentials for the Cloudant database in the boilerplate on Bluemix.
  6. Invoke the Node-RED flow on Bluemix. Use the output Watson IoT node, select Quickstart, and enter a unique Quickstart id. Then, click Done.