This is not the usual RTC API post although it has something to do with RTC in the long run, I hope. I have been tinkering and found some interesting things I wanted to share.
Since beginning of the year I have been a part of what is now the IBM Watson Internet of Things (IoT) business unit, working in the Unleash the Labs team. Like my colleague Tim I am currently involved with our CLM solution which basically provides the development teams with the required capabilities to plan, develop, build and test.
Internet of Things
Internet of Things means that more and more devices interact, provide and share data in the internet. This basically means these devises will have more and more software, sensors, processor and network capabilities. The software as well as the devices need to be planned, developed integrated, run and maintained. That is basically what our CLM solution is for. Interaction also means to make the data available and to provide services based on them. Bluemix is a cloud platform that allows to do this.
It is not obvious to everyone, but in the last 20 years software has crept into almost all devices. From airplane to electrical toothbrush, software is embedded everywhere and provides more and more of the added value to make the difference over the competition.
In the past the software embedded in most products usually worked isolated from the environment it did what it was made for, maybe used sensors and motors to interact and control, but most of the data was isolated in the system. The devices were often not connected and did rarely provide data outside of the system. For some time sensors in cars where often added for specific subsystems and the data was rarely available or shared with other subsystems.
Since connectivity to the Internet, even mobile, has become reasonably cheap, recently more and more products can also be connected to the Internet. Products in the past have usually be isolated and only used the data directly available to them. With reliably internet connections the products can also provide life data or use data provided somewhere else. The potential benefits for the user are typically provided by integrating the device data with other data or services available in the internet. It is nice that your runners watch can record your GPS position. The real benefit is to be able to see the pace data in a map and to understand how you improved over time. So the next value chain will be in integrating multiple systems and data sharing. Devices will become chatty and integrated in The Internet of Things.
Today, Jet engines of huge passenger airplanes constantly report their status over satellite and other connections and the company that built and maintains them uses this data to plan maintenance and detect possible issues before they become an expensive problem.
Similarly, today your toothbrush might be able to tell you that you are pressing it too much or not enough onto your teeth. Pretty soon it might be able talk to your health insurance company about your tooth brushing habits and together with the data of your runners watch, hopefully, get you a rebate.
There are a lot of new business models, benefits and services waiting to be found and implemented using the Internet of Things.
This can be great or not so great, so as a user it might be a good idea to carefully check which data you want to share, who benefits from that data and who can see or use it. As the borders between local devices and data and the internet are getting thinner it can be hard to even judge who could access which data and what data you share. If your local reality and devices you rely upon is so interwoven with the internet, it might also be good to consider that this makes your devices and infrastructure vulnerable to break downs, errors and attacks. It is, to some extent, up to us users how the devices, services, data sharing and usage will look like in the future and how dependent we are on it. The truth is, we are heading into the direction of the Internet of Things today, and fast.
Other than in George Orwells novel Nineteen Eighty-Four, we are actually paying for the cameras, microphones and network connection ourselves rather happily and carry them around with GPS tracking too! 8). It is worth knowing this book. With its content in mind consider some of the measures and desires of governments, intelligence and security services performed or discussed in the past years.
Another author that discusses the consequences of these developments in his books is Daniel Suarez. Check the novels Daemon, Freedom and Kill Decision. Also check other SF, especially the Cyberpunk genre.
Obviously most of the literature above shows the bad side of the possibilities. I have read most of the books above, so I can talk about them at least a bit. I will try to create a reading list here if I come across good books or get suggestions from my peers. Any suggestion in the comments will be welcome, as well.
Our technology is even more advanced than a lot of these authors expected it to be. And it is worth having and extending it, as well.
Anyone who has used an app that helped managing travel and connections does not want to miss that anymore. There is also a lot of potential to improve the value of this information and connectivity. Here in Europe we have something called “Public Transportation” in most of the areas, not only in the metro-pol regions. Bus, subway, train it is a great system. The software however, that is supposed to help me with public transportation in my region is sub optimal, to say it nicely. Basics such as access to favorites, clearing input fields or searching for hubs based on the position are not existent or hard to find. Frustrating. It does not require a genius to find a better design, I think. Today a lot of good ideas also suffer from inaccessibility of information. For example travel apps are often not allowed to use data available for regional/city travel. The local company has the IP for that data. Even if there would be a better system across the country or Europe the IP of the data prevents its more global usage and success.
As student I was involved in the development of embedded software for print products.
Back then embedded software development used to be challenging. The electronics was usually custom designed around a special CPU. Memory, usually static RAM was expensive and scarce. DRAM was usually not supported in these embedded devices. There were all kinds of development environments such as cross compiler and real time operating system (RTOS) provided by specialized companies or in-house developed. If you were lucky you had a debugger. Debuggers for embedded devices often required special and expensive hardware to support them. Reasons where that there was no standard connection available that could be used, the available resources where an issue too. also keep in mind that embedded systems often control machines. You can’t just set a break point in the control code if the machine is continuously running, without potentially breaking the controlled process. So often you could only debug by printf().
Later in the last years before I joined IBM Rational 2001 I was involved with developing this Nexpress 2100 printer. The Nexpress 2100 was a system of systems with multiple CPU’s and custom I/O electronics coordinating motors, chargers, heaters and other electrical devices that coordinate over a network and also communicate to other devices that provide the printing data. I found some pictures and videos that show it in action. It was a huge machine with its own environment and air condition system and loads of moving parts. It was a very interesting task, and we at least had chosen to use various tools that supported debugging the system.
Still, to set up the development environment and to bring up your CPU board with the RTOS of your choice often was a challenge already. Running a full UNIX system on an embedded device was not an option, the processors simply did not have the performance or the resources for this.
It was also pretty unlikely to be able to do anything without electronics design support to build the boards and get the sensors and actuators connected back then.
Raspberry Pi Unleashed
So back in the day it was pretty hard to get embedded systems to work. But when I saw Tim’s post “My first foray into IBM Internet of Things Foundation” I thought that I wanted to refresh my experiences, play around with something like this and see how things progressed over the last 15 years. I always need to do some real work to learn how things work (one of the reasons that I create working examples for the RTC API). So I decided to get stuck in.
The idea for this series of posts is to
- Talk about the Internet Of things
- Get a small device up and running and share the experience and learning
- Show some interesting things that one can do with this kind of devices
- Get a development environment up and running that includes RTC/CLM to develop software for such a device on my laptop using a cross compiler
- Get the GrovePi+ up and running in a Docker image and connected to Bluemix
Shopping Options and Considerations
In hindsight, if someone wants to get into this I would suggest to
- Only order the Raspberry Pi and get some LED for the GPIO
- Get Tim’s shopping list with the GrovePi+ but add at least one LED and possibly some of the cool additional sensor and output devices
- Go bananas and build a RPi Cluster for a Docker Swarm
The robots are also tempting!
Option 1 basically allows you to stay away from the hardware aspect more or less or only touch it by blinking the GPIO based LED. This is the least expensive start. If you find it interesting you can always add more later.
Option 2 with the additional LED allows you to follow the GrovePi+ setup and see the LED work very early. Additional input and output devices are certainly fun and there are interesting choices such as GPS and motion sensors! I was able to set up the GrovePi+ using the Python examples and the Grove – Barometer (High-Accuracy) as well, but a flashing LED is probably more impressive.
Option 3 is probably a bit odd, but maybe fun! See the section Docker RPiCloud below for more information.
It is necessary to have a card reader/writer that can be used to write the initial operating system to the micro SD card. If your computer does not have one built in, there are small cheap devices with USB connector available for the various common types of laptops and desktops.
8GB for the micro SD should be enough. It makes sense to rather buy two or more micro SD cards than a bigger one. Multiple SD cards allow to have different setups for the RPi that can be changed quickly.
After playing around with the RPi for a while, I think it makes sense to have some kind of case that protects the device and prevents short circuits. It has to be able to contain the GrovePi+ if you use it.
Although it is not strictly needed it is a good idea to have a Monitor or TV set with HDMI input and cable and a USB mouse and keyboard available. This makes it easier to play around with the Raspberry Pi to get started. There are multiple options to get the Raspberry Pi up and running the first time. Some require a mouse and keyboard directly connected to the RPi for the first steps e.g. to see and monitor the first boot process, choose the operating system to be installed and to set some defaults for the RPi.
When I started, I used an old USB keyboard but found the cable irritating and pulling at the RPi. I had an old Mouse that uses a wireless USB connector that also allows to hook up a keyboard. The “unifying” interface is stable since some years now and I ended up buying a small keyboard in addition to the existing mouse similar to this combo. This is ideal as I can move these devices out of the way if they are not needed.
Wireless network is not necessarily supported by all packages or configured when bringing the RPi up the first time, so an Ethernet cable is important for the first steps. In any case you need to be able to find the IP address of the Raspberry Pi. So having access to the DSL or cable modem router is a bonus and helps identifying this IP address.
If possible, I would suggest to set up your router to always provide the same IP address for the Raspberry Pi. In this scenario you can use the stable IP address of the RPi to establish a remote connection and can work without a connected display or TV set. If this is impossible, is necessary to use special tools such as nmap or Zenmap to identify the IP address of the Raspberry Pi to establish the remote connection.
Getting Started with the Raspberry Pi
Follow the Quick Start Guide for the detailed setup information. This is just a short summary of the steps you have to do to get started with the Raspberry Pi, to give you an impression how quick and easy that actually is.
The first step would be to bring the Raspberry Pi up the first time. There are small differences depending on the operating system you are using. The general steps are pretty much the same, but the number of auxiliary tools needed might be different.
- Download the Operating System (Raspbian aka Jessie) image / OS Setup tool (NOOBS) or other images for the Raspberry Pi
- Download the format program for the SD card
- Download a tool to write an image ISO file to the SD card
- Download remote connection tools if needed e.g. to be able to use SSH to connect to the RPi
- Put the Operating System for the Raspberry Pi on the SD card, e.g. for NOOBS or if you use an image
- Insert the SD card into the Raspberry Pi
- Connect network and peripherals to the Raspberry Pi
- Power up the Raspberry Pi
- If you use NOOBS, choose the OS’s to install on the Raspberry Pi
That is all for now. You are done. There is a full blown operating system on your Raspberry Pi. Most likely a Linux based operating system, but not necessarily. There are other choices available. NOOBS has Windows 10 IoT available as well.
You can now work with the keyboard and mouse on the HDMI connected screen.
Or, you use an SSH client such as Putty or whatever is built into your operating system to connect to the Raspberry Pi. Most of the additional work I did was using an SSH shell from my laptop. The reason is that I have two screens then and copy paste and documenting with screen shots is so much easier. Make sure that SSH is installed and enabled, check the description of you image for hints how you should connect.
In comparison to 15 to 20 years ago, this process is so easy, anyone should be able to do this. The other aspect is that the Raspberry Pi is very affordable. The Raspberry Pi comes with images that directly support a media library or device to display videos or other media on a TV set. So there is some immediate purpose it can serve. In addition it provides you with a platform that can be used to develop and run applications. Linux has all the needed editors and compilers available and other language choices are possible. The system can act as a server as well as a client, dependent on what is needed.
I am quite impressed. There is also infrastructure available to support class room use and a lot of example projects, YouTube videos and companies providing additional devices.
The image below shows my RPi with its peripherals. It is connected to Ethernet, but wireless is functional and could be used as well. The keyboard and the mouse are connected wireless as well. The Raspberry Pi is connected to a monitor and runs X-Windows. There are various flavors of operating systems and images available. Above is a full blown Raspbian which can be used as desktop with keyboard and mouse.
You can install media library and home automation support in addition. You can get images pre configured for media library and home automation services. There are other options available such as Windows 10 IoT and more if you search the internet.
You can also get for example a Raspbian Lite image which is stripped down to a minimal footprint which you can then extend with what you need. It still supports access using mouse, keyboard and monitor, but does only boot up into a terminal mode. It is not necessary to have a mouse, keyboard and monitor/TV connected. It is possible and sometimes easier to use a remote connection.
If I have to follow more complex tasks from a description to set up something, I usually don’t use the keyboard and mouse directly connected to the Raspberry Pi. I rather use a SSH shell connection (e.g. using Putty on Windows) to the RPi. This allows copy and paste as well as screenshots to create documentation. The image below shows a connection to the system above using putty .
The default user for the raspbian image above is pi, the password raspberry. Consider your keyboard layout, dependent on how you connect and what keyboard settings you have the ‘y’ key could actually map to ‘z’.
If there is no need for a full blown operating system and you want to rather do some hardware related work, have a look at the Arduino. It is cheaper and has a more hardware control focus. The Raspberry Pi can control hardware as well using the GPIO but it is more expensive and has more overhead in development and OS.
In the first days after I received the Raspberry Pi but, due to shipping, not yet a GrovePi+ board and sensors. So I looked around in the internet what you could do with a plain Raspberry Pi. I ran into this blog from Hypriot that talked about running Docker on the Raspberry Pi.
I had actually looked into Docker recently, so I decided I’d try it out. It really worked very well for me. If you follow this blog, you end up with a system that has a Docker host and a Docker daemon running on the Raspberry Pi and can run Docker images on that RPi. Here is a reference to the Docker architecture.
You have to keep in mind that Docker is not a full blown virtualization. That makes Docker Images dependent on the architecture of the Docker host. To run Docker images an a Raspberry Pi, you have to provide them for the ARM platform. The blog authors already ported Docker and provide several images for the Raspberry Pi.
And there is more. Several people have created custom Raspberry Pi clusters. There is also a company that provides sets to build Raspberry Pi Pico cluster with 3 to 100 nodes. You can run Docker swarms on these clusters.
That is incredible when I did my Diploma Thesis working on a parallel computing system based on Transputers 32 nodes was some kind of super computer. I have to assume that in comparison to the Raspberry Pi Transputers are actually not that fast anymore. So it is possible to setup a small “Supercomputer” to explore parallel computing for a reasonable price and put it on your table.
So, if I have time, I will try if I can create a Docker image that contains the software required to run against Bluemix and has the GrovePi+ and the sensors configures. I am curious what happens if one tries to run multiple containers. As long as the sensors are only read, I assume everything is going top be OK. But we shall see.
The experience with the Raspberry Pi was very different from my experience with embedded development in the past. If you had more than a terminal on your embedded device, you where lucky.
I haven’t yet tried debugging and setting up a cross development environment up on my laptop, but I am looking forward to that too. Getting up the GrovePi+ I/O board and the sensors will be the next challenge.
Stay tuned, if you are interested in the Internet of Things. If you like to tinker with it yourself, get started. It is very easy to approach these days and there are a lot of interesting example projects out there you could follow.
The next post will talk about bringing up the GrovePi+ and more tinkering. I don’t yet know the details.