4G Gps sending sms Error

Wireless communications in Waspmote, topologies, node types...
Post Reply
mikismart
Posts: 25
Joined: Thu Jul 11, 2019 8:33 am
Company: Samek Engineering

4G Gps sending sms Error

Post by mikismart » Fri Aug 30, 2019 12:51 pm

hi libelium
when I write to send the gps longitude and latitude to sms their is an error to

Code: Select all

4G module ready...
Restarting the GPS engine
Error calling the 'gpsStart' function. Code: 15
2.1. 4G module configured to use SMS
2.2. Sending SMS...error. Code: 6
how to solve the issue

libelium-dev
Posts: 27967
Joined: Mon Sep 28, 2009 1:06 pm

Re: 4G Gps sending sms Error

Post by libelium-dev » Mon Sep 02, 2019 7:54 am

Hi,

Do the example codes work? The node must have a direct line of sight to the sky in order to achieve good coverage.
http://www.libelium.com/development/was ... nding-sms/
http://www.libelium.com/development/was ... -assisted/

What is the serial ID of the node?

What code did you upload to the node? What API version did you use?

Regards

mikismart
Posts: 25
Joined: Thu Jul 11, 2019 8:33 am
Company: Samek Engineering

Re: 4G Gps sending sms Error

Post by mikismart » Mon Sep 02, 2019 11:09 am

HI
I used API version 4.2 and the cod that I used for IDE v06 of your free code and its library only
the serial id is 5261BC32C8913E0B for smart environment pro.
:oops: :oops: :oops:

libelium-dev
Posts: 27967
Joined: Mon Sep 28, 2009 1:06 pm

Re: 4G Gps sending sms Error

Post by libelium-dev » Tue Sep 03, 2019 8:04 am

Hi,

Could you please copy the output through the serial monitor for the example codes?

Did you try to get the GPS localization placing the node outside?

Regards

mikismart
Posts: 25
Joined: Thu Jul 11, 2019 8:33 am
Company: Samek Engineering

Re: 4G Gps sending sms Error

Post by mikismart » Wed Sep 04, 2019 10:34 am

[code]#include <WaspGPS.h>
#include <Wasp4G.h>
#include <WaspRTC.h>
#include <WaspSensorGas_Pro.h>

//int answer;
//char text_message[];

char phone_number[] = "xxxxxxxx";
char sms_body[300];
//////////////////////////////////////////////////

uint8_t error;
uint8_t status;
uint8_t index;
uint8_t data_read;

//uint8_t error;
uint8_t gps_status;
float gps_latitude;
float gps_longitude;
uint32_t previous;

Gas gas_PRO_sensorCO(SOCKET_A);
Gas gas_PRO_sensorNO(SOCKET_B);
Gas gas_PRO_sensorCO2(SOCKET_C);
Gas gas_PRO_sensor(SOCKET_E);

float Battery;
//char Time;
float concentrationNO; // Stores the concentration level in ppm
float concentrationCO; // Stores the concentration level in ppm
float concentrationCO2;
float temperature; // Stores the temperature in ºC
float humidity; // Stores the realitve humidity in %RH
float pressure; // Stores the pressure in Pa
char chaconcentrationNO[20]; // Stores the concentration level in ppm
char chaconcentrationCO[20]; // Stores the concentration level in ppm
char chaconcentrationCO2[20];
char chatemperature[20]; // Stores the temperature in ºC
char chahumidity[20]; // Stores the realitve humidity in %RH
char chapressure[20]; // Stores the pressure in Pa
char chaBattery [10];
char chagps_latitude[10];
char chagps_longitude[10];
//char chaTime[20];
//char chaSerial_id[50];
//uint8_t error2;
void setup()
{

USB.ON();
USB.println(F("Start program"));
RTC.ON();
gas_PRO_sensorCO.ON();
gas_PRO_sensorNO.ON();
gas_PRO_sensorCO2.ON();

// check answer
}

