Kosmos Documentation

Connect your Raspberry Pi to Kosmos

What will I learn?

In this tutorial you’ll learn how to connect your Raspberry Pi to the Kosmos Industrial IoT platform. This is a first easy step in building complete enterprise-grade IoT applications!
Kosmos uses the Raspberry Pi as a gateway device to relay data from a range of sensor devices to the Kosmos cloud.
Kosmos architecture diagram
Kosmos is designed to be hardware agnostic which means that you can connect PLCs, programmable microcontrollers, bluetooth multi-sensors, off-the-shelf Sub-1 Ghz sensors, smart plugs and more to your Raspberry Pi and Kosmos.
What’s more, since Kosmos is a no-code IoT solution, no computer programming skills are necessary to quickly and easily set up devices. We automatically generate all the code for your Raspberry Pi.
This tutorial was created for people that don’t have any sensor hardware right now. We’ll show you how to set up your Raspberry Pi as a Kosmos gateway and you can add sensor hardware later. If you do have any of our supported hardware devices, head back to the documentation page to view the setup guide for your specific hardware devices.

What You'll Need

Before you get started, make sure you have the following to hand:
A power supply for your Raspberry Pi
An SD card (8GB or more)
An SD card reader/writer
A USB thumb drive

Get Started With Kosmos & Raspberry Pi

1
If you haven’t already, sign up for a free Kosmos trial account.
2
Log into your Kosmos account and navigate to the Kosmos application builder.
3
This tutorial is for people that don't have sensor hardware currently but still want to try out Kosmos. For now, select NCD sensors since you need to set up at least one sensor to create a Kosmos application.
4
Within the NCD category, select the Ambient Temperature & Humidity sensor.
5
On the next step, give your NCD sensor a name and click the button to continue.
6
Now that you’ve added a sensor to your application, click “Confirm” to move on to the next step, which deals with how frequently your Raspberry Pi should receive sensor data, and how frequently the Pi should send that data to your Kosmos dashboard.
7
Since we’re not actually deploying a sensor in this tutorial, you can leave these values in their default state and hit the button to continue to the last step.
8
Next, give your Kosmos app a name and move on to downloading the files you need for your Raspberry Pi.
9
Download the two files that have been automatically generated for you. These two files are all you need to set your Raspberry Pi up as a Kosmos gateway.
10
When you move on from here you’ll be asked to enter your credit card information if you haven’t already done so. Go ahead and do that - you won’t be automatically charged for anything.

Turning Your Raspberry Pi Into A Kosmos Gateway

Now that you’ve created a Kosmos application, you’re ready to set up your Raspberry Pi as a Kosmos gateway and see your Pi in the Kosmos dashboard.
1
Navigate to the Kosmos dashboard and view your new application. Now that you know where to find your Pi gateway on our website, we’re going to get it online by installing the Kosmos gateway application on your Raspberry Pi.
2
Locate the two Kosmos files that you downloaded earlier:
There’s the Kosmos gateway image (the .xz file on the right in the image below) that you load onto the Raspberry Pi via SD card
And the Kosmos application files (the .zip file) that contains a configuration file that you load onto the Raspberry Pi via USB thumb drive
3
If you don’t have it already, download Etcher so that you can flash your SD card with the Kosmos gateway image (.xz file).
4
Insert your SD card into your SD card reader/writer (and connect the reader/writer to your computer if you’re using an external reader/writer), then use Etcher to flash the Kosmos gateway disk image onto your SD card.
5
Next, open the other file you downloaded (the temboo_kosmos_files.zip file) and then open the kosmos_gateway_config.ini file in your favorite text editor. Then do the following:
a
Find the SSID field and enter the name of your wifi network
b
Beneath that, enter your wifi password in the password field
6
Save the kosmos_gateway_config.ini file you just edited, and then transfer it to your USB thumb drive - now you’re ready to get your Kosmos gateway online.
7
Take these steps to finish setting up your Raspberry Pi as a Kosmos gateway:
a
Insert the SD card into your Raspberry Pi
b
Plug your Raspberry Pi power adapter into an outlet and then into the Pi
c
Insert the USB thumb drive into your Pi
8
Now that your Raspberry Pi is set up to act as a Kosmos gateway, you can revisit your Kosmos dashboard and check that the Pi has come online. Clicking into your Pi will reveal its connectivity status, the version of the Kosmos gateway it's running, and how long is has been online.
9
While Kosmos is primarily designed to monitor sensor data, it can also report on the status of your Raspberry Pi. To set up an email alert about the connectivity status of the Pi, take the following steps:
a
Click on the settings icon in the top right of the screen
b
Click on the Connectivity alert rule to access its settings
c
Select the amount of time your Pi should be offline before you are alerted
d
In the Delivery Frequency section, select Also send email as it happens
e
Enter your email address and save the Connectivity rule
10
Remove the power adapter from your Pi to take it offline. Once your Pi has been offline for the amount of time specified in your rule, you’ll get a Kosmos connectivity alert email. Kosmos rules can be used to generate email and SMS alerts for sensor data values, battery status, device connectivity, and more.

What's Next?

Now that you’ve learned how to set up your Raspberry Pi as a Kosmos gateway, the natural next step is to get some sensor devices and build a real IoT application.
You can learn more about the sensor and actuator hardware that Kosmos supports in the documentation section.

Questions?

We're always happy to help with questions about building IoT applications with Kosmos.
Check out our documentation for more tutorials, email support for help, or connect with our product outreach team with any questions you might have.