To connect your WizFi210 to Cosm, you’ll first need a cosm account. Go to http://cosm.com and register if you haven’t already. When you register, you’ll get an API key and it is used for communicate with Cosm service.
Set up a new feed in your cosm account by clicking the “add feed” button and select the “Something else”.
Follow the dialog to create your feed, and select “No, I will push data to cosm” and set the title and Tags then you can get a 6 digits Feed ID.
1. Association with AP
It depends on the AP’s security option and below example show there is no security option and IP address is leased by DHCP server.
If WizFi210 properly connect to the AP, you can see the leased IP address of WizFi210.
2. DNS loopup & connection.
1) In order to obtain the actual IP address, DNSLOOKUP command is used and get the actual IP address of “api.cosm.com”.
2) Using the TCP client connection command, NCTCP, WizFi210 connect to the Cosm.
3) CID command show the connection ID is 0.
3. Sending the HTTP data
To send the HTTP raw data, below procedure is required.
1) Type 3 bytes “[ESC] [S] [CID]” on the serial terminal. In this example, the CID is “0″ and [ESC] is 0x1B in hexadecimal.
2) Sending HTTP raw data.
You will need to specify the API key, feed ID, and datastream you created. With these set, data will be pushed to your new datastream the next time your device sends a data. HTTP request to the cosm service (it will be “200″ on success).
In above picture, number 1 is Feed ID, 2 is API key, 3 is data size and 4 is data name & data value.
3) Type 2 bytes “[ESC][E]“. Then the data sent to the Cosm server and you can see the reply as below.
After a few updates, you’ll have a nice graph of the history of your data stream!
Note that cosm does have rate limits, and will not allow you to push data to any one datastream more often than once every 15 seconds.