void sensor()
{
//////////////////////////////////////////////////
// 1. Switch on the 4G module
//////////////////////////////////////////////////
error = _4G.ON();

// check answer
if (error == 0)
{
USB.println(F("1. 4G module ready..."));
////////////////////////////////////////////////
// 2. Start GPS feature
////////////////////////////////////////////////

// get current time
previous = millis();

// init GPS feature
gps_status = _4G.gpsStart();

// check answer
if (gps_status == 0)
{
USB.print(F("2. GPS started in Autonomous (Standalone) mode. Time(secs) = "));
USB.println((millis()-previous)/1000);
}
else
{
USB.print(F("2. Error calling the 'gpsStart' function. Code: "));
USB.println(gps_status, DEC);
}

}
else
{
// Problem with the communication with the 4G module
USB.println(F("1. 4G module not started"));
USB.print(F("Error code: "));
USB.println(error, DEC);
USB.println(F("The code stops here."));
while (1);
}
if (gps_status == 0)
{
error = _4G.waitForSignal(20000);
if (error == 0)
{
USB.print(F("3. GPS signal received. Time(secs) = "));
USB.println((millis()-previous)/1000);

USB.println(F("Acquired position:"));
USB.println(F("----------------------------"));
USB.print(F("Latitude: "));
USB.print(_4G._latitude);
USB.print(F(","));
USB.println(_4G._latitudeNS);
USB.print(F("Longitude: "));
USB.print(_4G._longitude);
USB.print(F(","));
USB.println(_4G._longitudeEW);
USB.print(F("UTC_time: "));
USB.println(_4G._time);
USB.print(F("date: "));
USB.println(_4G._date);
USB.print(F("Number of satellites: "));
USB.println(_4G._numSatellites, DEC);
USB.print(F("HDOP: "));
USB.println(_4G._hdop);
USB.println(F("----------------------------"));

// get degrees
gps_latitude = _4G.convert2Degrees(_4G._latitude, _4G._latitudeNS);

gps_longitude = _4G.convert2Degrees(_4G._longitude, _4G._longitudeEW);
USB.println("Conversion to degrees:");
USB.print(F("Latitude: "));
USB.println(gps_latitude);
USB.print(F("Longitude: "));
USB.println(gps_longitude);
USB.println();
//USB.print(sms_body);
delay(10000);
// snprintf(sms_body2, sizeof(sms_body2),"Latitude:%8f""Longitude:%8f", gps_latitude, gps_longitude);
//
}
else
{
USB.println("no satellites fixed");
}
}

concentrationCO = gas_PRO_sensorCO.getConc();
concentrationNO = gas_PRO_sensorNO.getConc();
concentrationCO2 =gas_PRO_sensorCO2.getConc();
Battery =PWR.getBatteryLevel();
// Time =RTC.getTime();
// Read enviromental variables
temperature = gas_PRO_sensor.getTemp();
humidity = gas_PRO_sensor.getHumidity();
pressure = gas_PRO_sensor.getPressure();

gps_longitude = _4G.convert2Degrees(_4G._longitude, _4G._longitudeEW);

gps_latitude = _4G.convert2Degrees(_4G._latitude, _4G._latitudeNS);
USB.println(sms_body);
USB.println(F(" *****************************************"));
// Battery =PWR.getBatteryLevel();{

dtostrf( concentrationCO, 1, 2, chaconcentrationCO);
dtostrf( concentrationNO, 1, 2, chaconcentrationNO);
dtostrf( concentrationCO2, 1, 2, chaconcentrationCO2);
dtostrf( temperature, 1, 2, chatemperature);
dtostrf( pressure, 1, 3, chapressure);
dtostrf( humidity, 1, 2, chahumidity);
dtostrf( Battery, 1, 3, chaBattery);
dtostrf(gps_longitude, 1, 10, chagps_longitude);
dtostrf(gps_latitude, 1, 10, chagps_latitude);
// dtostrf( Time, 1, 14, chaTime);
if(Battery<50)
{

snprintf(sms_body, sizeof(sms_body),"Samek Engineering Environmental Monitoring \n""Serial ID:5261BC32C8913E0B#""CO: %s ""ppm""# CO2:%s""ppm""# NO:%s ""ppm""# Temprature:%s ""0c"" # Perssure: %s ""pa #""RH :%s #""BL :%s""Latitude:%s""Longitude:%s",
chaconcentrationCO, chaconcentrationCO2, chaconcentrationNO, chatemperature, chapressure,chahumidity, chaBattery, chagps_latitude, chagps_longitude,"YOUR POWER IS GATTING LOW PLEASE PLUGEIN THE CHARGER \n");
USB.println(sms_body);
}
else {

snprintf(sms_body, sizeof(sms_body),"Samek Engineering Environmental Monitoring \n""Serial ID:5261BC32C8913E0B#""CO: %s ""ppm""#CO2:%s""ppm""# NO:%s ""ppm""# Temprature:%s ""0c"" # Perssure: %s ""pa #""RH :%s #""Latitude:%s#""Longitude:%s ",
chaconcentrationCO,chaconcentrationCO2, chaconcentrationNO, chatemperature, chapressure, chahumidity, chagps_latitude, chagps_longitude);
USB.println(sms_body);
}
delay(1000);
}
void G4()
{
//////////////////////////////////////////////////
// 1. Switch on the 4G module
//////////////////////////////////////////////////

error = _4G.ON();
if (error == 0)
{
USB.println(F("1. 4G module ready..."));
////////////////////////////////////////////////
// 2. Configure SMS options
////////////////////////////////////////////////
error = _4G.configureSMS();
if (error == 0)
{
USB.println(F("2.1. 4G module configured to use SMS"));
}
else
{
USB.print(F("2.1. Error calling 'configureSMS' function. Code: "));
USB.println(error, DEC);
}
////////////////////////////////////////////////
// 3. Send SMS
////////////////////////////////////////////////
USB.print(F("2.2. Sending SMS..."));

sensor();
error = _4G.sendSMS( phone_number, sms_body);

if (error == 0)
{
USB.println(F("done"));
}
else
{
USB.print(F("error. Code: "));
USB.println(error, DEC);

}
}
else
{
// Problem with the communication with the 4G module
USB.print(F("1. 4G module not started. Error code: "));
USB.println(error, DEC);

}
// USB.println(F("3. Switch OFF 4G module"));
_4G.OFF();
//

}
void loop ()
{
G4();
USB.println(F("4. Enter deep sleep..."));
PWR.deepSleep("00:00:00:20", RTC_OFFSET, RTC_ALM1_MODE1, ALL_OFF);
USB.ON();
USB.println(F("5. Wake up!!\n\n"));

} [/code] This is the total coding that integrate all the smart environment pro
and
the its output is like this
[quote] 4G module ready...
2.1. 4G module configured to use SMS
2.2. Sending SMS...1. 4G module ready...
2. GPS started in Autonomous (Standalone) mode. Time(secs) = 1
3. GPS signal received. Time(secs) = 17
Acquired position:
----------------------------
Latitude: 0901.1730,N
Longitude: 03848.8263,E
UTC_time: 075755
date: 040919
Number of satellites: 5
HDOP: 2.2000000476
----------------------------
Conversion to degrees:
Latitude: 9.0195503234
Longitude: 38.8137702941

