Changing the Colors of Sphero Balls dependent on the Personality of Twitter Users

Earlier this month I blogged about how you can steer a driving Android phone over the internet via IBM Bluemix and a Sphero ball. Since I’ll do some presentations about Watson this month I’ve extended the demo slightly based on the suggestion of my colleague Salil Ahuja.

Via a web application users can enter their Twitter names. The web application reads the last 200 tweets and sends them as input to the Watson Personality Insights service. The service uses linguistic analytics to infer personality and social characteristics, including Big Five, Needs, and Values, from text, in this example I use the Big Five personality traits. The highest of these five numbers is sent to a Node-RED flow which sends commands to the ball to change the color.

In my case “Openness” is the highest ranked trait which causes the ball to be red (maybe not most natural color though).

Below are some more details.

The web application is a simple web app running on Liberty. It uses Twitter4J to read the tweets and the Personality Insights API to invoke the Watson service. Then it parses the big five traits and sends the highest ranked trait to the Internet of Things service via  a Java MQTT library.

The Node-RED flow receives the highest big five trait via an Internet of Things input node. After this some processing takes place, where traits are mapped to colors and the colors are sent to the Android phone via a new command.

The native Android app uses the Sphero Android SDK to communicates with the ball via bluetooth protocol.