Problem in sending and receiving SMS with 4G module

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

Problem in sending and receiving SMS with 4G module

Post by mikismart » Thu Jul 11, 2019 9:46 am

hi
I was trying to programme a Smart Environment Pro from waspmote Ide ...
The device use the 4G module to and it sends sms using the code from PCS but we can't send the sms from our code
it dispalys Error code: 6
the code we have been used is ..

Code: Select all

#include <Wasp4G.h>

//////////////////////////////////////////////////
char phone_number[] = "xxxxxxxx";
char sms_body[] = "Hello from Waspmote!!!";
//////////////////////////////////////////////////
uint8_t error;


void setup()
{
  USB.ON();
  USB.println(F("Start program"));
}


void loop()
{
  //////////////////////////////////////////////////
  // 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..."));
    //error = _4G.sendSMS(phone_number,sms_body);
    error = _4G.sendSMS(phone_number,"hey");

    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);
  }


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


  ////////////////////////////////////////////////
  // 4. Sleep
  ////////////////////////////////////////////////
  USB.println(F("4. Enter deep sleep..."));
  PWR.deepSleep("00:00:10:00", RTC_OFFSET, RTC_ALM1_MODE1, ALL_OFF);

  USB.ON();
  USB.println(F("5. Wake up!!\n\n"));

}
so could help us to solve our issue

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

Re: Problem in sending and receiving SMS with 4G module

Post by mikismart » Thu Jul 11, 2019 10:17 am

am waiting for your response please be quick

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

Re: Problem in sending and receiving SMS with 4G module

Post by libelium-dev » Fri Jul 12, 2019 7:38 am

Hi,

Please share with us the output of the code to see in which function you get the error.

Error 6 in sendingSMS function means error sending the body.

Please test you're able to send SMS with the SIM you're using with a mobile phone.

Regards.

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

Re: Problem in sending and receiving SMS with 4G module

Post by mikismart » Fri Jul 12, 2019 11:00 am

this the revised code that i used from the previous but the problem still the same and exist

Code: Select all

/*
    ------ Waspmote Pro Code Example --------

    Explanation: This is the basic Code for Waspmote Pro

    Copyright (C) 2016 Libelium Comunicaciones Distribuidas S.L.
    http://www.libelium.com

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
#include <Wasp4G.h>

// Put your libraries here (#include ...)
char phone_number[] = "0918444716";
char sms_body[] = "Hello from Waspmote!!!";
//////////////////////////////////////////////////

uint8_t error;

char apn[] = "etc";
char login[] = "etc";
char password[] = "etc";
void setup()
{
  // put your setup code here, to run once:
USB.ON();
  USB.println("Start program");
}


void loop()
{
  // put your main code here, to run repeatedly:
//////////////////////////////////////////////////
  // 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..."));
    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);
  }


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


  ////////////////////////////////////////////////
  // 4. Sleep
  ////////////////////////////////////////////////
  USB.println(F("4. Enter deep sleep..."));
  PWR.deepSleep("00:00:10:00", RTC_OFFSET, RTC_ALM1_MODE1, ALL_OFF);

  USB.ON();
  USB.println(F("5. Wake up!!\n\n"));

}

and the output for the code is

Start program
1. 4G module ready...
2.1. 4G module configured to use SMS
2.2. Sending SMS...error. Code: 6
3. Switch OFF 4G module
4. Enter deep sleep.

your possible solution would be appreciable
Regards

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

Re: Problem in sending and receiving SMS with 4G module

Post by libelium-dev » Mon Jul 15, 2019 10:16 am

Hi,

Are you able to send an SMS inserting the sim card in a phone?

Could you please check if the node connects to the network using the following example code?
http://www.libelium.com/development/was ... -http-get/

Regards

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

Re: Problem in sending and receiving SMS with 4G module

Post by mikismart » Mon Jul 15, 2019 11:03 am

Hi
tnx for your response in advance.
SMS sending works fine but when i check the code you asked me to check it shows me output like this
Start program
********************************************************************
GET method to the Libelium's test url
You can use this php to test the HTTP connection of the module.
The php returns the parameters that the user sends with the URL.
********************************************************************
*****************************
APN: etc
LOGIN: etc
PASSWORD: etc
*****************************
1. 4G module ready...
2. Getting URL with GET method...Failed. Error code: 15
3. Switch OFF 4G module
4. Enter deep sleep...
5. Wake up!!


1. 4G module ready...
2. Getting URL with GET method...Done. HTTP code: 200
Server response: method::get;varA::1;varB::2;varC::3;varD::4;varE::5;varF::6;varG::7;varH::8;varI::9;varJ::10;varK::11;varL::12;varM::13;varN::14;varO::15;

3. Switch OFF 4G module
4. Enter deep sleep...
5. Wake up!!


1. 4G module ready...
2. Getting URL with GET method...Done. HTTP code: 200
Server response: method::get;varA::1;varB::2;varC::3;varD::4;varE::5;varF::6;varG::7;varH::8;varI::9;varJ::10;varK::11;varL::12;varM::13;varN::14;varO::15;

3. Switch OFF 4G module
4. Enter deep sleep...
5. Wake up!!
why is it return failure on the first loop??

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

Re: Problem in sending and receiving SMS with 4G module

Post by libelium-dev » Tue Jul 16, 2019 8:13 am

Hi,

Did you solve the problem of sending SMS?

Error code 15 means error activating GPRS connection, so it could be a coverage issue.

Regards

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest