WizFi250 Axeda Example on WIZwiki-W7500 of mbed platform

Axeda

Axeda Provides the Most Advanced Cloud-Based Service and Software for Managing Connected Products and Machines and Implementing Innovative Machine-to-Machine (M2M) and Internet of Things (IoT) Applications

  • We take the cost and complexity out of connecting and managing devices and machines and remotely servicing the products of the world’s leading companies.
  • We turn raw machine and sensor data into useful information for business insights and better decision making.
  • We make it easy to integrate machine and sensor data to business systems so companies can optimize their business processes with accurate real-time machine data.
  • We provide a platform and application services so companies can develop new innovative M2M and IoT applications that reinvent the customer and product experience and differentiate their product and service offerings.

Go to the staging page on your Axeda Toolbox account

Sign up for a membership at toolbox.axeda.com, then click the “AXEDA READY” icon, and choose the mbed LPC1768 device.

toolbox_landing_page mbedselect

We are using WIZwiki-W7500 board for the following example in this posting. However, we would use ToolBox of LPC1768 since WIZwiki-W7500 is not available at Axeda.

 

 

Enter the Device Name that you want and click “Go” button then, you will see the screen as shown in the picture below.

Remember the Serial Number because we will need it when we perform Axeda Example Code.

yourdevicepage

Materials

For more information about hardwares below, please refer to the following link; http://www.life4iot.com/2015/06/27/wizfi250-hello-world-demo-on-wizwiki-w7500-of-mbed-platform/.

WIZwiki-W7500 (MCU Platform)

wizwiki-w7500_main

WizFi250-EVB (Wi-Fi Module)

ShopDtl_1203_20140918154919

Sensor Shield

TB2wSGHaFXXXXcLXXXXXXXXXXXX_!!33841454

Hardware Configuartion

20150626_151253

WizFi250-EVB Sensor Shield WIZwiki-W7500
RX-TX RXD TXD
TX-RX TXD RXD
CTS-RTS CTS D8
RTS-CTS RTS D7
WizFi250-RESET JP10-2 PA12

Compile AxedaGo-WizFi250 Example onto Wizwiki-W7500 Board

You can use WizFi250 Axeda Example Code at the following link; AxedaGo-WizFi250 Example.

20150626_151744

Add the Serial Number from Axeda Tool box as shown in the picture below before compiling AxedaGo-WizFi250 Example.

line19serial

Upload the created binary on to WIZwiki-W7500 board after compiling code.

Source Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include <stdio.h>
#include "mbed.h"
#include "WizFi250Interface.h"
#define SECURE WizFi250::SEC_AUTO
#define SSID "ssid"
#define PASS "key"
#if defined(TARGET_WIZwiki_W7500)
    WizFi250Interface wizfi250(D1,D0,D7,D8,PA_12,NC,115200);
    Serial pc(USBTX,USBRX);
#endif
AnalogIn pot1(A0);
TCPSocketConnection sock;
DigitalOut led1(LED1);
DigitalOut led2(LED2);
DigitalOut led3(LED3);
DigitalOut led4(LED4);
int main()
{
    char *MODEL = "mbed";
    char *SERIAL_NUM = "serial number";
    float DEADBAND = 0.03;
    int http_cmd_sz=800;
    char http_cmd[http_cmd_sz];
    int buffer_sz=300;
    char buffer[buffer_sz];
    int returnCode = 0;
    led1 = 1;
    led2 = 1;
    led3 = 1;
    led4 = 1;
    pc.baud(115200);
    wizfi250.init();
    returnCode = wizfi250.connect(SECURE, SSID, PASS);
    if ( returnCode == 0 )
    {
        printf(" - WiFi Ready\r\n");
        printf("IP Address is %s\r\n", wizfi250.getIPAddress());
        led1 = returnCode;
    }
    else
    {
        printf(" - Could not initialize WiFi - ending\r\n");
        return 0;
    }
    float oil_level = 0.0;
    float oldPotVal = -2.0;
    while(1) {
        oil_level = pot1.read();
        if ( abs(oil_level - oldPotVal) < DEADBAND)
        {
            continue;
        }
        else
        {
            oldPotVal = oil_level;
            printf("Sending Value for well1 %.2f\n\r", oil_level);
            sock.connect("toolbox-connect.axeda.com", 80);
            snprintf(http_cmd, http_cmd_sz,  "POST /ammp/data/1/%s!%s HTTP/1.1\r\nContent-Type: application/json\r\nContent-Length: 65\r\n\r\n{\"data\":[{\"di\":{\"oil_level\":%.2f}}]}\r\n\r\n", MODEL, SERIAL_NUM, oil_level);
            sock.send_all(http_cmd, http_cmd_sz-1);
            while ( (returnCode = sock.receive(buffer, buffer_sz-1)) > 0)
            {
                buffer[returnCode] = '';
                printf("Received %d chars from server:\n\r%s\n", returnCode, buffer);
            }
            sock.close();
        }
     }
}

Test Result

Send data to the demo application

WIZwiki-W7500 would send the sensed data to Axeda Tool box by using WizFi250 if performing the code above.

Axeda Tool box would make a mbed widget with the data.

You can check that the mbed widget of Axeda is changing when you turn the A0 switch of Sensor Shield.

20150626_16013820150626_154710

Log message on Serial Terminal

[WizFi250: INFO]AT+MMAC=?
[WizFi250: INFO][OK]

[WizFi250: INFO]AT+WSET=0,wizohp
[WizFi250: INFO][OK]

[WizFi250: INFO]AT+WSEC=0,,wiznet218
[WizFi250: INFO][OK]

[WizFi250: INFO]AT+WJOIN
[WizFi250: INFO][OK]

[WizFi250: INFO]AT+WSTATUS
[WizFi250: INFO][OK]

[WizFi250: INFO]IP      : 192.168.13.29
[WizFi250: INFO]Gateway : 192.168.13.1
[WizFi250: INFO]WizFi250 is successfully join to AP
 - WiFi Ready
IP Address is 192.168.13.29
Sending Value for well1 0.54
[WizFi250: INFO]AT+FDNS=toolbox-connect.axeda.com,1000
[WizFi250: INFO][OK]

[WizFi250: DBG]216.34.120.52
[WizFi250: INFO]AT+SCON=O,TCN,216.34.120.52,80,,0
[WizFi250: INFO][OK]

[WizFi250: INFO]AT+SSEND=0,,,799
[WizFi250: INFO][OK]

[WizFi250: INFO]POST /ammp/data/1/mbed!nlr__kaizen8501_gmail_com___6245114 HTTP/1.1
Content-Type: application/json
Content-Length: 65

{"data":[{"di":{"oil_level":0.54}}]}



[WizFi250: DBG]receive readable : 1

Received 36 chars from server:
HTTP/1.1 200 
Content-Length: 0

Demo Video

Leave a Reply

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

WordPress.com Logo

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

Google+ photo

You are commenting using your Google+ 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 )

w

Connecting to %s