Pages: [1]   Go Down
Author Topic: Wifi Shield WIZ610Wi question  (Read 2355 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi,
i'm pretty new to arduino and i'm not really getting the method to set up my wifi shield.
I have a arduino Uno with the following WiFi Shield (http://www.dfrobot.com/index.php?route=product/product&keyword=wifi&category_id=0&description=1&model=1&product_id=198)
I want to create a ad-hoc network so I can connect to the arduino with an iPad. When i'm connected I would like to switch a led on and off by calling some URL's.

I have imported the WiServer library. But when I change the SSID etc it doesn't have effect on my network. I can connect to the wifi module with the standard ip (192.168.1.254) but it sends me to the config from the module. Isn't it possible to override these settings?

Thanks for you reply.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I have imported the WiServer library.
Into?

Quote
But when I change the SSID etc it doesn't have effect on my network.
Setting SSID shouldn't affect your network. It should allow the Arduino with shield to join the network.

Quote
I can connect to the wifi module with the standard ip (192.168.1.254) but it sends me to the config from the module.
Now, I recognize all of these words, but the order leaves a bit to be desired.

You connect to the wifi module from where/what? Which device is using that IP address? What is "it" that is sending you somewhere? "to the config from the module" is just a random collection of words devoid of meaning.

Please try again.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

let's try again smiley I was pretty frustrated yesterday after fiddling for hours with the wifi shield.
Like I said, I would like to create an Adhoc network so my iPad can connect to Arduino. By calling an URL i would like to switch a led on/off

So far i managed to have the wifi shield up and running. I see a new wifi network and my computer can connect to it. I can open the wifi webadmin by entering the IP in my browser. I tried the WiServer library but I'm not sure it is compatible with my wifi shield.

Can someone give me some guidelines where to start?

thanks.
Logged

Arlington, MA, USA
Offline Offline
Sr. Member
****
Karma: 0
Posts: 259
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Are you *positive* you want your laptop connecting directly to the arduino?? There's nothing wrong with that, to be sure, but a more common arrangement would be to have both devices connect to an access point (typically, your router), at which point you can communicate between them via IP (TCP, UDP, etc). You do understand that if you configure your arduino as the network to connect to, your laptop will (likely) only be connecting to it and not the rest of your home network and/or internet, right? At least not through the same interface, unless you're doing something very sophisticated.

If you have both devices (laptop & arduino) associate with your router/AP, you can run a server on your arduino and talk to it from the laptop. The arduino doesn't *have to* provide the wireless network you associate with. And if you do go about it that way, you will have to manually configure an IP address on your laptop, one that is compatible with the one you've assigned your arduino.

I'm not trying to tell you not to do it the way you are, just want to be sure you understand.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Wimson,


i bought the same shield a few days ago and had some trouble configuring it myself but finally got it working.
This wifi shield will transform tcp packets to serial commands. I'm trying to build a wireless robot, and want to do that from within a web browser or an app.
I managed to get it working with flash, and with visual studio.net in c#. Problem for you is ofcourse that you have an ipad, so no flash for you smiley-wink.
I'd look into sockets, you can simply talk to your wifi shield when you connect to it via it's ip and the port (default 5000).

For example, my flash code to connect and send commands looks like this:


(this app prints the serial commands that are send to your arduino)
Code:

import flash.errors.*;
import flash.events.*;
import flash.net.Socket;

//Create a socket connection to the deafult tinkerProxy port
var arduinoSocket:Socket = new Socket("192.168.0.193",5000);


send_btn.addEventListener(MouseEvent.CLICK,buttonHandler);

function buttonHandler(e:MouseEvent):void{
writeln(command.text);
}


arduinoSocket.addEventListener(Event.CLOSE, closeHandler);
arduinoSocket.addEventListener(Event.CONNECT, connectHandler);
arduinoSocket.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
arduinoSocket.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
arduinoSocket.addEventListener(ProgressEvent.SOCKET_DATA, socketDataHandler);

stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
stage.addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);

function writeln(str:String):void {
        try {
           arduinoSocket.writeUTFBytes(str);
arduinoSocket.flush();
        }
        catch(e:IOError) {
            trace(e);
        }
    }

    function readResponse():void {
        serialOutput.text += arduinoSocket.readUTFBytes(arduinoSocket.bytesAvailable) + "\n";
    }

    function closeHandler(event:Event):void {
        trace("closeHandler: " + event);
    }

    function connectHandler(event:Event):void {
        trace("connectHandler: " + event);
    }

    function ioErrorHandler(event:IOErrorEvent):void {
        trace("ioErrorHandler: " + event);
    }

    function securityErrorHandler(event:SecurityErrorEvent):void {
        trace("securityErrorHandler: " + event);
    }

    function socketDataHandler(event:ProgressEvent):void {
        trace("socketDataHandler: " + event);
        readResponse();
    }



Feel free to ask more if you need some advice.
« Last Edit: October 13, 2011, 11:28:23 am by Catarrian » Logged

0
Offline Offline
Tesla Member
***
Karma: 141
Posts: 9470
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I'm trying to build a wireless robot, and want to do that from within a web browser or an app.

You probably could use a simple web page like below for control via browser.

Code:
//zoomkat 9-5-11
//simple button GET with iframe code
//for use with IDE 0021
//open serial monitor to see what the arduino receives
//use the \ slash to escape the " in the html
//address will look like http://192.168.1.102:84/ when submited
//for use with W5100 based ethernet shields

#include <SPI.h>
#include <Ethernet.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
byte ip[] = { 192, 168, 1, 102 }; // ip in lan
byte gateway[] = { 192, 168, 1, 1 }; // internet access via router
byte subnet[] = { 255, 255, 255, 0 }; //subnet mask
Server server(84); //server port

String readString;

//////////////////////

void setup(){

  pinMode(4, OUTPUT); //pin selected to control
  //start Ethernet
  Ethernet.begin(mac, ip, gateway, subnet);
  server.begin();

  //enable serial data print
  Serial.begin(9600);
  Serial.println("servertest1"); // so I can keep track of what is loaded
}

void loop(){
  // Create a client connection
  Client client = server.available();
  if (client) {
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();

        //read char by char HTTP request
        if (readString.length() < 100) {

          //store characters to string
          readString += c;
          //Serial.print(c);
        }

        //if HTTP request has ended
        if (c == '\n') {

          ///////////////
          Serial.println(readString); //print to serial monitor for debuging

          //now output HTML data header
             if(readString.indexOf('?') >=0) { //don't send new page
               client.println("HTTP/1.1 204 Zoomkat");
               client.println();
               client.println(); 
             }
             else {
          client.println("HTTP/1.1 200 OK"); //send new page
          client.println("Content-Type: text/html");
          client.println();

          client.println("<HTML>");
          client.println("<HEAD>");
          client.println("<TITLE>Arduino GET test page</TITLE>");
          client.println("</HEAD>");
          client.println("<BODY>");

          client.println("<H1>Zoomkat's simple Arduino button</H1>");
         
          client.println("<a href=\"/?on\" target=\"inlineframe\">ON</a>");
          client.println("<a href=\"/?off\" target=\"inlineframe\">OFF</a>");

          //client.println("<IFRAME name=inlineframe src=\"res://D:/WINDOWS/dnserror.htm\" width=1 height=1\">");
          client.println("<IFRAME name=inlineframe style=\"display:none\" >");         
          client.println("</IFRAME>");

          client.println("</BODY>");
          client.println("</HTML>");
             }

          delay(1);
          //stopping client
          client.stop();

          ///////////////////// control arduino pin
          if(readString.indexOf("on") >0)//checks for on
          {
            digitalWrite(4, HIGH);    // set pin 4 high
            Serial.println("Led On");
          }
          if(readString.indexOf("off") >0)//checks for off
          {
            digitalWrite(4, LOW);    // set pin 4 low
            Serial.println("Led Off");
          }
          //clearing string for next read
          readString="";

        }
      }
    }
  }
}

Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

0
Offline Offline
Tesla Member
***
Karma: 141
Posts: 9470
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I looked at the below tutorial and making an easy interface is probably out of the picture. May be much easier to use a wireless router and ethernet shield with an arduino so you can use a browser based interface (bottom).

http://www.dfrobot.com/community/index.php/2011/07/tutorial-dfrobot-wifi-shield-sku-tel0019/#comment-111

http://www.lynxmotion.net/viewtopic.php?f=20&t=6343
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Pages: [1]   Go Up
Jump to: