Syndicate Data From Your Embedded Devices

by ian in Circuits > Websites

7755 Views, 8 Favorites, 0 Comments

Syndicate Data From Your Embedded Devices

front.jpg
This instructable will show you how to take data output from a USB temperature logger and syndicate it on the web using syndicit.com. Once your data is saved at syndicit.com you can share it on the web as a spreadsheet, live Google Earth feed, RSS feed, and more.

USB temperature logger:
https://www.instructables.com/id/EV9KA88GBMEQZJJOR5/

You can still participate if you don't have an data feed of your own. You can mix and match existing feeds to create your own custom feed. Tag stuff just like instructables.com & enjoy all the ajaxy web2.0 goodness.

Stuff You'll Need

p1000362.jpg
Data source:
A USB temperature logger will be used in this demonstration, but any data source can be used. Information on the USB temperature logger is available here:

https://www.instructables.com/id/EV9KA88GBMEQZJJOR5/

SyndicitGATE:
SyndicitGATE is a very simple (Windows) Visual Basic program with 2 functions. It includes the functionality of the sample program included with the USB temperature logger: it uses MSCOM32.OCX to send a request for data through the USB port. The response (a temperature measurement in this case) is put into a HTTP POST request and sent to syndicit.com using mswinsock.OCX. (You will need both of these common Windows files for syndicitGATE to work. You should already have them, if not, consult Google.) Source and compiled executable are included in the project archive.
***Note: trialexsays: You mention you need the file "MSCOM32.OCX" - I think this should read "MSCOMM32.OCX". I also needed to go and find the file "COMDLG32.OCX"*****

Syndicit.com account:
Go to syndicit.com and register for an account. This is my experimental site for embedded device data syndication. Free to use, though you have to agree that any data you syndicate is placed in the public domain.

Create a New Feed on Syndicit.com

newfeed.png
Login at http://www.syndicit.com/account/login

Click ‘New Feed’ on the top menu.

Enter a name for your feed. Syndicit will create a unique path name based on your descriptive name. (It uses up to the first 3 words or 20 characters, then appends _## to the end until a unique feed name is created). The example name is ‘test device’, which results in the unique path 'test_device'.

Enter Details for Your Feed

setupfeed.jpg
After naming the feed you will be redirected to a page where you can enter details and add variables.

Click ‘edit’ to enter information describing your feed.

You will need two pieces of information from this page to get started. First, note the device path in your browser (in this case, ‘test_device’). Second, set a backned password in the administration section. The device path (‘test_device’) and backend password (‘testpassword’ in the example) are need to access the backend (save data).

For added security you can lock the backend to an IP address. Click ‘help’ for more details if anything is unclear.

Add Some Variables

addvariable.png
Next, we add some variables to the feed. The temperature logger measures indoor/outdoor temperatures so we need two variables.

Click on ‘+ add variable’ .

Enter a descriptive name for the new variable.

A unique path will be created using the same technique previously described. In the example I created 2 variables named ‘indoor temperature’ and ‘outdoor temperature’.

Setup the Variables

setupvar2.jpg
Click the ‘details’ link next to your newly created variables. On this page you can enter details about the individual variables.

Because the data is a temperature measure, the variable type is set to ‘number’ and units to ‘degrees’.

Note the unique path names given to your variables. These will be used as the variable names when inserting data into the backend. In the example, the paths are ‘indoor_temperature’ and ‘outdoor_temperature’.

Setup SyndicitGATE

syndicitgatestart.png
SyndicitGATE is a simple VB program that demonstrates how to interface with the syndicit.com backend. The source and compiled EXE are included in the project archive.

Open syndicitGATE.

Enter the following information in the ‘syndicit.com connection settings’ area:
Backend: http://www.syndicit.com/backend
Member Sign-in: your syndicit.com username (ian in the example)
Feed path: the unique path assigned to your feed (test_device)
Feed password: the password you assigned to your feed (testpassword)

Setup your serial or USB device under ‘device setting’.

Additional configuration details are available in the help menu.

Setup Variables in SyndicitGATE

gatevar.jpg
Click ‘setup variables’ and a new window will open.

Enter the unique path names assigned to your variables IN THE ORDER THAT THEY COME OUT OF THE DEVICE. The USB temperature logger outputs the indoor temperature followed by the outdoor temperature, they are entered in this order.

Click ‘Use’ next to the variable(s) that should be expected from the device, then click ‘OK’.

Start Loggin' Data

syndicitgatelogging.jpg
If you want to test your connection to the syndicit.com backend click ‘test’ The debug window will open and you should see a ‘*****connection successful*****’ response from the backend.

Click ‘Start’ to begin logging data. If the debug window is open the communication dialog between syndicitGATE, syndicit.com, and your device will be displayed.

In-depth:What Exactly Does SyndicitGATE Do?

httppost.png
SyndicitGATE is a simple Visual Basic program that creates a HTTP POST and sends it through winsock32.dll. In debug mode you can see exactly what the HTTP post looks like. Details on on the syndicit.com backend follow.

The backend address is http://www.syndicit.com/backend. To access the database you must have your syndicit.com username, a feedname, a feed password, and one or more variables setup for the feed. Data can be added using HTTP GET and HTTP POST.

Username, feed path, and feed password are required to login to the backend. These should be sent as variables named ‘user’, ‘feed’, and ‘feedpassword’ respectively.

Example feed located at ‘syndicit.com/stream/ian/test_device/’:

‘user’ – your syndicit.com username (user=ian).
‘feed’ – the path assigned to your device (feed=test_device)
‘feedpassword’ – the password you gave your feed on the setup page (e.g. feedpassword=testpassword)

if the feed has two variables located at the following paths:

stream/ian/test_device/outdoor_temperature
stream/ian/test_device/indoor_temperature

the data values are inserted by using the pathname as the variable name:

outdoor_temperature=24.5
indoor_temperature=23.2

GET is the easiest method to do an insert, but very insecure. Simply add the required variables to the web site address. To insert the values in the example with the password ‘testpassword’, we do the following:

http://www.syndicit.com/backend/?user=ian&feed=test_device&feedpassword=testpassword&outdoor_temperature=24.5&indoor_temperature=23.2

POST is more secure but more complicated. To submit data by the POST method you must emulate the action of pressing the submit button on an HTML page.

Variables can be send by BOTH POST and GET together. POSTed variables ALWAYS override GET variables.

I have 2 variables in a feed, do I have to submit both every time?
No, the variables you send to the backend are saved independent of any other variables the device may have.

What do the backend result codes mean?
The backend returns single character results codes. Here is what they mean:
0 – user, feed, or feedpassword not set.
1 – user, feed, feedpassword, or IP address (if lock enabled) not correct
2 – N/A
3 – successful authentication, variables saved.

Check Out Your Data Feed

ge.jpg
feedheader.png
Now its time to inspect the results.

Navigate to the variable page. (/test_device/indoor_temperature)

Click on the various feeds to syndicate your data in variety of formats: html tables, spreadsheets, RSS, Google Earth, and more. Include the graphs and feeds on your own website.