
This tutorial explains how you can connect WizFi250 with PubNub, one of the most popular cloud service.
PubNub provides a cloud service for IoT devices. Just by registering PubNub, you can connect your device to the Internet for real time monitoring.
After finishing registration, you can create an APP. As shown in below figure, we created ‘WizFi250-demo’ App for the testing.
You must remember <Publish Key> and <Subscribe Key>. We will use them when WizFi250 tries to connect to the service.
If you select <Quick Links> => <Debug Console>, a testing console will be displayed.
After finishing the setting, we will perform channel testing using web browser. This testing is to call the RESTful API at the web browser and check if the value correctly arrives at the channel of PubNub
Call the below address by inputting below address in the URL of web browser.
http://pubsub.pubnub.com/publish/pub-c-34a73e4e-51d6-41d6-a0d1-83c7fa5xxxxx/sub-c-6d25288a-b26d-11e4-8fcd-0619f89xxxxx/0/WizFi250-channel/0/”test-message”
You must input exact key value in the part of “pub-c….” and “sub-c-…..”
“test-message” is the real data to be transmitted to the channel.
If there is no problem, you can see below.
If you go to the Debug Console of the PubNub, you can see the “test-message” at the WizFi250-Channel.
Now, we are going to transmit the data to PubNub from WizFi250. We will send “value-1”, “value-2” and “value-3” data to WizFi250-demo channel.
For this testing, we removed redundant HTTP header and used below data (167 Byte, be careful of CR & LF)
GET /publish/pub-c-34a73e4e-51d6-41d6-a0d1-83c7fa5xxxxx/sub-c-6d25288a-b26d-11e4-8fcd-0619f89xxxxx/0/WizFi250-channel/0/"vlaue-1" HTTP/1.1 Host: pubnub.pubnub.com
The file “Pubnub-test.txt” shows real data transmitted.
WizFi250 operates as below log.
(Here, we will skip the commands about AP association.) AT+WJOIN Joining : WizFiDemoAP Successfully joined : WizFiDemoAP [Link-Up Event] IP Addr : 192.168.3.59 Gateway : 192.168.3.1 [OK] (54.249.82.170 is the IP address of PubNub server) AT+SCON=O,TCN,54.249.82.170,80,,0 [CONNECT 0] [OK] AT+SSEND=0,,,167 [0,,,167] (Here, changes to value-1 and sensd 167Bytes.) [OK] {0,54.249.82.170,80,270}HTTP/1.1 200 OK Date: Thu, 12 Feb 2015 07:08:42 GMT Content-Type: text/javascript; charset="UTF-8" Content-Length: 30 Connection: keep-alive Cache-Control: no-cache Access-Control-Allow-Origin: * Access-Control-Allow-Methods: GET [1,"Sent","14237249220804907"] AT+SSEND=0,,,167 [0,,,167] (changes to value-2 and sends 167Bytes) [OK] {0,54.249.82.170,80,270}HTTP/1.1 200 OK Date: Thu, 12 Feb 2015 07:08:49 GMT Content-Type: text/javascript; charset="UTF-8" Content-Length: 30 Connection: keep-alive Cache-Control: no-cache Access-Control-Allow-Origin: * Access-Control-Allow-Methods: GET [1,"Sent","14237249292661479"] AT+SSEND=0,,,167 [0,,,167] (changes to value-3 and sends 167 Byte) [OK] {0,54.249.82.170,80,270}HTTP/1.1 200 OK Date: Thu, 12 Feb 2015 07:08:58 GMT Content-Type: text/javascript; charset="UTF-8" Content-Length: 30 Connection: keep-alive Cache-Control: no-cache Access-Control-Allow-Origin: * Access-Control-Allow-Methods: GET [1,"Sent","14237249383451324"]
Whenever WizFi250 sends the data (value-1, value-2, value-3), you can see the changed data at the PubNub channel.
COMMENTS