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.
- Open a terminal and run the following commands:
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:
- 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.
- Create a database named
picturesin the Cloudant database dashboard in the boilerplate application that you created earlier.
- 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).
- On the Raspberry Pi, enter the credentials for the Cloudant database in the boilerplate on Bluemix.
- Invoke the Node-RED flow on Bluemix. Use the output Watson IoT node, select Quickstart, and enter a unique Quickstart id. Then, click Done.