Serial ID:5261BC32C8913E0B#CO: 13.46 ppm#CO2:0.00ppm# NO:3.13 ppm# Temprature:23.49 0c # Perssure: 76694.406 pa #RH :47.71 #Latitude:#Longitude:0.00000000
*****************************************
Serial ID:5261BC32C8913E0B#CO: 5.83 ppm#CO2:0.00ppm# NO:0.00 ppm# Temprature:23.11 0c # Perssure: 76701.469 pa #RH :47.48 #Latitude:0#Longitude:38.81377000
error. Code: 5
4. Enter deep sleep...
5. Wake up!![/quote]

mikismart
Posts: 25
Joined: Thu Jul 11, 2019 8:33 am
Company: Samek Engineering

Re: 4G Gps sending sms Error

Post by mikismart » Wed Sep 04, 2019 2:55 pm

mikismart wrote:
Wed Sep 04, 2019 10:34 am

Code: Select all

#include <WaspGPS.h>
#include <Wasp4G.h>
#include <WaspRTC.h>
#include <WaspSensorGas_Pro.h>

//int answer;
//char text_message[];

char phone_number[] = "xxxxxxxx";
char sms_body[300];
//////////////////////////////////////////////////

uint8_t error;
uint8_t status;
uint8_t index;
uint8_t data_read;

//uint8_t error;
uint8_t gps_status;
float gps_latitude;
float gps_longitude;
uint32_t previous;

Gas gas_PRO_sensorCO(SOCKET_A);
Gas gas_PRO_sensorNO(SOCKET_B);
Gas gas_PRO_sensorCO2(SOCKET_C);
Gas gas_PRO_sensor(SOCKET_E);

float Battery;
//char Time;
float concentrationNO;  // Stores the concentration level in ppm
float concentrationCO;  // Stores the concentration level in ppm
float concentrationCO2; 
float temperature;  // Stores the temperature in ºC
float humidity;   // Stores the realitve humidity in %RH
float pressure;   // Stores the pressure in Pa
char chaconcentrationNO[20];  // Stores the concentration level in ppm
char chaconcentrationCO[20];  // Stores the concentration level in ppm
char chaconcentrationCO2[20];
char chatemperature[20];  // Stores the temperature in ºC
char chahumidity[20];   // Stores the realitve humidity in %RH
char chapressure[20];   // Stores the pressure in Pa
char chaBattery [10];
char chagps_latitude[10];
char chagps_longitude[10];
//char chaTime[20];
//char chaSerial_id[50];
//uint8_t error2;
void setup()
{
  
  USB.ON();
  USB.println(F("Start program"));
  RTC.ON();
     gas_PRO_sensorCO.ON();
    gas_PRO_sensorNO.ON();
    gas_PRO_sensorCO2.ON();

  // check answer
}

