An afternoon of Raspberry Pi with IoT Foundation

Share this post:

IBM’s Watson service is famous for its Chef capabilities, while over at Internet of Things (IoT) Foundation, we like beer and Raspberry Pi.

I recently was excited to receive a Raspberry Pi kit in the mail. I’d like to walk you through how I managed to connect a Raspberry Pi to the Bluemix IoT Foundation service in a few hours. I had heard that you should be able to complete this “in the time it takes to drink 2 beers”. Because it was during my normal workday, I had to forgo the beers and got interrupted by a conference call but still was able to complete this task the same afternoon I received the package in the mail.

The package arrived shortly after lunch; I opened it and saw it was in bits and pieces and would require assembly. I am not a hardware person, having spent most of my career doing software support so expected this to be a challenge.

UPS delivery

I found this YouTube video helped me open the protective plastic case without cracking it:

Once I had the parts installed in the protective case, I was ready to install the Raspbian operating system. I attached a keyboard and mouse to the USB ports. I connected the device to TV monitor using the HDMI cable and plugged it into the electrical wall outlet using the power supply adapter.

Plugged in Pi

When ordering the Raspberry Pi, I had purchased a kit which included a pre-loaded NOOBS (New Out of the Box ) SD card to jumpstart the configuration process. However, my first attempt at installing the Raspbian OS encountered a glitch and failed. I must have done something wrong and now it seemed my NOOBS SD card was no longer working; I tried again and was beginning to think I might have to download and reformat my SD card (which can be done using a Raspberry Pi NOOBS download). Fortunately, I did not have to do that; by using the shift key during reboot of the device I was able to get back into the NOOBS setup.


Once I had the Raspbian OS installed, I chose the boot option to require login (the default ID and password had been presented on the screen during the OS installation). After finishing the setup, I did a reboot and logged in then entered the command startx to start up the GUI.

I then followed directions in the Raspberry Pi recipe. I was able to quickly visualize my data online using the device ID I determined from the command service iot getdeviceid and inserting the ID as the MAC address for visualization of the temperature and cpu load being published by the raspberry pi device.

Visualized Raspberry Pi

Now that I had successfully connected to the cloud and could see the data being published, it was time for the next step—register my device to Internet of Things Foundation. I already had a Bluemix account, so I needed to add this device to my organization. (If you don’t have a Bluemix account, sign up for the free trial). I created an IoT service in Bluemix, then opened the service info and clicked LAUNCH to be directed to the IBM Internet of Things Foundation website where I could add my device info.

Launch IOT

On the IOT Foundation website you can add your device ID and get unique credentials including your device’s authentication token information. During the device registration process you will get file configuration information containing the following details, copy these when you get them.

  • Organization ID
  • Device Type ID
  • Device ID
  • Authentication Method
  • Authentication Token

The recipe also provides further information about how to store the credentials into the device configuration file.

After the iot process is stopped and restarted you can then see the events published by your device by viewing output on the devices tab of the IOTF website.

Connected Events Published

I did it! Even with the interruptions and mis-steps I went from out of the box, unpacking and assembling, then displaying events through both quickstart and as a registered connected device in about 3 hours. I also configured the device to use WiFi so that I don’t have to use an Ethernet connection in the future. This was quite easy to do using the icon on the GUI desktop.

Raspberry WiFi

For the record, it does not take me 3 hours to drink 2 beers but I still consider this test a success and because I finished before 5 pm, I’ll be able to enjoy a refreshment soon… surely it’s already 5:00 o’clock somewhere.

More stories
May 1, 2019

Two Tutorials: Plan, Create, and Update Deployment Environments with Terraform

Multiple environments are pretty common in a project when building a solution. They support the different phases of the development cycle and the slight differences between the environments, like capacity, networking, credentials, and log verbosity. These two tutorials will show you how to manage the environments with Terraform.

Continue reading

April 29, 2019

Transforming Customer Experiences with AI Services (Part 1)

This is an experience from a recent customer engagement on transcribing customer conversations using IBM Watson AI services.

Continue reading

April 26, 2019

Analyze Logs and Monitor the Health of a Kubernetes Application with LogDNA and Sysdig

This post is an excerpt from a tutorial that shows how the IBM Log Analysis with LogDNA service can be used to configure and access logs of a Kubernetes application that is deployed on IBM Cloud.

Continue reading