Question about Adafruit FONA 808 and Arduino Nano


#1

Hi all,

I have a question about Fona 808 (https://www.adafruit.com/products/2542) and Arduino Nano. I’m using the following code:

#include <UbidotsFONA.h>
#include <SoftwareSerial.h>


#define APN  "MY_APN"  // The APN of your operator
#define USER ""  // if your apn doesnt have username just leave it ""
#define PASS ""  // if your apn doesnt have password just leave it ""
#define TOKEN "MY_TOKEN"  // Replace it with your Ubidots token

Ubidots client(TOKEN);

void setup() {
  Serial.begin(115200);
  delay(2000);
  Serial.println("Inicializando Dispositivo...!!!");
  while(!client.setApn(APN, USER, PASS));
  
  
}
void loop() {
    Serial.println("Dentro del Loop...!!!");
    float value1 = analogRead(A0);
    float value2 = analogRead(A1);
    char context[25];
    char context_2[45];
    sprintf(context, "lat=%s$lng=%s", char(1.1232), char(4323.123));
    // To send latitude and longitude to Ubidots and see it in a map widget
    // The format of the context is like this, you must send it like this example
    sprintf(context_2, "Temperature=Value_Of_Temperature$Position=Value_Of_Position$Color=Value_Of_Color");
    // You can send multiple context in one variable, to send it you must add a "$" symbol between every context
    client.add("Variable_Name_One", value1, context);  // Change for your variable name
    client.add("Variable_Name_Two", value2,  context_2);
    client.sendAll();
    delay(5000);
}

and the device is performed setup() options every time it sends variables:

Response of FONA:
OK

Response of FONA:
+SAPBR: 1,1,"10.186.29.42"

OK

Dentro del Loop...!!!
FONA/2.0|POST|EPPokxfymQUNuowFkaLPKSdeNtFci8|FONA=>Variable_Name_One:363.00$ue_Of_Position$Color=Value_Of_Color,Variable_Name_Two:327.00$Temperature=Value_Of_Temperature$Position=Value_Of_Position$Color=Value_Of_Color|end
Response of FONA:
OK

Response of FONA:
OK

CONNECT OK

Response of FONA:
> 
Response of FONA:

Error sending variables
Inicializando Dispositivo...!!!
Attempting to open comm with ATs
Response of FONA:
ÿ
Error
Response of FONA:
AT
OK

+CPIN: READY

The values are uploaded OK, but I dont know if this is OK. I’m talking about rebooting.

Thanks in advance.


#2

Hey @pslencinas,

You receive the error message on the rebooting because the device does not respond at first, once the device responds you will see the OK response and start sending data. So, that’s okay!

Regards.
Maria C


#3

Hi Maria,

thank you for your support, but the Arduino is rebooted every time it finishes the loop sentences. I included only a part of the logs, but it happens always.
Sending data is working, but it always reboots. If you want, I can send you the full logs.

I dont know why, it could be an overflow error or something similar.


#4

Hi @pslencinas,

Perfect, send me the full logs so I can check!

Also, could you test our example and verify if the Arduino still rebooting? I just tested I didn’t have issues!


#5

Hi Maria,

I attached two files (configuration and logs). Arduino Nano is still rebooting. I was checking in the web about this error and it seems that Arduino has a feature called: Automatic (Software) Reset, about serial communication.
https://www.arduino.cc/en/Main/ArduinoBoardNano
Could you tell me what board you are using?

codigo.txt (1.2 KB)
logs.txt (1.9 KB)