Over a million developers have joined DZone.

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

· IoT Zone

Access the survey results 'State of Industrial Internet Application Development' to learn about latest challenges, trends and opportunities with Industrial IoT, brought to you in partnership with GE Digital.

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.

The IoT Zone is brought to you in partnership with GE Digital.  Discover how IoT developers are using Predix to disrupt traditional industrial development models.


Published at DZone with permission of Niklas Heidloff, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}