[SOLVED] I can´t communicate Goblin 2 with Ubidots example code


#1

Hi.

I´ve been trying to test the Ubidots example code for the Goblin 2 board, I put in my token, ID variable and APN, but serial monitor only show hieroglyphics at 9600 Bauds, and if I change it to 115200 Bauds show me this.

START

+STIN: 25

+STIN: 25

+CPIN: READY

+STIN: 25

SMS DONE

+VOICEMAIL: INIT_STATE, 0, 0

PB DONE

This is my code.

//////////////////////////////////////////////////////////////////////////////////////////
#include <SoftwareSerial.h>

SoftwareSerial SIM5320(5, 4);                //RX, TX

char    BUFFER_USART;                        //BUFFER RX 
String  token = "BBFF-wZ2pGiSWY8csJO60O1XXXXXXXXXXXX"; //TOKEN UBIDOTS
String  id    = "5bf094d41d8472262XXXXXXX"; //ID VARIABLE UBIDOTS

void setup() { 
  pinMode(5, OUTPUT);                              //PIN ON SIM5320
  SIM5320.begin(9600);
  SIM5320_ON();                                    //ON SIM5320
  delay(10000);
  SETUP_SIM5320();                                 //START SIM5320
}

void loop() {

  WEB();                                           //SEND JSON UBIDOTS
  delay(1000);                                    //SAMPLE TIME
}
///////////////////////////////////////////////////////////////////////////
ISR (USART_RX_vect)
{
  BUFFER_USART = UDR0;                               // READ THE BUFFER RX
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void WEB()                                  
{
  int LONG_JSON = 15;
  int SEND = 214;
    
  float temp = 20.0;
  SIM5320.println(F("AT+CIPOPEN=0,\"TCP\",\"things.ubidots.com\",80"));  //
  delay(5000); 
  SIM5320.print("AT+CIPSEND=0,");  //
  delay(50);
  SIM5320.println(SEND);  //
  delay(600);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  SIM5320.print(F("POST /api/v1.6/variables/"));
  delay(50);
  SIM5320.print(id);
  delay(50);
  SIM5320.println(F("/values  HTTP/1.1"));
  delay(50);
  SIM5320.println(F("Content-Type: application/json"));
  delay(50);
  SIM5320.print(F("Content-Length:"));
  delay(50);
  SIM5320.println(LONG_JSON);
  delay(50);
  SIM5320.print(F("X-Auth-Token: "));
  delay(50);
  SIM5320.println(token);
  delay(50);
  SIM5320.println(F("Host: things.ubidots.com"));
  delay(50);
  SIM5320.println("");
  ///////////////////////////////////////////////////////////////
  SIM5320.print("{\"value\":");
  delay(10);
  SIM5320.print(temp,2);
  delay(50);
  SIM5320.println("}");
  delay(50);
  SIM5320.write(0x1A);
  delay(5000);
  SIM5320.println(F("AT+CIPCLOSE=0"));
  delay(4000);

}

void SIM5320_ON()          
{
  digitalWrite(5, HIGH);
  delay(2000);//                            
  digitalWrite(5, LOW);
  delay(2000);
}
/////////////////////////////////////////////////////////////////////////////
void SETUP_SIM5320()
{
  SIM5320.println(F("AT+CFUN=1"));                      //SIM5320 WORKING WITH ALL THE FEATURES
  delay(250);

  SIM5320.println(F("AT+CNMP=2"));                      //AUTOMATIC MODE
  delay(250);

  SIM5320.println(F("AT+CVAUXV=61"));                   //3.0V OUTPUT VOLTAGE
  delay(250);

  SIM5320.println(F("AT+CNBP=0x0000000004000000"));     //3G 850MHZ TELCEL 0x0000000004000000 hspda     2G 1900MHZ TELCEL AT+CNBP=0x0000000000200000 edge
  delay(500);

  SIM5320.println(F("AT+CSQ"));                         //SIGNAL LEVEL
  delay(250);

  SIM5320.println(F("AT+CREG?"));          
  delay(250);

  SIM5320.println(F("AT+COPS?"));
  delay(250);
 
  SIM5320.println(F("AT+CGSOCKCONT=1,\"IP\",\"web.colombiamovil.com.co\""));
  delay(250);

  SIM5320.println(F("AT+CNSMOD?"));                     //MUESTRA EN QUE RED ESTA TRABAJANDO
  delay(250);

  SIM5320.println(F("AT+CSOCKSETPN=1"));
  delay(250);

  SIM5320.println(F("AT+CIPMODE=0"));
  delay(250);

  SIM5320.println(F("AT+CNBP?"));
  delay(250);

  SIM5320.println(F("AT+NETOPEN"));
  delay(8000);

  SIM5320.println(F("AT+IPADDR"));                       //IP
  delay(500);

  SIM5320.println(F("AT+CGSN"));                         //IMEI
  delay(500);
}
///////////////////////////////////////////////////////////////////////////////////////////////

Can you please say me what is wrong with the code?

Thanks in advances.


#2

Greetings, can you be more specific about your issue? Is your device getting IP address from your IPS server? Have you tried to make a GET request to another site like google.com to discard hardware or connection issues?

You can find at our examples the proper way to build a TCP or HTTP payload, feel free to edit them to fit your needs.

All the best


#3

Hi @jotathebest thanks for your reply.

It seems to be a problem with TiGO’s Colombia APN cuz my mate’s Goblin 2 works now perfect with another operator sim card. I will try to connect mine with his sim card just to dismiss a board malfunction.