Using the Exosite

Exosite is one of the available platforms for the Internet of Things (IoT) but they are describing what they are a lot better here: “We’re an international company with offices in Minneapolis and Taiwan focused on the Internet of Things solutions – helping you collect, store, visualize and interact with your data”

I am using this platform for multiple embedded projects of mine over the last couple of years. Its simple to use and very very reliable. Of course they released a feature reach API in order to make our life’s easier! You can find this API together with all the peripheral info that will get you up to speed here: Exosite – Developers

Now it is time to play a little bit with this API together with the Raspberry Pi! For the first steps I will use dump data and simple changes to their own example codes in order to make some tests. Later, I will build a full data collection system that will interact with the user over the Exosite portal.

If you want to run the following Python scripts you must make a new .py file and place inside the code you have selected. For example if you want to test the first code (using the Exosite with HTTP Requests) make a file with the name using the:

sudo nano

Copy paste the code inside the nano editor. Make the changes according to your CIK, Devices and Data and press Ctrl-X, then Y and finally enter. To run the code type:

sudo python


With HTTP Requests

import urllib
import httplib

url = '/onep:v1/stack/alias'
params = urllib.urlencode({'Device1': Data, 'Device2': Data})
headers = {'X-Exosite-CIK': 'Your CIK here', 'Content-Type': 'application/x-www-form-urlenco$

conn = httplib.HTTPConnection('')
response = conn.getresponse();
print 'response: ',response.status,response.reason
data =
end = data.find('<')
if -1 == end: end = len(data)
print data[:end]



With the Python library

In order to use the pyonep you must first install it. If you don’t have the pip (a package management system written in Python) then type the next command:

sudo apt-get install python-pip


sudo pip install pyonep

and now that we have all the dependencies downloaded and instaled on our Raspberry Pi, type the code:

from pyonep import onep

o = onep.OnepV1()

cik = 'Your CIK here'
dataport_alias = 'Device'
val_to_write = 'Data'

testvar = o.write(
{"alias": dataport_alias},

isok, response =
{'alias': dataport_alias},
{'limit': 1, 'sort': 'desc', 'selection': 'all'})

if isok:
# expect Read back [[1374522992, 1]]
print("Read back %s" % response)
print("Read failed: %s" % response)

print testvar

This is my preferred method in any experiment/projects I am working on. The library is powerful and can do pretty much anything you can imagine with the Exosite platform.


With UDP packets

This is the simplest method of them all but this simplicity comes with the price of reliability. It is a very good solution for devices with strict data bandwidth (that sometimes cost a lot if this is via the mobile broadband). It uses a simple UDP packet (User Datagram Protocol) that contains both the user identification information and the data payload for all the desired data streams.

The problem is the reliability! In general the UDP itself is not a reliable (at least compared to TCP) protocol. Using it, an application can send packets to other hosts/servers of the network without prior communications and handshakes in order to set up the needed data paths channels and proper communications between the sender and the receiver.

This makes the protocol fast and simple but if for example the server is busy or even worst not there at all we will not be able to know!

import socket

PORT = 18494
HOST = ''
msg = "cik=Your CIK here&Device1=Data1&Device2=Data2&Device3=Data3&DeviceN=DataN"

while True:
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.connect((HOST, PORT))

The interface cane be accessed only on port 18494 via The response format will be… none! We are not going to have any response back from the Exosite server. Thats why it is, at least in my opinion, an unreliable method.

One thought on “Using the Exosite

  1. Cesar Rodríguez says:

    Hello, I want to know how I can export information from Exosite to Raspberry Pi, please help me. Thank you

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: