This is a slightly unusual blog post since the scenario below has little business value, but maybe it gives people ideas how to leverage the Internet of Things service in Bluemix. During my vacation my son and I played with a new toy – a Lego Mindstorms EV3 robot. As far as I can tell after a week it’s a great way for children to start learning programming and a lot of fun. The robot comes with different types of sensors and a software to write programs to do certain things based on sensor data. For example a good first program is to write some code to tell the robot to drive forward as long as there is enough space.
For the fun of it I took it one step further and wrote some code to listen to sensor data and push it to Bluemix using the Internet of Things service and the Internet of Things boilerplate. We’ve come up with a little game where the robot needs to drive over various colors and the time is tracked. The robot can be moved via the Lego remote control or Android or iOS apps. The time is tracked and displayed in a web application where people can see their times in a high score list.
The goal of the game is to move the color sensor above the four colors. The robot starts at the wall, needs to return to the wall between each color and at the end. The touch sensor is used to control this.
The durations of the races are tracked and displayed.
To track the results the robot is connected to a PC via bluetooth. On the PC a desktop application written in .NET is running that listens for events via the Lego Mindstorms EV3 API. The program uses a MQTT .NET library to communicate to the Bluemix Internet of Things service. In order to register my robot (indirectly via the PC) I followed these instructions. After this I can see my device and the events on the Internet of Things dashboard.
The data is stored in a Cloudant database and visualized via a simple WebSphere Liberty application. I use the Node-RED app that comes with the boilerplate to put the data automatically into Cloudant.
Here is a bigger picture of the simple robot with the three sensors. Many more and more attractive robots can be built.