Amount of Data sent

Hi to all.
i have build a small weather station that i transmit some data i have collected with my arduino to a server.
i am using sim800l module to send the data through gprs

Everything working fine but would like to know if there is any method or command to read how many bytes of data i am sending in order to calculate my sim card plan from my mobile provider (how many Mb will have every month )

i dont know if that helps but when i send the command "AT+HTTPACTION=0" i am getting as response "+HTTPACTION: 0,200,2"

here is what i am sending :

/// type of variables of my sensors ////

int Sensor01Data;
int Sensor02Data;
int Sensor03Data;
int Sensor04Data;
int Sensor05Data;
int Sensor06Data;
float Sensor07Data;
int Sensor08Data;
float Sensor09Data;
float Sensor10Data;
float Sensor11Data ;

///////////////////  code that i am sending with At command ////////////////

mySerial.print(Sensor01Data); // variable of
mySerial.print(Sensor02Data); // variable of
mySerial.print(Sensor03Data); // variable of
mySerial.print(Sensor04Data); // variable of
mySerial.print(Sensor05Data); // variable of
mySerial.print(Sensor06Data); // variable of
mySerial.print(Sensor07Data); // variable of
mySerial.print(Sensor08Data); // variable of
mySerial.print(Sensor09Data); // variable of
mySerial.print(Sensor10Data); // variable of
mySerial.print(Sensor11Data); // variable of
mySerial.println("\""); // THIS IS WHERE THE 'ln' comes in

thanks in advance

print() returns the number of bytes written, so just declare a variable, initialize to 0 and add each print up

size_t count = 0;
count +=  mySerial.print("AT+HTTPPARA=\"URL\",\"");
count +=  mySerial.print(Sensor01Data); // variable of
count +=  mySerial.print("&sensor02=");
count +=  mySerial.print(Sensor02Data); // variable of
count +=  mySerial.print("&sensor03=");

Using shorter variable names in the URL ("&s1=") will reduce your size

(It’s not exactly the data traffic though, you have the AT command of course and there might be headers etc)

1 Like

Thank you very much !! (Learned and new method today :slight_smile: +1)

i guess the number in "count" that will take it is going to be in Bytes. right?

thanks again . that helped me a lot

Yes, I was editing my post when you were answering though

:arrow_right:︎ It’s not exactly the data traffic though, you have the AT command of course and there might be headers etc. But it’s a good proxy

1 Like

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.