0

FONA3G&Ubidots error handling
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

FONA3G&Ubidots error handling

by mattycnz on Mon Feb 12, 2018 9:16 pm

Hi all,

I have recently purchased an Arduino with a FONA3G module for remote data analysis via Ubidots. I have used a mixture of the Adafruit-Fona and Ubidots-Fona libraries to get the FONA3G working. However after a few days of logging (sometimes up to a week) I loose connection. At this stage I cannot tell whether I loose cell connection or whether it's just the connection to Ubidots but it's annoying nevertheless.

My question is:
What is a good way of confirming a successful transmission? I'm still learning about cellular communication and +AT commands so thought I should ask the pro's.
Below is a snippet of my outgoing code, my hope is I can add some error checking code (maybe within the waitforResponse() routine) so I know if I need to resend the information/reset the connection.

Thanks in advance.

Code: Select all | TOGGLE FULL SIZE
void SendtoUbidots(void)
{
  fona.println(F("AT+CIPOPEN=0,\"TCP\",\"50.23.124.66\",9012"));
  waitforReponse();
  delay(1000);    //changed from 5000
  //sprintf(Values,"T1:%.1f,T2:%.1f|end",T1,T2);
  sprintf(Values,"T1:%.1f,T2:%.1f,T3:%.1f,T4:%.1f,T5:%.1f,Volt:%.1f,Curr:%.1f,xMax:%d,yMax:%d,zMax:%d|end",T1,T2,T3,T4,T5,Volt,Curr,xMax,yMax,zMax);
  fona.print("AT+CIPSEND=0,");
  fona.println(strlen(URL)+strlen(Values));
  delay(50);
  waitforReponse();
  fona.print(URL);
  fona.println(Values);
  fona.write(0x1A);
  waitforReponse();
  delay(1000);      //changed from 12000
  fona.println(F("AT+CIPCLOSE=0"));
  waitforReponse();
}

mattycnz
 
Posts: 1
Joined: Thu Nov 09, 2017 11:44 pm

Re: FONA3G&Ubidots error handling

by adafruit_support_mike on Wed Feb 14, 2018 5:48 am

Read the reply code from the AT+CIPSEND command. It returns three values, including the number of bytes you asked it to send and the number of bytes that it did send.

If the numbers aren't equal, there was a problem with the connection and that link can't be used any more.

adafruit_support_mike
 
Posts: 50038
Joined: Thu Feb 11, 2010 2:51 pm

Please be positive and constructive with your questions and comments.