Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
Showing results for 
Search instead for 
Did you mean: 
In this article I will briefly explain how you can build your own weather station and connect it to the  SAP Cloud Platform Internet of Things in the Neo environment.

It is a good example to familiarize yourself with SAP Cloud.

This article is based in part on the Starter Kit for the SAP Cloud Platform Internet of Things.

Based on this article, I'll publish more. In the next article, we will program a SAPUI5 application to process the sensor data (UPDATE: 2017/09/02 - Next article is online).



You need:

  • One ESP8266 - NodeMCU

    • I use the NodeMCU Lua Lolin V3 Module

  • One DHT22 sensor

  • Three LEDs

  • A few cables and a Breadboard to connect everything


Get SAP Cloud Platform Developer Account

In addition, you need an account in the SAP Cloud. The trial is free. So just sign up:


Enable Internet of Things

Before you can use SAP Cloud Platform Internet of Things you have to enable it in your SAP Cloud Platform Cockpit.

In your SAP Cloud Platform Cockpit navigate to "Services" section and click on "Internet of Things" tile.

Press "Enable" button.

You are now ready for the next step and may already click on "Go to Service" link for that.


Create Device Information in Internet of Things Cockpit

The following description of interaction steps with the Internet of Things Cockpit shows you how to create a Device Type and Message Types associated with it as well as a Device instance.


Message Types

Press on Message Types tile in your Internet of Things Cockpit.

Press on the + button to add a new message type.

Create the following specific Message Type. In this format the weather data will be transmitted later.


  • celcius : double

  • fahrenheit : double

  • humidity : double

Important: Make a note of the Message ID. We need that later.


Create Device Type

Press on Device Types tile in your Internet of Things Cockpit.

Press on the + button to add a new device type.


  • Enter the Name "Weather Stations"

  • Select the message type you just created

  • Choose the message direction "From Device"



Create Device

Press on Devices tile in your Internet of Things Cockpit.

Press on the + button to add a new device.


  • Enter a Name for the new weather station

  • Select the device type you just created


Important: Make a note of the Device ID. We need that later.


Deploy the Message Management Service (MMS)

The deployment of the Message Management Service (MMS) step needs to be done from the "Deploy Message Management Service" tile in the Internet of Things Cockpit and deploys/starts the Message Management Service that takes care of receiving data from IoT Devices and sending to these.

Then assign the Role IoT-MMS-User for the newly deployed iotmms Java Application (otherwise you will be denied access to the iotmms Application URL with an HTTP Status 403 Error). To do so:

  • Go to the Java Applications tab in your SAP Cloud Platform Cockpit of your account

  • Choose the iotmms application

  • Choose the Security tab of the Application details and then select Roles

Do the assignment of the role to your user.

Once MMS is deployed and you have correctly done role assignment you can click on the iotmms Java application URL in your SAP Cloud Platform Cockpit and get to the MMS Cockpit as shown below. It provides access to the MMS API as well as a "Display stored messages" tile for the access to data received from IoT Devices.


Configure the Message Management Service

Our weather station will later publish its data via MQTT. We use the public and free MQTT broker

In order for the data to be stored in the SAP Cloud, we must also connect the MMS service to the MQTT broker.

Click on "Configuration" tile:

  • Enter the MQTT Broker Endpoint: tcp://

  • Enable the MQTT Connection !!!

  • Enter the Password: sapcloud

  • Enter the User Name: sapcloud


Test Connection

Click on "MQTT TCP/SSL API" tile.

Enter the Device ID and click Connect. Write down the MQTT topic. We'll need it later.


Now everything is set up in the SAP Cloud. We can now take care of our weather station.



The programming is done with the Arduino IDE. If you do not have it yet, install it.

Add in Preferences the "Additional Boards Manager URL":

Select the right board:



Install the required libraries. Search for:

  • DHT

  • ESP8266WiFi

  • PubSubClient

  • ArduinoJson

  • Adafruit Unified Sensor Driver


? Increase the MQTT library's memory limit ?

Open the PubSubClient.h file from the Arduino libraries folder. Increasing MQTT_MAX_PACKET_SIZE to 256.

On a Mac, this will be located at: ~/Documents/Arduino/libraries/PubSubClient/src/PubSubClient.h




Connect the DHT22 data pin to D6.
/ ( ) \
| [] [] |
| [] [] |
| [] [] |
| | | |

\ \ \ \__ Ground: Connect it to GND
\ \ \___ Nothing
\ \____ Data pin: Connect it to D6
\_____ Positive pin: Connect it to 3v3

Connect D0, D1, D2 each with one LED.



You can find the finished program for your weather station in my GitHub repository:

Download and open iot-weather-mqtt.ino with the Arduino IDE and adjust the configuration:

  • ssid : Your WiFi SSID

  • password : Your WiFi password

  • sap_iot_msg_id : The message ID you wrote down in the previous steps

  • mqtt_topic : The MQTT topic you wrote down in the previous steps


Upload iot-weather-mqtt.ino to your ESP8266.

When everything is working, all LEDs light up:

  • D0 : Power on

  • D1 : WiFi connected

  • D2 : MQTT connected

Messages should appear on the MQTT topic. Here's an example:




When everything is working, the sensor data are now stored in your Message Management Service Cockpit under Application Data.

I hope you enjoy discovering SAP Cloud. ?
Labels in this area