ArduinoGeneral

Wifi Shield V2.2 + Arduino Web Browser Help Needed

userHead Ali.Irshad 2012-08-12 01:55:41 14271 Views19 Replies
Hey Everyone,
I have a university project in which i have to control 2 servos with wifi. I am using Arduino UNO and Wifi Shield V2.2 (Picture included). Like many people i too ran into many issues setting the Wifi Shield up but in the end i found a way.
Like everyone i got the "AT Command Error" and "Serial Command Error" but reading MANY tutorials and going through many forum i found a way that worked for me. I will provide a PDF file in which how i faced my problems in setting it up and how it worked for me.

Below is the Commands for Arduino Uno initially set up to control the 2 servos.

[code]#include <Servo.h>
Servo servoMain1;
Servo servoMain2;

int pos = 90;

void setup()
{
Serial.begin(115200);
servoMain1.attach(5);
servoMain2.attach(6);
}

void loop()
{
while (Serial.available() == 0);
int val = Serial.read() - '0';

if (val == 1)
{
Serial.println ("LEFT");
servoMain1.write(0);
servoMain2.write(0);
delay(1000);
servoMain1.write(90);
servoMain2.write(90);
delay(1000);
}
else if (val == 2)
{ Serial.println("RIGHT");
servoMain1.write(180);
servoMain2.write(180);
delay(1000);
servoMain1.write(90);
servoMain2.write(90);
delay(1000);
}
else if (val == 3)
{ Serial.println("CLOSE ARM");
servoMain1.write(180);
servoMain2.write(0);
delay(1000);
servoMain1.write(90);
servoMain2.write(90);
delay(1000);
}
else if (val == 4)
{ Serial.println("OPEN ARM");
servoMain1.write(0);
servoMain2.write(180);
delay(1000);
servoMain1.write(90);
servoMain2.write(90);
delay(1000);
}
else
{
Serial.println("Invalid!");
}
Serial.flush();
}
[/code]

Problem:
1- After setting up the Wifi Shield i select the "Automatic Connection", Dissconnect the Wifi Shield and run the Arduino Uno and Wifi Shield with a 9 Volt Battery it is no loner connect to the Wifi.
2- What is the next step to control it wirelessly? (In the PDF File provided you can see till where i have reached my setup)

Basically i have seen people controlling there Arduino with a web browser. I would like to know how do they do it? is there a tutorial that would guide me to achive this goal?

Would REALLY REALLY appriciate your help
ThankYou

Ali.
2012-09-07 14:07:03 Hi Princess, did you resolved this problem, because I have the same as you describe.
tks.

[quote="princess007"]
I see that the IP address that im suppose to enter is that same as the one for my computer however when i enter that IP address the putty window does appear but disappears after 5 seconds. Do u know what could be causing this?

Thanks
[/quote]
userHeadPic thiagocoradi
2012-09-07 14:07:03 Hi Princess, did you resolved this problem, because I have the same as you describe.
tks.

[quote="princess007"]
I see that the IP address that im suppose to enter is that same as the one for my computer however when i enter that IP address the putty window does appear but disappears after 5 seconds. Do u know what could be causing this?

Thanks
[/quote]
userHeadPic thiagocoradi
2012-08-13 16:33:43 Hi Princess,


You need to set a completely unique IP address to the shield. If you are using the same IP address for your shield as for your PC you are causing a conflict.


So for example your PC's IP address: 192.168.1.3
Set your Wifi shields IP address to: 192.168.1.45


I'm not sure how big the network you are on is, but make sure the IP address you set for the shield is not in use by another device. A good way to check is to see your routers IP table, here you will find a list of all the issued (used) IP addresses.




@Ali.Irshad,


With the Wifi shield, there is no libraries for it. So you can't use the Arduino IDE's included Ethernet libraries...


Here is a couple of things to try:


1. set the shield to server mode. So that it waits for an incoming request.


When your PC sends a request through the browser to the Arduino's IP address, have the Arduino reply with some basic HTML code.
This is a good site to[url=http://www.w3schools.com/html/default.asp] learn HTML[/url].
just:
Serial.println("<HTML>");
Serial.println(" [font=courier new][size=13px]<p>My first paragraph.</p>[/size][/font] ");
Serial.println("</HTML>");


just make sure the Arduino waits for an incoming request from the browser. I'm not sure if this will work.


IF this doesn't work, then my next suggestion would be to set a processing script on your PC to interact with the Arduino.


You might like to try uploading the "firmata" sketch included with the Arduino IDE.


But, this would be a processing sketch and not something controlled by a web browser.
userHeadPic Hector
2012-08-13 16:33:43 Hi Princess,


You need to set a completely unique IP address to the shield. If you are using the same IP address for your shield as for your PC you are causing a conflict.


So for example your PC's IP address: 192.168.1.3
Set your Wifi shields IP address to: 192.168.1.45


I'm not sure how big the network you are on is, but make sure the IP address you set for the shield is not in use by another device. A good way to check is to see your routers IP table, here you will find a list of all the issued (used) IP addresses.




@Ali.Irshad,


With the Wifi shield, there is no libraries for it. So you can't use the Arduino IDE's included Ethernet libraries...


Here is a couple of things to try:


1. set the shield to server mode. So that it waits for an incoming request.


When your PC sends a request through the browser to the Arduino's IP address, have the Arduino reply with some basic HTML code.
This is a good site to[url=http://www.w3schools.com/html/default.asp] learn HTML[/url].
just:
Serial.println("<HTML>");
Serial.println(" [font=courier new][size=13px]<p>My first paragraph.</p>[/size][/font] ");
Serial.println("</HTML>");


just make sure the Arduino waits for an incoming request from the browser. I'm not sure if this will work.


IF this doesn't work, then my next suggestion would be to set a processing script on your PC to interact with the Arduino.


You might like to try uploading the "firmata" sketch included with the Arduino IDE.


But, this would be a processing sketch and not something controlled by a web browser.
userHeadPic Hector
2012-08-12 03:07:36 I would provide one if i could but the window just disappears.. im going to take your advice and reload blink and then work with putty from the start and see if it works.

Thank you for your help
I really appreciate it!
userHeadPic princess007
2012-08-12 03:07:36 I would provide one if i could but the window just disappears.. im going to take your advice and reload blink and then work with putty from the start and see if it works.

Thank you for your help
I really appreciate it!
userHeadPic princess007
2012-08-12 03:00:51 [quote="princess007"]
I see that the IP address that im suppose to enter is that same as the one for my computer however when i enter that IP address the putty window does appear but disappears after 5 seconds. Do u know what could be causing this?

Thanks
[/quote]

I am not sure what could be causing that error. I have never faced an error like that while setting up the Wifi Shield. Did you try the "Third Way" provided in the PDF File?

Wifi shield is bit irritating to work with try Factory resetting the Wifi Shield, Start Arduino Uno and load the example "Blink" and then try using PuTTY.

Can you show me a screen shot of the error you get? it would be easier for me to understand. Thank You.


Ali.
userHeadPic Ali.Irshad
2012-08-12 03:00:51 [quote="princess007"]
I see that the IP address that im suppose to enter is that same as the one for my computer however when i enter that IP address the putty window does appear but disappears after 5 seconds. Do u know what could be causing this?

Thanks
[/quote]

I am not sure what could be causing that error. I have never faced an error like that while setting up the Wifi Shield. Did you try the "Third Way" provided in the PDF File?

Wifi shield is bit irritating to work with try Factory resetting the Wifi Shield, Start Arduino Uno and load the example "Blink" and then try using PuTTY.

Can you show me a screen shot of the error you get? it would be easier for me to understand. Thank You.


Ali.
userHeadPic Ali.Irshad
2012-08-12 02:51:14 I see that the IP address that im suppose to enter is that same as the one for my computer however when i enter that IP address the putty window does appear but disappears after 5 seconds. Do u know what could be causing this?

Thanks
userHeadPic princess007
2012-08-12 02:51:14 I see that the IP address that im suppose to enter is that same as the one for my computer however when i enter that IP address the putty window does appear but disappears after 5 seconds. Do u know what could be causing this?

Thanks
userHeadPic princess007
2012-08-12 02:47:41 [quote="princess007"]
I have looked at those im having problems when i have to enter the ip address into the host on putty in order to turn the lights on and of. At the moment i have set the AT+NDHCP=0 but im not sure as to where to find the IP address?
[/quote]

Well if you want to find your IP Address
-Press start, Enter "cmd" in the search bar and Press Enter
-Type "IPConfig /All" press enter in the cmd window
-A huge list will show in which you can find the IP, Subnet Mask and Default Gateway.

Hope this helps.

Ali.
userHeadPic Ali.Irshad
2012-08-12 02:47:41 [quote="princess007"]
I have looked at those im having problems when i have to enter the ip address into the host on putty in order to turn the lights on and of. At the moment i have set the AT+NDHCP=0 but im not sure as to where to find the IP address?
[/quote]

Well if you want to find your IP Address
-Press start, Enter "cmd" in the search bar and Press Enter
-Type "IPConfig /All" press enter in the cmd window
-A huge list will show in which you can find the IP, Subnet Mask and Default Gateway.

Hope this helps.

Ali.
userHeadPic Ali.Irshad
2012-08-12 02:38:34 I have looked at those im having problems when i have to enter the ip address into the host on putty in order to turn the lights on and of. At the moment i have set the AT+NDHCP=0 but im not sure as to where to find the IP address? userHeadPic princess007
2012-08-12 02:38:34 I have looked at those im having problems when i have to enter the ip address into the host on putty in order to turn the lights on and of. At the moment i have set the AT+NDHCP=0 but im not sure as to where to find the IP address? userHeadPic princess007
2012-08-12 02:32:36 Did you try the AT Commands at Wifi shield's Wiki?
[url=https://www.dfrobot.com/wiki/index.php?title=WiFi_Shield_V2.1_For_Arduino_(SKU:TEL0047)]https://www.dfrobot.com/wiki/index.php?title=WiFi_Shield_V2.1_For_Arduino_(SKU:TEL0047)[/url]

Or the AT Command Tutorial at Wifi shield Page?
[url=https://www.dfrobot.com/image/data/TEL0047/wifi%20Shield%20V2-1-AT%20tutorial.pdf]https://www.dfrobot.com/image/data/TEL0047/wifi%20Shield%20V2-1-AT%20tutorial.pdf[/url]

Can you tell me exactly where you are having problem is it at "AT+NSET="?
userHeadPic Ali.Irshad
2012-08-12 02:32:36 Did you try the AT Commands at Wifi shield's Wiki?
[url=https://www.dfrobot.com/wiki/index.php?title=WiFi_Shield_V2.1_For_Arduino_(SKU:TEL0047)]https://www.dfrobot.com/wiki/index.php?title=WiFi_Shield_V2.1_For_Arduino_(SKU:TEL0047)[/url]

Or the AT Command Tutorial at Wifi shield Page?
[url=https://www.dfrobot.com/image/data/TEL0047/wifi%20Shield%20V2-1-AT%20tutorial.pdf]https://www.dfrobot.com/image/data/TEL0047/wifi%20Shield%20V2-1-AT%20tutorial.pdf[/url]

Can you tell me exactly where you are having problem is it at "AT+NSET="?
userHeadPic Ali.Irshad
2012-08-12 02:15:35 Hi

I am currently setting my wifi shield up but am having problems with the IP address im not sure how to set my own using AT commands. Please could you help me with this would really appreciate it.

Thank you
userHeadPic princess007
2012-08-12 02:15:35 Hi

I am currently setting my wifi shield up but am having problems with the IP address im not sure how to set my own using AT commands. Please could you help me with this would really appreciate it.

Thank you
userHeadPic princess007
2012-08-12 01:55:41 Hey Everyone,
I have a university project in which i have to control 2 servos with wifi. I am using Arduino UNO and Wifi Shield V2.2 (Picture included). Like many people i too ran into many issues setting the Wifi Shield up but in the end i found a way.
Like everyone i got the "AT Command Error" and "Serial Command Error" but reading MANY tutorials and going through many forum i found a way that worked for me. I will provide a PDF file in which how i faced my problems in setting it up and how it worked for me.

Below is the Commands for Arduino Uno initially set up to control the 2 servos.

[code]#include <Servo.h>
Servo servoMain1;
Servo servoMain2;

int pos = 90;

void setup()
{
  Serial.begin(115200);
  servoMain1.attach(5);
  servoMain2.attach(6);
}

void loop()
{
  while (Serial.available() == 0);
  int val = Serial.read() - '0';
 
  if (val == 1)
  {
    Serial.println ("LEFT");
  servoMain1.write(0);
  servoMain2.write(0); 
  delay(1000);         
  servoMain1.write(90); 
  servoMain2.write(90); 
  delay(1000);         
}
  else if (val == 2)
{ Serial.println("RIGHT");
  servoMain1.write(180);
  servoMain2.write(180); 
  delay(1000);         
  servoMain1.write(90); 
  servoMain2.write(90); 
  delay(1000); 
}
else if (val == 3)
{ Serial.println("CLOSE ARM");
  servoMain1.write(180);
  servoMain2.write(0); 
  delay(1000);         
  servoMain1.write(90); 
  servoMain2.write(90); 
  delay(1000);
}
else if (val == 4)
{ Serial.println("OPEN ARM");
  servoMain1.write(0);
  servoMain2.write(180); 
  delay(1000);         
  servoMain1.write(90); 
  servoMain2.write(90); 
  delay(1000);
}
else
{
  Serial.println("Invalid!");
}
Serial.flush();
}
[/code]

Problem:
1- After setting up the Wifi Shield i select the "Automatic Connection", Dissconnect the Wifi Shield and run the Arduino Uno and Wifi Shield with a 9 Volt Battery it is no loner connect to the Wifi.
2- What is the next step to control it wirelessly? (In the PDF File provided you can see till where i have reached my setup)

Basically i have seen people controlling there Arduino with a web browser. I would like to know how do they do it? is there a tutorial that would guide me to achive this goal?

Would REALLY REALLY appriciate your help
ThankYou

Ali.
userHeadPic Ali.Irshad