void sensor()
   {
         //////////////////////////////////////////////////
          // 1. Switch on the 4G module
          //////////////////////////////////////////////////
          error = _4G.ON();
        
          // check answer
          if (error == 0)
          {
            USB.println(F("1. 4G module ready..."));
                  ////////////////////////////////////////////////
            // 2. Start GPS feature
            ////////////////////////////////////////////////
           
            // get current time
            previous = millis();
        
            // init GPS feature
            gps_status = _4G.gpsStart();
        
            // check answer
            if (gps_status == 0)
            {
              USB.print(F("2. GPS started in Autonomous (Standalone) mode. Time(secs) = "));
              USB.println((millis()-previous)/1000);
            }
            else
            {
              USB.print(F("2. Error calling the 'gpsStart' function. Code: "));
              USB.println(gps_status, DEC);
            }
        
          }
          else
          {
            // Problem with the communication with the 4G module
            USB.println(F("1. 4G module not started"));
            USB.print(F("Error code: "));
            USB.println(error, DEC);
            USB.println(F("The code stops here."));
            while (1);
          }
           if (gps_status == 0)
          {
            error = _4G.waitForSignal(20000);
            if (error == 0)
            {
              USB.print(F("3. GPS signal received. Time(secs) = "));
              USB.println((millis()-previous)/1000);
              
              USB.println(F("Acquired position:"));      
              USB.println(F("----------------------------"));
              USB.print(F("Latitude: "));
              USB.print(_4G._latitude);
              USB.print(F(","));
              USB.println(_4G._latitudeNS);
              USB.print(F("Longitude: "));
              USB.print(_4G._longitude);
              USB.print(F(","));
              USB.println(_4G._longitudeEW);
              USB.print(F("UTC_time: "));
              USB.println(_4G._time);
              USB.print(F("date: "));
              USB.println(_4G._date);
              USB.print(F("Number of satellites: "));
              USB.println(_4G._numSatellites, DEC);
              USB.print(F("HDOP: "));
              USB.println(_4G._hdop);
              USB.println(F("----------------------------"));
        
              // get degrees
             gps_latitude = _4G.convert2Degrees(_4G._latitude, _4G._latitudeNS);
             
             gps_longitude = _4G.convert2Degrees(_4G._longitude, _4G._longitudeEW);            
              USB.println("Conversion to degrees:");
              USB.print(F("Latitude: "));
              USB.println(gps_latitude);
              USB.print(F("Longitude: "));
              USB.println(gps_longitude);  
              USB.println();
              //USB.print(sms_body);
              delay(10000);
             // snprintf(sms_body2, sizeof(sms_body2),"Latitude:%8f""Longitude:%8f", gps_latitude, gps_longitude);
//              
            }
            else
            {
              USB.println("no satellites fixed");
            }
          }

          concentrationCO = gas_PRO_sensorCO.getConc();
          concentrationNO = gas_PRO_sensorNO.getConc();
          concentrationCO2 =gas_PRO_sensorCO2.getConc();
           Battery =PWR.getBatteryLevel();
          // Time =RTC.getTime();
          // Read enviromental variables
          temperature = gas_PRO_sensor.getTemp();
          humidity = gas_PRO_sensor.getHumidity();
          pressure = gas_PRO_sensor.getPressure();
              
       gps_longitude = _4G.convert2Degrees(_4G._longitude, _4G._longitudeEW);
              
        gps_latitude = _4G.convert2Degrees(_4G._latitude, _4G._latitudeNS);
      USB.println(sms_body);
          USB.println(F(" *****************************************"));
       //  Battery =PWR.getBatteryLevel();{
        
       dtostrf( concentrationCO, 1, 2, chaconcentrationCO);
       dtostrf( concentrationNO, 1, 2, chaconcentrationNO);
       dtostrf( concentrationCO2, 1, 2, chaconcentrationCO2);
       dtostrf( temperature, 1, 2, chatemperature);
        dtostrf( pressure, 1, 3,  chapressure); 
        dtostrf( humidity, 1, 2,  chahumidity); 
         dtostrf( Battery, 1, 3, chaBattery);  
         dtostrf(gps_longitude, 1, 10, chagps_longitude);  
         dtostrf(gps_latitude, 1, 10, chagps_latitude);
         // dtostrf( Time, 1, 14, chaTime);     
          if(Battery<50)
             {
        
             snprintf(sms_body, sizeof(sms_body),"Serial ID:5261BC32C8913E0B#""CO: %s ""ppm""# CO2:%s""ppm""# NO:%s ""ppm""# Temprature:%s ""0c"" # Perssure: %s ""pa #""RH :%s #""BL :%s""Latitude:%s""Longitude:%s", 
             chaconcentrationCO, chaconcentrationCO2, chaconcentrationNO, chatemperature, chapressure,chahumidity, chaBattery, chagps_latitude, chagps_longitude,"YOUR POWER IS GATTING LOW PLEASE PLUGEIN THE CHARGER \n");
             USB.println(sms_body);
             }
          else {
               
             snprintf(sms_body, sizeof(sms_body),"Serial ID:5261BC32C8913E0B#""CO: %s ""ppm""#CO2:%s""ppm""# NO:%s ""ppm""# Temprature:%s ""0c"" # Perssure: %s ""pa #""RH :%s #""Latitude:%s#""Longitude:%s ", 
   chaconcentrationCO,chaconcentrationCO2, chaconcentrationNO, chatemperature, chapressure, chahumidity, chagps_latitude, chagps_longitude);
           USB.println(sms_body);
            }
            delay(1000);
        }
