Go Down

Topic: GSM continuous data sending problem to server (Read 448 times) previous topic - next topic

Fazlul_karim

code given in here

voltage,temp,current,frequency are real time value


String one="a=";
String two=String (one+voltage01);


String three="b=";
String four=String (three+current01);


String five="c=";
String six=String (five+frequency01);


String seven="d=";
String eight=String (seven+stator_temp01);


String nine="e=";
String ten=String (nine+rotor_temp01);


String need="&";

String final01=String (two+need+four+need+six+need+eight+need+ten);

Serial println(final01);


mySerial.println("AT+HTTPPARA=\"URL\",\"www.imkhalid.info/fazlu/data.php?"+final01+"\"");
 delay(1000);
  ShowSerialData();
 
   mySerial.println("AT+HTTPACTION=1");//submit the request
 delay(5000);
 ShowSerialData();

output

serial monitor shows

a=0.00&b=37.25&c= INF&d=29.63&e=-127.00



AT+HTTPPARA="URL","www.imkhalid.info/fazlu/data.php?a=0.00&b=37

AT+HTTPACTION=1

OK

+HTTPACTION:1,200,0

server only shows this

a=0.00&b=37  .
where the ohers value.is this for GSM 2G feature.
what is the solution of it.

J-M-L

#1
Oct 20, 2016, 09:42 am Last Edit: Oct 20, 2016, 09:44 am by J-M-L
What do you see if you do

Serial.println("AT+HTTPPARA=\"URL\",\"www.imkhalid.info/fazlu/data.php?"+final01+"\"");?

Also remember software serial buffer is limited... might want some timing built into what you do

PS: I'd say drop the way you use String object in the first place and use char arrays

Please do not PM me for help,  others will benefit as well if you post your question publicly on the forums
Pas de messages privés SVP

PaulS

The sprintf() function will produce the same string without trashing memory. Learn to use it, and forget that the stupid String class even exists.
The art of getting good answers lies in asking good questions.

J-M-L

The sprintf() function will produce the same string without trashing memory. Learn to use it, and forget that the stupid String class even exists.
let's say with a bit of strcat() and dtostrf() because he is using floating point data

but I don't think this is his real problem. if you count the number of character in

AT+HTTPPARA="URL","www.imkhalid.info/fazlu/data.php?a=0.00&b=37

you can see this is 64... 64 and Serial ports rings a bell.. or should...
Please do not PM me for help,  others will benefit as well if you post your question publicly on the forums
Pas de messages privés SVP

PaulS

Quote
you can see this is 64... 64 and Serial ports rings a bell.. or should...
That is being sent out. Sure, it will block when the outgoing buffer gets full. But, that isn't a problem.

OP needs to print to the serial port what is actually being written to the (stupidly named) mySerial instance.

Either the data is correct, or it isn't. Right now, we have no way of knowing.
The art of getting good answers lies in asking good questions.

Fazlul_karim

i also tried in this way but,

Arduino compiling error found.
this line .mySerial.println("AT+HTTPPARA=\"URL\",\"www.imkhalid.info/fazlu/data.php?
a="u"&b="v"&c="w"&d="y"&e="z"\"");

////////
char u[10];
dtostrf(voltage01,8,2,u);
Serial.println(u);


char v[10];
dtostrf(current01,8,2,v);
Serial.println(v);

char w[10];
dtostrf(frequency01,8,2,w);
Serial.println(w);



char y[10];
dtostrf(stator_temp01,8,2,y);
Serial.println(y);


mySerial.println("AT+HTTPPARA=\"URL\",\"www.imkhalid.info/fazlu/data.php?
a="u"&b="v"&c="w"&d="y"&e="z"\"");
 



  delay(1000);
  ShowSerialData();
    mySerial.println("AT+HTTPACTION=1");//submit the request
delay(10000);
 ShowSerialData();
///////

J-M-L

That is being sent out. Sure, it will block when the outgoing buffer gets full. But, that isn't a problem.
Yes - but since he is stating that on the server side he is only receiving

Quote
server only shows this a=0.00&b=37
that seems to indicate that something is happening with the buffer. as we don't know how this is setup and how often he loops this... wondering how the buffer plays with the dynamic String objects he is playing with...


OP needs to print to the serial port what is actually being written to the (stupidly named) mySerial instance.

Either the data is correct, or it isn't. Right now, we have no way of knowing.
Yes - but may be not enough.

indeed would be on safer grounds with a char array.
Please do not PM me for help,  others will benefit as well if you post your question publicly on the forums
Pas de messages privés SVP

PaulS

Quote
mySerial.println("AT+HTTPPARA=\"URL\",\"www.imkhalid.info/fazlu/data.php?
a="u"&b="v"&c="w"&d="y"&e="z"\"");
You seem to think that some automagic concatenation is going to happen here. It is NOT. Get over it.

Code: [Select]
char atCommand[120];
sprintf(atCommand, "AT+HTTPPARA=\"URL\",\"www.imkhalid.info/fazlu/data.php?a=%s&b=%s&c=%s&d=%s&e=%s\"", u, v, w, y, z);
modem.println(atCommand);


Notice the meaningful name for the SoftwareSerial instance, instead of the stupid name.
The art of getting good answers lies in asking good questions.

Fazlul_karim

problem still remain unsolved . please help me.
I try this way

//////
char u[6];
dtostrf(voltage01,6,2,u);
Serial.println(u);

char v[6];
dtostrf(current01,6,2,v);
Serial.println(v);

char w[6];
dtostrf(frequency01,6,2,w);
Serial.println(w);

char y[6];
dtostrf(stator_temp01,6,2,y);
Serial.println(y);


char z[6];
dtostrf(rotor_temp01,6,2,z);
Serial.println(z);
delay(1000);
char atCommand[120];
sprintf(atCommand, "AT+HTTPPARA=\"URL\",\"www.imkhalid.info/fazlu/data.php?a=%s&b=%s&c=%s&d=%s&e=%s\"", u, v, w, y, z);
gsm.println(atCommand);
delay(1000);
ShowSerialData();
 

gsm.println("AT+HTTPACTION=1");//submit the request
delay(10000);
 ShowSerialData();
////////
Serial monitor result
u= 0.00
v=36.00
w= INF
y= 30.69
z=-127.00
//
SERVER  SHOWS
a=
b=
c=
d=0
e=-127.00

i can not find out exact problem.
 

PaulS

Quote
i can not find out exact problem.
You seem incapable of printing the string that you send to the modem to the Serial Monitor app. I really have to wonder why.

It is nearly impossible to fit a 6 character minimum string in a 6 element array and still have room for the terminating NULL. I suspect that you are writing over memory you don't own.

Personally, I'd be concerned about that INF that is printing. Surely you don't expect to put "INF" in a column that expects a float, do you?
The art of getting good answers lies in asking good questions.

Fazlul_karim

thanks all of you .

finally i come out successfully having completing this critical/easy task,sending five variable data to web server.

Go Up