In this tutorial we will show you how you can bring your existing TTN devices to the Datacake platform and its smartphone app within minutes and completely without programming.

What is the Datacake Platform?

The Datacake platform is a low-code IoT platform that allows you to create dashboards using a drag and drop dashboard editor, define rules using the rule engine and send alerts via SMS, email or push.

There is also a video showing the Datacake Platform and it's TTN Integration in action:

Alternatively, you can browse our documentation to learn more about how to bring your TTN devices to the platform:

https://docs.datacake.de/v/english/integrations/the-things-network

https://docs.datacake.de/v/english/integrations/the-things-network/adding-gps-devices

Before we start

This tutorial expects that you have already successfully created and connected a device on the TTN Console and know how to deal with payload decoders.

In case you don't - here are some really good tutorials:

Encoding and Decoding Payloads on The Things Network - Tutorial
Sending data to the cloud is great! You’ve followed our Getting Started on The Things Network Tutorial and you have data streaming out of your Pycom Lopy4 and into your TTN account. There is just one problem, it’s all bytes! How do we get all that sweet sweet data into a usable format? We decode it!…
Using LoraWAN and The Things Network with Feather
Connect an Adafruit Feather M0 LoRa to The Things Network - a distributed LoRaWAN network designed for the internet of things by building a weather station.
Decrypting messages for dummies
Sorry for the basic question but - how can i decrypt message with “Payload Functions” on console page? I mean if i send “12345” or “Hello” then paylod in Application data page shows “31 32 33 34 35” for 12345 and “48 65 6C 6C 6F” for Hello. If i enter any of those two payloads the results is in both…

Register on the Datacake platform

Before we begin, you will need to register on the Datacake platform. You can do this simply by registering using the following URL:

https://app.datacake.de/signup

Do I have to pay for using the Datacake Cloud?

No, because your first five devices are always free and fully functional.

Create API device

After you have registered and logged in, the first thing we will do is create an API device which we will fill with values from your TTN device.

What is an API device?

There are different types of devices available. You chose the API device if you want to use your own hardware.

Add Fields

In order to store (measurement) data, we have to create appropriate fields in the database of your device. The Datacake platform offers you several possibilities:

  • Integer, float, counter for numbers
  • String for messages and even custom data
  • Boolean for states
  • Location for storing GPS coordinates

To create a field, you must navigate to the Configuration tab of your device view and scroll down until you reach the Fields section.

Now create fields for your TTN device according to the data your device sends by pressing the "Add field" button.

You will now see a dialog asking you to enter some of the options we offer. It is self-explanatory, but if you need a little more detail, you can find it here:

https://docs.datacake.de/v/english/device/database

For example, if your device sends temperature and humidity, you would create fields for such as those shown in the above screenshot.

Setting up TTN integration

To connect your TTN device, we offer a native integration for TTN Devices, which you have to activate before you can use it. Scroll to the bottom of the configuration tab until you reach the "Integrations" section.

To activate the TTN integration, click on the "Configure" button and continue with the setup.

Copy Device ID

The Datacake platform and its TTN integration needs to figure out which device it should listen to. This is done by using the Device ID.

Please make sure that this is the Device ID you have set. It is not the Dev-EUI or any other number.

Create Webhook integration on TTN

We need to transfer data from TTN devices to Datacake. We do this by creating a webhook integration on the TTN console for your application.

Expected payload

The Datacake TTN Integration expects the payload of your devices to be compiled using a payload decoder script and formatted as follows:

// Example payload decoder
function Decoder(bytes, port) {
    var temperature = bytes[0];
    var humidity = bytes[1];
    // Datacake Integration expects single field payloads
    return {
        temp: temperature,
        hum: humidity
    }
}

Mapping Payloads

If the payload matches the Datacake integration format, you can now map the fields in your device payload to the fields in your Datacake device.
Simply type the appropriate field into the Integration Editor as shown in the screenshot below:

Testing the Integration

If your device has been successfully integrated, you can already see this in the list of database fields. Here the current measured values are indicated as well as a time stamp when the measured values were received.

The next steps

Now that you have successfully integrated the device, you can create your own dashboards and receive notifications when measured values are outside your limits.

You can find out how to do this in our documentation.

https://docs.datacake.de/v/english/integrations/the-things-network

Thank you for reading and your interest in Datacake. If you have any questions about the portal or need help, just contact us:

simon@datacake.de