In this tutorial I will show how to create a Node-Red application to connect sensors and push the data into Cloudant. Then, using Custom SPSS Nodes developed using R (RCouchDB) we will get the data and start mining it! Hope you enjoy and learn a lot with this tutorial.


1. Open the web-browser and go to


2. If you don’t have an account on IBM Bluemix, click on « Sign Up ». If you already have an account, click on «Login » using your username and password.


3. Now you are the Dashboard, where you have a view of all your applications and services. Let’s create a new application, click on « Create an App »



4. You can create different kind of applications, depending you want to do a web-app, mobile app, etc. In this case let’s click in « Internet of Things Starter ».




5. Enter de name of your application, and click on Create. The application is going to be created an started automatically after a few seconds. As you can see, the « Internet of Things Starter » is going to create a SDK for Node.js and a NO-SQL Database Cloudant.




6. You have now an « Overview «  of your application. You can navigate to see the code, the configuration of memory, you can estimate the cost of this app in case you want to put it into production, and also you can add multiple services. In this case the application has as a service a « Cloudant » Database.


7. Click on the « Cloudant » service. You will have accurate information about the service. Click on « Launch » to open the Administration Console of the Database.


Here we can see the list of databases. In this case, we have only one called « nodered ». Let’s create a new one. Click on « Add New Database » and call it « sensordata ». In a few seconds your new database will be created.

8. Comeback to the « Overview » of your application, and open the application clicking on the URL.


9. This will open a new tab in your web-browser with « Node-Red in Bluemix ». Node-Red is a powerful visual tool for wiring the Internet of Things. Click on « Go to your Node-RED flow editor » button :



10. Here you will have the editor, a bit similar to SPSS, with nodes on the left and a canvas on the right. The nodes are classified by categories : Inputs, outputs, functions, social, storage, analysis and advanced.

From in « input » category, select an « iot-app » node and drag –and-drop it into the canvas. This is going to be the input of our data, and is going to be a sensor measuring temperature.

From the « output » category », let’s select a «debug » node. Double click on it and change the « Name » for « Sensor Data » :


From the « storage » category, select a «cloudant  output » node and put it into the canvas. Be careful because there are two different cloudant nodes available, please select the Output one. Double click on it an in « Service » you will be able to select automatically your Cloudant Service, and in Database please write « sensordata ». Change the name and put « Cloudant Database »


11. Connect the nodes like in the following image :


12. Since we don’t have a physical sensor to use, we will use a « Sensor Simulator » do to that. Let’s Set up the simulated device and connect it to the node-Red. Open the following URL :

This will open a sensor of Temperature, Humidity, Object Temperature. On the Top Right we will have the MAC address of the simulated sensor :

SPSS1013. Note down the MAC address of the simulated device, should be something like

  1. 37:E9:E4:06:8B:24.


14. Now return to your Node-RED workspace and double-click the iot node, which currently shows a Topic of “iot-2/type/${type}/id/${id}/(evt|cmd)/${event}/fmt/${fmt}”.


15. In the IoT App In node dialog, enter in the Topic field the value :


Replacing ${id} with your MAC address (in lower case and with no punctuation), then click OK.


16. The deploy button is now active in your workplace ; click it to deploy your flow.


17. In the « debug » tab, you should see now the data coming into your system.



18. In the sensor, click on the MAC and you will have a graph of your simulated data in real-time. You can change the values of the sensor and you will see how the chart is changing as well.



19. All this live data is being stored as well in the Cloudant « sensordata » database. Let’s come back to the Cloudant Administrator console and have a look there. We will see how it is being populated automatically.




20. Time to move to IBM SPSS Modeler to start to Mine the Sensor Data ! Since IBM SPSS Modeler doesn’t have any data source to connect to a Cloudant Database, we have created a new node for doing that.


21. Double-click in the « Cloudant » node, and insert the host, username and password of your Cloudant Service.  You can find it in the Bluemix application overview, clicking on the « Show Credentials » button :





22. Put the values in the SPSS node :


23. Click « OK » and RUN the steam on SPSS.



Once we are here, we can imagine ANY kind of SPSS data analysis…it is like DisneyLand of Analytics! In our case, we did a very simple data cleaning:


Result clean data:




In our case, we put 3 different sensors, simulating 3 different users:



Next tutorial will show con to put the data back to DB2 BLU “Warehouse service” of Bluemix and do Cognos report using the Embedded Reporting Service!

Join The Discussion

Your email address will not be published. Required fields are marked *