Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

Reliable SMS alarm


schiller Mar 10, 2015 09:15 AM

Hello,

I´m using CR1000 with COM110 Modem to monitor natural hazards.
In case of detecting a critical situation (one or more sensors detecting values above threshold) I send an alarm-SMS to multiple phone numbers.
When alarm status changes i want to send another alarm-SMS (mainly alarming and de-alarming).

I think I´ve got a little timing problem.
When an alarm-condition is detected, the triggering of the SMS works fine, but if the alarm-condition changes too fast the following SMS isn´t sent.

Questions:
1. How can i solve the problem with dealing with fast changing alarm conditions and the alarm-SMS sent reliably. (typically thresholds are exceeded just a few seconds)

2. Is it the appropriate way of sending SMS-messages to multiple phone numbers by simply repeating the SMS-procedure as i do in my program snippet below?

3. If sending SMS to more than 2 phone numbers will this take too much time, causing further timing problems?

4. Is there a elegant way of resending SMS if it isn´t sent correctly (eg. due to carriage problems), as the reliability of the alarm is the key feature?


'---------------------------------------------------------------

'...

Select Case AlarmType
Case AlarmSensor1 = True AND AlarmSensor2 = True
AlarmCase = 0
AlarmText = "ALARM 1"

Case AlarmSensor1 = False AND AlarmSensor2 = True
AlarmCase = 1
AlarmText = "ALARM 2"

Case AlarmSensor1 = True AND AlarmSensor2 = False
AlarmCase = 2
AlarmText = "ALARM 3"

Case AlarmSensor1 = False AND AlarmSensor2 = False
AlarmCase = 3
AlarmText = "NO ALARM"

Case Else
AlarmText = "ERROR "
EndSelect


'.......


Sub AlarmSMS

SMSSent=False
SMSSent2=False
SMSMessage = ""
SMSMessage = SMSMessage + AlarmText + " - "
SMSMessage = SMSMessage + "Datalogger time: " + "" + Status.Timestamp

SerialOpen (SMSPORT,115200,3,10000,100)
SMSresult=SerialOut (SMSPORT,"AT+CMGS="+SMSPhone+CR,"> ",1,100)
If SMSresult<>0 Then
SerialOut (SMSPORT,SMSMessage,"",1,10)
SMSresult=SerialOut (SMSPORT,CHR(26),"CMGS:",1,1000)
SMSSent=SMSresult<>0
EndIf

Delay(1,1,Sec)

' Alarm-SMS 2nd phone-number

SMSresult2=SerialOut (SMSPORT,"AT+CMGS="+SMSPhone2+CR,"> ",1,100)
If SMSresult2<>0 Then
SerialOut (SMSPORT,SMSMessage,"",1,10)
SMSresult2=SerialOut (SMSPORT,CHR(26),"CMGS:",1,1000)
SMSSent2=SMSresult2<>0
EndIf

EndSub


'......

'main program

'......

'---------------------------------------------------------------
SlowSequence
Scan (1,Sec,1,0)

'ALARM-Send
If AlarmTrigger1 = False Then
If AlarmCase <> ACS Then
AlarmTrigger1 = True
If AlarmTrigger1 = True Then
Call AlarmSMS
ACS = AlarmCase
EndIf
EndIf
If AlarmCase = ACS Then
AlarmTrigger1=False
EndIf
EndIf


NextScan
EndProg

Log in or register to post/reply in the forum.