Process your iPhone’s sensor data with an IoT Spreadsheet and MQTT

Did you know that you can visualize your iPhone’s sensor data on a
spreadsheet in real time without a single line of code? All you need is an iPhone and a Raspberry Pi 3 or 4. The necessary software is free and can be installed within minutes. This article and its four short video tutorials guide you through the procedure step-by-step.

In the screenshot above you can already see what we will achieve. When you rotate the iPhone, it will send its rotation data (along with all other sensor information) via an MQTT broker to the spreadsheet and both, the data and the visual objects, will react in real time.

(If you have never heard of MQTT, you might want to check out this video in which Roger Light, the project lead of the Eclipse Mosquitto project, explains what MQTT and the payload format JSON is all about. Don’t worry: MQTT is easy to understand. You don’t have to be a programmer.)

In the next image, you see the setup of our use case.

Setup of the demo use case

The spreadsheet is actually called a Streamsheet and since it is an open source project from the Eclipse Foundation, it is called Eclipse Streamsheets. Think of Streamsheets as an IoT or Stream Processing spreadsheet.

The beauty of a Streamsheet is that you can reuse all your knowledge from Microsoft Excel or Google Sheets while you build and deploy IoT or Stream Processing applications within minutes. Again, you don’t have to be a programmer. Very important: This is not low-code, this is really no-code.

One more important fact: Streamsheets are server-based. Unlike a desktop spreadsheet the logic continues to run even if you close the application window. Thus, you can build applications that run 24/7 day and night.

We also use the extremely popular Mosquitto MQTT Broker from the Eclipse Foundation. In the video, you will see that it is automatically installed when we install Eclipse Streamsheets.

To publish the sensor data of the iPhone via MQTT we use a free iOS app called “Cedalo MQTT connect” which you find in the Apple App Store.

By the way: Cedalo is the commercial sponsor of both of these Eclipse Open Source Projects.

In this tutorial, we use a Raspberry Pi as the hardware platform. Both, the Raspberry 3 and 4, will work. Of course, you can also use a Windows, Linux or macOS based system.

In the following video (part 1 of 4) we set up a fresh SD card image for the Raspberry Pi using the very-easy-to-use Raspberry Pi Imager that you can find on the official Raspberry.org website following this link.

If you have never set up a Raspberry Pi before, try it! Meanwhile, it has become very, very easy as you will see in this short video.

Part 1: Setting up the Raspberry Pi from scratch (1 minute 48 seconds)

After the first tutorial, we have a fresh Raspberry Pi up and running and we are ready to install Eclipse Streamsheets and Eclipse Mosquitto. Both server apps run in a docker environment.

On a Raspberry Pi, sometimes it takes longer to install Docker itself than the apps that run under docker. However, Cedalo provides a “one-script-does-it-all” script that installs Docker, Streamsheets and Mosquitto in one go.

You can simply copy the command for downloading and executing the script from our website and paste it in a terminal window on the Raspberry Pi desktop.

This simple step is demonstrated in this second part of our video tutorial.

Part 2: Installing Docker, Eclipse Streamsheets and Mosquitto (1 minute 42 seconds)

Now, you have Streamsheets and Mosquitto up and running. The next step is to install the iOS App called “Cedalo MQTT Connect” that I mentioned earlier. You find it in the App Store.

In the third part of the video tutorial we learn how to configure the settings of the app so that it communicates with Streamsheets via the Mosquitto Broker.

It is as easy as setting up an email account, meaning we are talking about no more than an URL, username and password, plus something that is called an MQTT topic, which is basically a data channel on the broker.

Part 3: Establishing the connection to the iPhone (1 minute 47 seconds)

At the end of the video we have the MQTT connection configured and a Streamsheet that already receives the sensor data in real time. (If no data appears, make sure you have activated the switch in the upper right corner of the iOS app).

In the final part of the tutorial, we build an actual Streamsheet application that receives the sensor values from the iPhone and processes the data on the sheet.

You will see that in addition to displaying the data in cells, Streamsheets can also link data to graphical objects. This gives you a wide range of options when it comes down to building dashboards or condition monitoring apps.

Part 4: Buildind the Streamsheet App (2 minutes 14 seconds)

Of course, this is only a very simple demo that shows the basic principles. One thing we do not cover in the video, is the fact that a Streamsheet is not only able to receive data but can also send to an MQTT Broker. Hence, Streamsheets can even control other devices and apps.

In addition to MQTT, Streamsheets supports many other protocols like HTTP, SMTP or Kafka. In the Premium version of Streamsheets, you also have support for OPC UA (client and server) which makes additional use cases in Industry 4.0 and Smart Factory possible.

This video shows one sample of an industrial use case with Streamsheets.

More videos of industrial use cases along with further information about the Cedalo platform can be found on www.cedalo.com.

Kristian Raue is co-founder and tech evangelist at cedalo AG. Until 2014 he was CEO & Founder of the BI vendor Jedox AG.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store