I´m using CR1000 and CS-GPRS with COM-110 modem.
When sensor values exceed critical thresholds I´d like to send a warning via SMS and email, but I couldn´t manage to send both.
Sending Alarm-SMS works fine, also Alarm-email, but i failed to implement both like in the test-program below:
Public Batt, RefTemp, Temp
Const CRLF = CHR(13)+CHR(10)
Const SMSPhone = """XXXXXXXXXXXXXXXXXXXXXX"""
Const Subject="Email Message Test"
Public AlarmTrigger As Boolean
Public Result As String * 50
Public Message As String * 250
Public EmailSuccess As Boolean
Message = "Warning!" + CRLF + CRLF
Message = Message + "This is a automatic email message from the datalogger station " + Status.StationName + ". "
Message = Message + "An alarm condition has been identified. "
Message = Message + "The temperature is " + Temp + " degrees C." + CRLF + CRLF + CRLF
Message = Message + "Datalogger time is " + Status.Timestamp
SMSResult1=SerialOut (SMSPORT,"AT+CMGS="+SMSPhone+CR,"> ",5,100)
If SMSResult1<>0 Then
SerialOut (SMSPORT,"3018, km15,25, MURE Station01 - Datalogger time: " + Status.Timestamp + CRLF,"",1,10)
TCDiff (Temp,1,mV2_5C,1,TypeT,RefTemp,True ,0,250,1.0,0)
If AlarmTrigger = False Then
If Temp > 30 Then AlarmTrigger = True
If AlarmTrigger Then
'In Case of Alarm first send SMS
'then send email
If Temp < 30 then AlarmTrigger=False
I have not carefully analyzed your program and do not know if this is the issue. But quickly I can tell you that in order to send SMS, you must throw down the GPRS connection.
hello and thx for the fast reply!
can this possibly done by software and if so - how?
or do I have to switch off the SW12, power the modem down an wait until it has reinitiated?
I would prefer the first option, because as the near-real-time-sending of the alarm is of importance this would be a loss of valuable time, which i want to avoid.
in your program you can use the "TCPOpen/TCPClose" command, at regular intervals or in on the occasion of the need to send SMS alerts (consider a delay). You should, however, create the time period for the data connection in GSM-CSD, in case of problems with the GPRS. Even GSM calls, such as SMS, are not going to succeed if the GPRS connection is active.
* Last updated by: smile on 7/18/2014 @ 4:31 AM *
so in case sending the Alarm-email has higher priority than the Alarm-SMS i can trigger the email-sending first, then throw down connection by using TCPClose, re-initiate connection with TCPOpen and finally send the SMS, is that the appropriate way?
Should a Delay be inserted before sending the SMS, and if so - how long?
I edit what you've written.
so in case sending the Alarm-email has higher priority than the Alarm-SMS i can trigger the email-sending first, then throw down connection by using TCPClose, send the SMS, then wait for confirmation of sending SMS correctly and finally re-initiate connection with TCPOpen.
Very probably that is the appropriate way.
I think that is enough to send SMS in the next scan, after that the GPRS connection is was closed.
Remember to enable the sending of SMS in the modem setup, with the command "AT + CMGF = 1". In text mode, to me it seemed so much easier.
Thank you for the reply - I´ll give it a try!
Also be aware that mobile carriers usually have an email account associated with a mobile number. For example, AT&T subscribers can be sent a text to their phone by sending an email to
(10 digit phone number)@txt.att.net
There is a list available online that describes all of the carriers and the email to text format.
I have found this to be a much better solution for me as email seems to work without much fuss.
The list is here