The best way to learn something is using it. That is the reason I decided to make something actually work for me as a way to explore IBM Bluemix.
There are a lot of stuff in IBM Bluemix. The first thing that draw my attention is some of the API that provide real life information. My targets are AlchemyAPI that provide filtered news data, and Weather Company Data for IBM Bluemix. So, my project is to develop a system that can draw data that make sense to me from this 2 APIs, and present them nicely to me.
After 7 months of development, this project comes to a point that fulfill almost all my wishes. So now it is the time to slow down and do some documentation. In this post, I’ll outline the architecture of this project.
Before I jump into the technical detail. I need to describe what this project do. This project, I called it “IOT Information Display”. It is a device with a small screen that display weather data of the device position, and filtered news headlines. It should be suitable to sit on my desktop and always on. So I can see the information any time. There is an Android App that I can use to change the device position setting and the news filtering rule.
For weather information. It can display current temperature and weather status. On the same screen it shows the temperature forecast of the coming 24 hours, and the probability of rain in the coming 24 hours in a chart. For news, it simply display headline one by one. I can tab on button to make it send the detail and source URL of such news to me in a email. There is another that can make it read the news detail with the speaker.
I used Raspberry Pi 3 as the core hardware, and I added the official 7” touchscreen for Raspberry Pi. I picked up an 3D printable enclosure from Thingiverse to support the screen, and I added an extra compartment to house the speakers. I picked a pair of 0.5W speakers. I used a USB sound module for sound output. It is not a must but it provides a sound input so it will allow me to add a microphone input to the project later on. Since the sound signal from the USB sound is too weak. I needed to add an amplifier breakout board to increase the sound volume.
After this foundation was built, I added extra services that I need in Bluemix. AlchemyAPI and Weather Company Data API was the core. Also I need to add Watson Text to Speech API for news reading. As Bluemix does not provide a SMTP service, I used the Mail API service provided by mailgun.com for email sending. So the entire backend is on the cloud. And, if you play carefully, it can be totally free.
FrontendOn the client side, the OS for Raspberry Pi is Raspbian jessie. The client program is a Java Application. The Bluemix IOT comes with a Java API that allow programmers sending messages between the device and the Node.js platform easily. In the Java client application, I added a few library for some special feature. First I added JFreeChart library for chart rendering. And I need the Pi4j API for GPIO control, since I need to use GPIO to perform some digital control on the amplifier breakout. The worst problem I had during the frontend development was media playback, as I found there is big limitation on media format support in the Java Runtime for Raspberry Pi. Since the Watson Text to Speech API would return speech data in OGG format. It is difficult for a Java application to play a media file in this format on Raspberry Pi. My final solution is gstreamer. Gstreamer is a very flexible library for media processing and playback. It has a Java binding. So I can integrate it into my project.
Later on I shall share some interesting technical topics about this project. Stay tuned for my future posts.