Page 1 of 1

DFRobot wifi shield v2.2 for IoT

Unread postPosted:Sun Jul 24, 2016 10:45 am
by a.murdan
Hi everyone,
I'd like to know whether anyone has used DFRobot wifi shield v2.2 for IoT. I am trying to make this shield work with Blynk, but I'm stuck. Help required for any projects completed with this shield.
Thanks.
Ans :D

Re: DFRobot wifi shield v2.2 for IoT

Unread postPosted:Mon Jul 25, 2016 10:13 am
by Leff
Hi there,

Are you using this one? http://www.dfrobot.com/index.php?route= ... 5XmqHqEC-U
I'd like to try IoT with you, not very busy these days.

Could you tell me where you are having trouble with, or which step you are stucking at?

http://docs.blynk.cc/

Re: DFRobot wifi shield v2.2 for IoT

Unread postPosted:Mon Jul 25, 2016 7:42 pm
by a.murdan
Hello Leff,
Yes, this is the shield I am using. (http://www.dfrobot.com/index.php?route= ... 5ZgIU1PrDd)

Ok, I tried several things, which did not work. Starting with the basics first. Since the shield uses the WizFi210 chip, I installed the WizFiShield library, which contains several examples. I tried to compile the WizFiBasicServerTest. Code is below:
Code: Select all

/******************************************************************
 WizFiShield Basic Server Test Example
 
 This sketch makes the server socket and accpet TCP connection from the client
 
 Circuit:
 WizFiShield connected to Arduino via SPI
 
 RST: pin 2  // Output
 DRDY: pin 3  // Input
 CSB: pin 4  // output

 MOSI: pin 11  // output
 MISO: pin 12  // input
 SCK: pin 13  // out
 
 Created 27 Sep. 2012
 by James YS Kim  ([email protected], [email protected])
 
 Modified 27 May. 2013
 by Jinbuhm Kim  ([email protected], [email protected])

*****************************************************************/

// WizFi210 communicates using SPI, so include the SPI library:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <SPI.h>
#include <WizFi2x0.h>
#include <WizFiClient.h>
#include <WizFiServer.h>
#include <TimerOne.h>

#define SSID       "SOFT_LEVEL1"        // SSID of your AP
#define Key            "Mypassphrase"  // Key or Passphrase
// Wi-Fi security option (NO_SECURITY, WEP_SECURITY, WPA_SECURITY, WPA2PSK_SECURITY)
#define Security        WPA_SECURITY

unsigned int SrcPort = 50000;    // listening port number

WizFi2x0Class myWizFi;
WizFiClient myClient[4];//(SIP, ServerPort);
WizFiServer myServer(SrcPort);
TimeoutClass ConnectInterval;

boolean Wifi_setup = false;

///////////////////////////////
// 1msec Timer
void Timer1_ISR()
{
  myWizFi.ReplyCheckTimer.CheckIsTimeout();
}
//
//////////////////////////////

void setup() {
  byte retval, i;
 
  Serial.begin(9600);
  Serial.println("\r\nSerial Init");
 
  for(i=0; i<4; i++)
    myClient[i] =  WizFiClient();
  myWizFi.begin();
 
  ConnectInterval.init();
 
  // Timer1 Initialize
  Timer1.initialize(1000); // 1msec
  Timer1.attachInterrupt(Timer1_ISR);
 
  myWizFi.SendSync();
  myWizFi.ReplyCheckTimer.TimerStart(3000);
 
  Serial.println("Send Sync data");
 
  while(1)
  {
    if(myWizFi.CheckSyncReply())
    {
      myWizFi.ReplyCheckTimer.TimerStop();
      Serial.println("Rcvd Sync data");
      break;
    }
    if(myWizFi.ReplyCheckTimer.GetIsTimeout())
    {
      Serial.println("Rcving Sync Timeout!!");
      // Nothing to do forever;
      for(;;)
      ;
    }
  }

  ////////////////////////////////////////////////////////////////////////////
  // AP association 
  while(1)
  {
    byte tmpstr[32];
   
    retval = myWizFi.associate(SSID, Key, Security, true);
   
    if(retval == 1){
      myWizFi.GetSrcIPAddr(tmpstr);
      Serial.println("AP association Success");
      Serial.print("MY IPAddress: ");
      Serial.println((char *)tmpstr);
      Wifi_setup = true;
      break;
    }else{
      Serial.println("AP association Failed");
    }
  }
 
  if(myServer.begin())
    Serial.println("Server Listen OK");
  else
    Serial.println("Server Listen Failed");
}

void loop()
{
  uint8_t i;
  byte rcvdBuf[129];
 
  memset(rcvdBuf, 0, 129);
 
  if(Wifi_setup)
  { 
    myWizFi.RcvPacket();
    for(i=0; i<4; i++)
    {
      if(myClient[i].available()){       
         if(myClient[i].read(rcvdBuf))
         {
           Serial.print("CID[");
           Serial.print((char)myClient[i].GetCID());
           Serial.print("]");
           Serial.println((char *)rcvdBuf);
           myClient[i].write(rcvdBuf);
         }
      }
    }
  }
}



I am getting the following error:
Code: Select all
G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:6:1: error: 'prog_char' does not name a type

 prog_char Page1_Line0[] PROGMEM = "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.2//EN\" ";   // "String 0" etc are strings to store - change to suit.

 ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:7:1: error: 'prog_char' does not name a type

 prog_char Page1_Line1[] PROGMEM = "\"http://www.wapforum.org/DTD/xhtml-mobile 12.dtd\">\r\n";   // "String 0" etc are strings to store - change to suit.

 ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:8:1: error: 'prog_char' does not name a type

 prog_char Html_start[] PROGMEM = "<html>\r\n";   // "String 0" etc are strings to store - change to suit.

 ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:9:1: error: 'prog_char' does not name a type

 prog_char head_start[] PROGMEM = "<head>\r\n";   // "String 0" etc are strings to store - change to suit.

 ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:10:1: error: 'prog_char' does not name a type

 prog_char Page1_Line2[] PROGMEM = "<meta http-equiv=\"Content-Type\" content=\"text/html/>\r\n";

 ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:11:1: error: 'prog_char' does not name a type

 prog_char Content_Msg[] PROGMEM = "Content-Type: text/html\r\n";

 ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:12:1: error: 'prog_char' does not name a type

 prog_char Page1_Line3[] PROGMEM = "<meta name=\"viewport\" content=\"user-scalable=no, initial-scale=5.0,";

 ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:13:1: error: 'prog_char' does not name a type

 prog_char Page1_Line4[] PROGMEM = " maximum-scale=5.0, minimum-scale=5.0, width=device-width\"/>\r\n";

 ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:14:1: error: 'prog_char' does not name a type

 prog_char head_end[] PROGMEM = "</head>\r\n";   // "String 0" etc are strings to store - change to suit.

 ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:15:1: error: 'prog_char' does not name a type

 prog_char Page1_Line5[] PROGMEM = "<body>\r\n";

 ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:16:1: error: 'prog_char' does not name a type

 prog_char new_Line[] PROGMEM = "\r\n";

 ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:17:1: error: 'prog_char' does not name a type

 prog_char Page1_Line6[] PROGMEM = "<h1 align=\"center\">Select </h1>\r\n";

 ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:18:1: error: 'prog_char' does not name a type

 prog_char Page1_Line7[] PROGMEM = "<form>\r\n";

 ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:19:1: error: 'prog_char' does not name a type

 prog_char Page1_Line8[] PROGMEM = "<table width=\"100%\"><tr><td colspan=3 align=\"center\"><h1>Press button you want</h1></td></tr><tr>";

 ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:20:1: error: 'prog_char' does not name a type

 prog_char Page1_Line8_cont[] PROGMEM = "<td width=\"40%\"></td><td width=\"20%\" bgcolor=\"silver\" align=\"center\"><h1><button ";

 ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:21:1: error: 'prog_char' does not name a type

 prog_char Page1_Line8_cont2[] PROGMEM = "name=\"command\" value=\"FW_CMD\">forward</button></h1></td><td width=\"40%\"></td></tr>\r\n";

 ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:22:1: error: 'prog_char' does not name a type

 prog_char Middle_Line[] PROGMEM = "<tr><td width= \"40%\" align=\"right\"><h1><button name=\"command\" value=\"LEFT_CMD\">LEFT</button></h1></td>";

 ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:23:1: error: 'prog_char' does not name a type

 prog_char Middle_Line_cont[] PROGMEM = "<td width=\"20%\"></td><td width= \"40%\" align=\"left\"><h1><button name=\"command\" value=\"RIGHT_CMD\">";

 ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:24:1: error: 'prog_char' does not name a type

 prog_char Middle_Line_cont2[] PROGMEM = "RIGHT</button></h1></td></tr>\r\n";

 ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:25:1: error: 'prog_char' does not name a type

 prog_char Page1_Line9[] PROGMEM = "<tr><td width=\"40%\"></td><td width= \"20%\" bgcolor=\"#c3c3c3\" align=\"center\"><h1><button name=\"command\"  ";

 ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:26:1: error: 'prog_char' does not name a type

 prog_char Page1_Line9_cont[] PROGMEM = "value=\"BW_CMD\">backward</button></h1></td><td width=\"40%\"></td></tr></table>\r\n";

 ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:27:1: error: 'prog_char' does not name a type

 prog_char Page1_Line10[] PROGMEM = "</form>\r\n";

 ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:28:1: error: 'prog_char' does not name a type

 prog_char Page1_Line11[] PROGMEM = "</body>\r\n";

 ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:29:1: error: 'prog_char' does not name a type

 prog_char Page1_Line12[] PROGMEM = "<table width=\"100%\"><tr><td colspan=3 align=\"center\"><h1>Press button you want. Battery is low.</h1></td></tr><tr>";

 ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:30:1: error: 'prog_char' does not name a type

 prog_char Page1_Line13[] PROGMEM = "<table width=\"100%\"><tr><td colspan=3 align=\"center\"><h1>Alert! Battery is too low.</h1></td></tr></table>\r\n";

 ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:31:1: error: 'prog_char' does not name a type

 prog_char Html_end[] PROGMEM = "</html>\r\n";   // "String 0" etc are strings to store - change to suit.

 ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:34:32: error: variable 'HTML_table' must be const in order to be put into read-only section by means of '__attribute__((progmem))'

 PROGMEM const char *HTML_table[] =

                                ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:36:2: error: 'Protocol_Msg' was not declared in this scope

  Protocol_Msg,

  ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:37:2: error: 'Content_Msg' was not declared in this scope

  Content_Msg,

  ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:38:2: error: 'new_Line' was not declared in this scope

  new_Line,    // 0

  ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:39:2: error: 'Page1_Line7' was not declared in this scope

  Page1_Line7,   // 6

  ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:40:2: error: 'Page1_Line8' was not declared in this scope

  Page1_Line8,    // 7

  ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:41:2: error: 'Page1_Line8_cont' was not declared in this scope

  Page1_Line8_cont,

  ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:42:2: error: 'Page1_Line8_cont2' was not declared in this scope

  Page1_Line8_cont2,

  ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:43:2: error: 'Middle_Line' was not declared in this scope

  Middle_Line,

  ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:44:2: error: 'Middle_Line_cont' was not declared in this scope

  Middle_Line_cont,

  ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:45:2: error: 'Middle_Line_cont2' was not declared in this scope

  Middle_Line_cont2,

  ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:46:2: error: 'Page1_Line9' was not declared in this scope

  Page1_Line9,    // 8

  ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:47:2: error: 'Page1_Line9_cont' was not declared in this scope

  Page1_Line9_cont,    // 8

  ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:48:2: error: 'Page1_Line10' was not declared in this scope

  Page1_Line10 // 9

  ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:51:33: error: variable 'HTML_table2' must be const in order to be put into read-only section by means of '__attribute__((progmem))'

 PROGMEM const char *HTML_table2[] =

                                 ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:53:2: error: 'Protocol_Msg' was not declared in this scope

  Protocol_Msg,

  ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:54:2: error: 'Content_Msg' was not declared in this scope

  Content_Msg,

  ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:55:2: error: 'new_Line' was not declared in this scope

  new_Line,    // 0

  ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:56:2: error: 'Page1_Line7' was not declared in this scope

  Page1_Line7,   // 6

  ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:57:2: error: 'Page1_Line12' was not declared in this scope

  Page1_Line12,    // 7

  ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:58:2: error: 'Page1_Line8_cont' was not declared in this scope

  Page1_Line8_cont,

  ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:59:2: error: 'Page1_Line8_cont2' was not declared in this scope

  Page1_Line8_cont2,

  ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:60:2: error: 'Middle_Line' was not declared in this scope

  Middle_Line,

  ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:61:2: error: 'Middle_Line_cont' was not declared in this scope

  Middle_Line_cont,

  ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:62:2: error: 'Middle_Line_cont2' was not declared in this scope

  Middle_Line_cont2,

  ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:63:2: error: 'Page1_Line9' was not declared in this scope

  Page1_Line9,    // 8

  ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:64:2: error: 'Page1_Line9_cont' was not declared in this scope

  Page1_Line9_cont,    // 8

  ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:65:2: error: 'Page1_Line10' was not declared in this scope

  Page1_Line10 // 9

  ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:68:33: error: variable 'HTML_table3' must be const in order to be put into read-only section by means of '__attribute__((progmem))'

 PROGMEM const char *HTML_table3[] =

                                 ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:70:2: error: 'Protocol_Msg' was not declared in this scope

  Protocol_Msg,

  ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:71:2: error: 'Content_Msg' was not declared in this scope

  Content_Msg,

  ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:72:2: error: 'new_Line' was not declared in this scope

  new_Line,    // 0

  ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:73:2: error: 'Page1_Line7' was not declared in this scope

  Page1_Line7,   // 6

  ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:74:2: error: 'Page1_Line13' was not declared in this scope

  Page1_Line13,    // 7

  ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:75:2: error: 'Page1_Line10' was not declared in this scope

  Page1_Line10 // 9

  ^

Using library SPI at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI
Using library WizFiShield in folder: G:\Arduino Projects\libraries\WizFiShield (legacy)
Using library TimerOne at version 1.1 in folder: G:\Arduino Projects\libraries\TimerOne
exit status 1
Error compiling for board Arduino/Genuino Uno.


I don't know whether I'm using the proper libraries.
I need some guidance from those who have successfully implemented any project with this shield.

Leff, plse help.
Thanks.
Ans

Re: DFRobot wifi shield v2.2 for IoT

Unread postPosted:Tue Jul 26, 2016 9:46 am
by Leff
Hi Ans,

I am not sure where did you get that library. May I have a link? Anyway, this is what I did today:

  1. I got one from Github https://github.com/daleInMelbourne/Ardu ... 10_Library, however, it got problem that missing TimerOne.h

    Code: Select all
    C:\Users\God Bless DFrobot\Documents\Arduino\libraries\Arduino_WizFi210_Library-master\WizFi_Shield_Test\WizFi_Shield_Test.ino:26:22: fatal error: TimerOne.h: No such file or directory

     #include <TimerOne.h>

  2. So I searched that file again, https://github.com/dalmirdasilva/Arduin ... r/TimerOne, but got another error as:

    Code: Select all
    C:\Users\God Bless DFrobot\Documents\Arduino\libraries\Arduino_WizFi210_Library-master\wizif210.c:2:27: fatal error: stm32f10x_lib.h: No such file or directory

     #include "stm32f10x_lib.h"

                               ^

    compilation terminated.

Hope to test yours.

Re: DFRobot wifi shield v2.2 for IoT

Unread postPosted:Tue Jul 26, 2016 3:54 pm
by a.murdan
Dear Leff,
I downloaded the WizFiShield library for this link: https://github.com/Wiznet/WizFiShield
After unzipping, you'll find 3 folders (Document, Hardware and Software). The libraries WizFiShield and TimerOne are in the Software folder.
Thanks fro testing and informing me.
Best Regards,
Ans

Re: DFRobot wifi shield v2.2 for IoT

Unread postPosted:Wed Jul 27, 2016 9:10 am
by Leff
Hi Update:

Thanks for your link, I tried that one without problem except the Security was commented by the default code, no problem then. Try again. I will go on working on IOT stuff...

(25.78 KiB) Downloaded 1877 times


(24.38 KiB) Downloaded 1877 times

Re: DFRobot wifi shield v2.2 for IoT

Unread postPosted:Thu Jul 28, 2016 6:41 pm
by a.murdan
Dear Leff,
I tried it again and again. I even installed the new arduino ide version 1.6.10.
I also reinstalled the WizFi libraries.
I am still getting the following errors:
Code: Select all
G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:6:1: error: 'prog_char' does not name a type

 prog_char Page1_Line0[] PROGMEM = "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.2//EN\" ";   // "String 0" etc are strings to store - change to suit.

 ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:7:1: error: 'prog_char' does not name a type

 prog_char Page1_Line1[] PROGMEM = "\"http://www.wapforum.org/DTD/xhtml-mobile 12.dtd\">\r\n";   // "String 0" etc are strings to store - change to suit.

 ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:8:1: error: 'prog_char' does not name a type

 prog_char Html_start[] PROGMEM = "<html>\r\n";   // "String 0" etc are strings to store - change to suit.

 ^

G:\Arduino Projects\libraries\WizFiShield\HTMLPages.cpp:9:1: error: 'prog_char' does not name a type

 prog_char head_start[] PROGMEM = "<head>\r\n";   // "String 0" etc are strings to store - change to suit.


Kindly help me.
Thanks.
Ans

Re: DFRobot wifi shield v2.2 for IoT

Unread postPosted:Fri Jul 29, 2016 8:34 am
by Leff
Hi,

I attached the lib I used on my win10 for your reference.

(49.64 KiB) Downloaded 275 times


And I searched out and found two possible useful suggestions:

1. When I tried compiling again, it gave me an error that all of my lines with "prog_char" needed to be const. OK, so I added const before each prog_char. Then it compiled fine. So, if for some reason you're stuck with the Arduino IDE V1.5.7, this might be a work-around for you. from http://openbci.com/forum/index.php?p=/d ... ame-a-type

2. Another is to try on Arduino 1.0.6. (But mine 1.6.9 also works, I tried several sketches, no problem at all)

Re: DFRobot wifi shield v2.2 for IoT

Unread postPosted:Wed Aug 03, 2016 11:32 am
by a.murdan
Thanks Jeff,
I did what you recommended. It finally worked.
However it would be desirable if DFRobot could provide the appropriate libraries for its shields (just like other vendors like Adafruit, SparkFun, etc).
Also I queried with Blynk. They do not currently support WizFi, on their platform.
Any idea how we could develop something with DFRobot wifi shield, to make it compatible with Blynk?
Thanks.
Ans

Re: DFRobot wifi shield v2.2 for IoT

Unread postPosted:Thu Aug 04, 2016 4:17 am
by Leff
Hi Ans,

Thanks to follow up, so how did you solve it, library issue?

Sorry to hear that WizFi can not work with Blynk. BTW, why not try other cloud service? (I am not very know about IoT stuff...)

And thanks for your advice, you are in right-right place that our examples for our products are limited, we are working on this short board. ;)