SMS Not Completely Received ( AdaFruit Feather Fona)


#1

Hello,

I use Adafruit Feather Fona and HologramSIMCOM Library
Everything works nice except SMS reception
I try do send an SMS to my Device thru Dashboard
But I never received it completely.
For Example :

DEBUG: Write Modem Serial = AT+CMGR=1

DEBUG: Modem Serial Buffer = AT+CMGR=1

DEBUG: Modem Serial Buffer = +CMGR: “REC UNREAD”,"+447937405250","","17/10/03,08:10:57+04"
DEBUG: Write Modem Serial = AT+CMGD=1,4

DEBUG: Modem Serial Buffer = KAT+CMGD=1,4

DEBUG: Message Buffer = 1

DEBUG: Modem Serial Buffer = OK
DEBUG: Message Buffer = 1

DEBUG: Modem Serial Buffer = OK
DEBUG: Message Buffer = 1

Incoming Message: 1

But I’ve Send a very complicate message : 123

in my loop I use:
> if(Hologram.availableMessage() > 0) {

    // readMessage() returns both incoming TCP data or incoming SMS messages
    // once you read a message the buffer is wiped, if called again nothing will be there
    Serial.print("Incoming Message: ");
    Serial.println(Hologram.readMessage());
  }

Do you have an Idea ?

Thank you


#2

Hello

Nobody idea ?

Thank you


#3

That seems odd, can you post your full sketch?


#4

Hello
please below my code, I’ve just replace my HOLO_KEY by *

Thank you

#include <LMI.h>
#include <HologramSIMCOM.h>

//#define SIMULATE // Don't Send Message over GPRS but print it on Serial useful for debug
#define HOLO_KEY "******" //replace w/your SIM key
#define FONA_RX  9
#define FONA_TX  8
#define FONA_RST 4
#define MESSAGE_TIMER  (unsigned long)300000 // wait 5 minutes
#define THRESHOLD_DETECTION 50 // System will send a message if measure pressure is higer or lower than +/- 50Pa
#define SENSOR_REFRESH  (1* 1000) // wait 5s

LMI Sensor;
unsigned long nextMessage = 0x00;
unsigned long nextRefresh = 0x00;

void SendMessage(String sToSend);

HologramSIMCOM Hologram(FONA_TX, FONA_RX, FONA_RST, HOLO_KEY);
void setup() {

  Sensor.begin(0x5F);
  Serial.println();

  // Start modem and connect to Hologram's global network
  Hologram.debug();
  bool cellConnected = Hologram.begin(19200, 8888); // set baud to 19200 and start server on port 8888
  if(cellConnected) {
      Serial.println(F("Cellular is connected"));
  } else {
      Serial.println(F("Cellular connection failed"));
  }
  Serial.println(F("Setup complete"));
}

void loop() {

   String LMIInfo = "P," + Sensor.GetPartNumber() + ";" + Sensor.GetFWVersion()+";" + Sensor.GetLotNumber()+";" + Sensor.GetPressureRange()+";" + Sensor.GetOutputType()+";" + Sensor.GetScaleFactor();
   float SensorValue = 0.0;

   SensorValue = Sensor.GetPressure();
   nextRefresh =  millis() + SENSOR_REFRESH;
 
   if(Hologram.cellService())
   {
     SendMessage(LMIInfo);
     LMIInfo = "V,";
     LMIInfo += String(SensorValue);
     SendMessage(LMIInfo);
     nextMessage = (unsigned long)millis() + MESSAGE_TIMER;
   }

   while(1){
      if(Hologram.availableMessage() > 0) {
        // readMessage() returns both incoming TCP data or incoming SMS messages
        // once you read a message the buffer is wiped, if called again nothing will be there
        Serial.print("Incoming Message: ");
        Serial.println(Hologram.readMessage());
      }
      // timeout send new value
      if ( millis() > nextMessage){
           LMIInfo = "V,";
           LMIInfo += String(SensorValue);
           SendMessage(LMIInfo);
           nextMessage = (unsigned long)millis() + MESSAGE_TIMER;
      }
      if( millis() > nextRefresh ){

        SensorValue = Sensor.GetPressure();
        // Send Alarm
        if(SensorValue < -THRESHOLD_DETECTION || SensorValue > THRESHOLD_DETECTION){
           LMIInfo = "A,";
           LMIInfo += String(SensorValue);
           SendMessage(LMIInfo);
        }
        nextRefresh =  millis() + SENSOR_REFRESH;
      }
   }

}

void SendMessage(String sToSend){
  sToSend = Sensor.GetSerialNumber() + ","+ sToSend;
  #ifndef SIMULATE
   Hologram.send(sToSend);
  #else
    Serial.println(sToSend);
  #endif
}