arduino uno and wifi headache

Hi, everybody… I’m new on this forum but I have been really desperated with my project… So please if any can help me I will be very happy… I’m trying to transform my aruduino into a TCP Client that send to a database some information every 5 minutes. I have been use a Wizfi 210 module to conetct the arduino to wifi net. The problem is te client send only one message to the server and then lost the comunicaction… The scketch is the follow:

#include <SoftwareSerial.h>
SoftwareSerial nss(2, 3); // rx,tx

String cadena, stringOne, stringTwo, stringThr;
char inByte;

void setup()
{

Serial.begin(9600);
delay(1000);
nss.begin(9600);
delay(1000);
stringOne = String(“GET /arduino.php?registro=RPA&n=Temperatura&v=14 HTTP/1.1”);
stringTwo = String(“Host: 200.28.91.48”);
stringThr = String(“Connection: close”);
cadena = (stringOne + char(10) + stringTwo + char(10) + stringThr + char(10) + char(10));
}

void loop()

{

while (nss.available() > 0) {
inByte = nss.read();
Serial.print(inByte);
}

Serial.println();
delay(3000);

Serial.println(cadena);
nss.println(cadena);
delay(3000);

}

Some body help me??? Thanks a lot

Roberto (from Chile)

that send to a database some information every 5 minutes.

6 seconds != 5 minutes. There is nothing in your code that suggests that stuff is sent every 5 minutes.

There is nothing in your post that defines how your WiFi device is connected to the Arduino. I don't think I've ever seen a Serial based WiFi device.

Yes, sorry i did some changes in this scketh ir oreder to do some tests so i delete 00 from 300000 millisecosnds, but in the real scketh the delay is 300000 ms = 5 minutes. The wifi comunication is whith a wizfi210 module mount into a xbee structure that use the 2 and 3 pins to serial comunication, so for that I have to use the softwareserial library. Thanks

Are you sure that the mess you are sending is correct? Generally, commands are separated by carriage returns AND line feeds.

There is no need to crap the code up using Strings.

Serial.println("GET /arduino.php?registro=RPA&n=Temperatura&v=14 HTTP/1.1");
  nss.println("GET /arduino.php?registro=RPA&n=Temperatura&v=14 HTTP/1.1");
Serial.println("Host: 200.27.90.43");
  nss.println("Host: 200.27.90.43");
Serial.println("Connection: close");
  nss.println("Connection: close");
Serial.println();
 nss.println();

Will do nearly the same thing, without pissing away resources using the String class.

Thaks, I just try that but doesn’t work… Here is the modified sketch:

}

void loop()

{

while (nss.available() > 0) {
inByte = nss.read();
Serial.print(inByte);
}

Serial.println();
delay(3000);

Serial.println(“GET /arduino.php?registro=RPA&n=Temperatura&v=14 HTTP/1.1”);
nss.println(“GET /arduino.php?registro=RPA&n=Temperatura&v=14 HTTP/1.1”);
Serial.println(“Host: 200.28.91.48”);
nss.println(“Host: 200.28.91.48”);
Serial.println(“Connection: close”);
nss.println(“Connection: close”);
Serial.println();
nss.println();
delay(3000);

}

and this is the server answer (is the same in both scketch):


First Message:

GET /arduino.php?registro=RPA&n=Temperatura&v=14 HTTP/1.1
Host: 200.28.91.48
Connection: close

HTTP/1.1 200 OK
Date: Fri, 23 May 2014 20:54:16 GMT
Server: A


Second and next message

GET /arduino.php?registro=RPA&n=Temperatura&v=14 HTTP/1.1
Host: 200.28.91.48
Connection: close

R´U%%õ%¥JreÅR)ªUUWCÂR´U%%õ%¥?ÊÊR)ªUUWCÂRÚ*%%õ%)ÊÊ?
R?

GET /arduino.php?registro=RPA&n=Temperatura&v=14 HTTP/1.1
Host: 200.28.91.48
Connection: close

R´U%%õ%¥JreÅR)ªUUWCÂR´U%%õ%¥?ÊÊR)ªUUWCÂRÚ*%%õ%¥)ÊÊ*)QHR

As you see the first one arrives to the server but the other ones not…

Thanks…

As you see the first one arrives to the server but the other ones not..

Actually, I can't see that at all. What I can see is that the first one resulted in a readable response, while the others appeared not to.

You'd need to look at the server logs to determine what happens with the other messages.

I still haven't seen a link to the hardware you are using.

Paul,

The WizFi 210 module he is using has two UARTs, I2C and SPI, and he seems to be using one of the UARTs