void G4()
            {
               //////////////////////////////////////////////////
            // 1. Switch on the 4G module
            //////////////////////////////////////////////////
            
            error = _4G.ON();
                     if (error == 0)
            {
              USB.println(F("1. 4G module ready..."));
              ////////////////////////////////////////////////
              // 2. Configure SMS options
              ////////////////////////////////////////////////
              error = _4G.configureSMS();          
              if (error == 0)
              {
                USB.println(F("2.1. 4G module configured to use SMS"));    
              }
              else
              {
                USB.print(F("2.1. Error calling 'configureSMS' function. Code: "));
                USB.println(error, DEC);
              }                     
              ////////////////////////////////////////////////
              // 3. Send SMS
              ////////////////////////////////////////////////
              USB.print(F("2.2. Sending SMS..."));
       
              sensor();
          error = _4G.sendSMS( phone_number, sms_body);

                if (error == 0)
              {
                USB.println(F("done")); 
              }
              else
              {
                USB.print(F("error. Code: "));
                USB.println(error, DEC);
               
              }    
            }
            else
            {
              // Problem with the communication with the 4G module
              USB.print(F("1. 4G module not started. Error code: "));
              USB.println(error, DEC);
            
            }
//              USB.println(F("3. Switch OFF 4G module"));
   _4G.OFF();
//           
 
  }
 void loop ()
 {
 G4();
  USB.println(F("4. Enter deep sleep..."));
  PWR.deepSleep("00:00:00:20", RTC_OFFSET, RTC_ALM1_MODE1, ALL_OFF);
  USB.ON();
  USB.println(F("5. Wake up!!\n\n"));
  
  }     
This is the total coding that integrate all the smart environment pro
and
the its output is like this
4G module ready...
2.1. 4G module configured to use SMS
2.2. Sending SMS...1. 4G module ready...
2. GPS started in Autonomous (Standalone) mode. Time(secs) = 1
3. GPS signal received. Time(secs) = 17
Acquired position:
----------------------------
Latitude: 0901.1730,N
Longitude: 03848.8263,E
UTC_time: 075755
date: 040919
Number of satellites: 5
HDOP: 2.2000000476
----------------------------
Conversion to degrees:
Latitude: 9.0195503234
Longitude: 38.8137702941

Serial ID:5261BC32C8913E0B#CO: 13.46 ppm#CO2:0.00ppm# NO:3.13 ppm# Temprature:23.49 0c # Perssure: 76694.406 pa #RH :47.71 #Latitude:#Longitude:0.00000000
*****************************************
Serial ID:5261BC32C8913E0B#CO: 5.83 ppm#CO2:0.00ppm# NO:0.00 ppm# Temprature:23.11 0c # Perssure: 76701.469 pa #RH :47.48 #Latitude:0#Longitude:38.81377000
error. Code: 5
4. Enter deep sleep...
5. Wake up!!

libelium-dev
Posts: 27967
Joined: Mon Sep 28, 2009 1:06 pm

Re: 4G Gps sending sms Error

Post by libelium-dev » Thu Sep 05, 2019 8:59 am

Hi,

Please test the example codes to get gps position and send sms individually and copy here the output through the serial monitor. Meanwhile we are going to debug your code.

Regards

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest