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.

gsm alert


fdec Nov 23, 2012 03:19 PM

dear all

i already use a campbell scientific gprs modem for collect all my data on my cr3000 stations

as i can't look every day if the data are correct or not, i want the station send me a sms when the battery are low (under 12V)

please find below the program that i use for test.
at this time the station don't send me a sms but i can connect at my station by gprs.

can you help me for find the problem.?

please note i communicate by gprs in 115200baud.

while waiting to read you
sincerly
françois

Public PTemp, TC_temp,batt_volt,SMSResult
Public SMSSent As Boolean


'Variable de travail
Dim I, temparray(10)
Dim datastring As String *160

'Declaration de constantes

'Numero de telephone auquel on enverrra le SMS

Const SMSPhone="""+33676723537"""

'Port de connection GSM: Port CS I/O
Const SMSPORT=ComME

'Declaration Caractere ASCII
Const CR=CHR(13) 'CR (retour la ligne)
Const LF=CHR(10) 'LF (Saut de ligne)
Const CRLF=CR+LF

'Define Data Tables
DataTable (Testtab,true,-1)
DataInterval (0,10,Min,10)
Minimum (1,batt_volt,FP2,0,False)
Average (1,TC_temp,FP2,False)
Average (1,PTemp,FP2,False)
EndTable

'Define Subroutines

Sub SMSAlarm


'Nous devons ouvrir le port ou est branche le module GSM, fixer le baud rate a 9600
'et laisser un délai de 10 msec avant l envoi de la chaîne au modem

SerialOpen (SMSPORT,115200,3,10000,100)

'Envoyer la commande qui gere l envoi des SMS dans le modem
'et attendre une seconde la reponse

SMSResult=SerialOut(SMSPORT,"AT+CMGS="+SMSPhone+CR,">",1,100)
'Si la reponse est correcte (suprieur 0), le message est envoye

If SMSResult<>0 Then

SerialOut (SMSPORT, "Alerte SMS. La centrale d'acquisition Campbell Scientific CR3000 Vous informe que la batterie est de: "+FormatFloat(batt_volt,"%3.2f")+"C"+CRLF,"",1,10)

SMSResult=SerialOut(SMSPORT,CHR(26),CHR(26)+"+CMGS:",1,10000)

SMSSent=SMSResult<>0

EndIf

SerialClose(SMSPORT)

EndSub


'Main Program
BeginProg

SMSSent=True

Scan (1,Sec,0,0)
Battery (Batt_volt)
PanelTemp (PTemp,250)
TCDiff (TC_temp, 1,mV1000C,1,TypeT,PTemp,True,0,250,1.0,0)

'on appelle la table de donne
CallTable Testtab


NextScan

'Lamessagerie de SMS est appele dans une squence lente donc elle aura une priorit
'faible pour ne pas interfrer avec le scan principal qui s occupe des mesure de temperature.


SlowSequence

'Scan effectue toutes les dix secondes
Scan(1,Min,0,0)



If (SMSSent=False) AND (batt_volt > 11) Then

Call SMSAlarm

ElseIf batt_volt<11.7 Then SMSSent=false



NextScan


EndProg


Grant Nov 25, 2012 11:11 PM

Try this, it works on our modems (slightly modified for your variable names).

Sub SMSAlarm
SMS_Msg="Alerte SMS. La centrale d'acquisition Campbell Scientific CR3000 Vous informe que la batterie est de: "+FormatFloat(batt_volt,"%3.2f")+"C"
SerialOpen (SMSPORT,115200,3,100,10000)
SerialOut (SMSPORT,"AT+CMGS=" + CHR(34) + SMSPhone + CHR(34) + CHR(13),">",0,100)
SerialOut (SMSPORT,SMS_Msg,"",0,100)
SerialOut (SMSPORT,CHR(26),"+CMGS:",1,100)
SerialFlush (SMSPORT)
SerialClose (SMSPORT)
EndSub

Your code had multiple """ for the phone number and big delay times for the serial open and out commands, not sure if that was the problem.

Give it a try and see

Cheers

Grant


fdec Nov 26, 2012 08:05 AM

Dear Grant
thank you for your answer, i have replace in my program my subroutine by yours
but at this time i haven't receive a sms and my battery are under 12V

please find below my program if you have an idea of the error.

while waiting to read you

sincerly


'CR1000 Series Datalogger

Public PTemp, TC_temp,batt_volt,SMSResult
Public SMSSent As Boolean
Public SMS_Msg

'Variable de travail
Dim I, temparray(10)
Dim datastring As String *160

'Declaration de constantes

'Numero de telephone auquel on enverrra le SMS

Const SMSPhone="""+33676723537"""

'Port de connection GSM: Port CS I/O
Const SMSPORT=ComME

'Declaration Caractere ASCII
Const CR=CHR(13) 'CR (retour la ligne)
Const LF=CHR(10) 'LF (Saut de ligne)
Const CRLF=CR+LF

'Define Data Tables
DataTable (Testtab,true,-1)
DataInterval (0,10,Min,10)
Minimum (1,batt_volt,FP2,0,False)
Average (1,TC_temp,FP2,False)
Average (1,PTemp,FP2,False)
EndTable

'Define Subroutines

Sub SMSAlarm
SMS_Msg="Alerte SMS. La centrale d'acquisition Campbell Scientific CR3000 Vous informe que la batterie est de: "+FormatFloat(batt_volt,"%3.2f")+"C"
SerialOpen (SMSPORT,115200,3,100,10000)
SerialOut (SMSPORT,"AT+CMGS=" + CHR(34) + SMSPhone + CHR(34) + CHR(13),">",0,100)
SerialOut (SMSPORT,SMS_Msg,"",0,100)
SerialOut (SMSPORT,CHR(26),"+CMGS:",1,100)
SerialFlush (SMSPORT)
SerialClose (SMSPORT)
EndSub


'Main Program
BeginProg

SMSSent=True

Scan (1,Sec,0,0)
Battery (Batt_volt)
PanelTemp (PTemp,250)
TCDiff (TC_temp, 1,mV1000C,1,TypeT,PTemp,True,0,250,1.0,0)

'on appelle la table de donne
CallTable Testtab


NextScan

'Lamessagerie de SMS est appele dans une squence lente donc elle aura une priorite
'faible pour ne pas interfrer avec le scan principal qui s occupe des mesure de batterie.


SlowSequence

'Scan effectue toutes les dix secondes
Scan(1,Min,0,0)


If (SMSSent=False) AND (batt_volt > 11) Then

Call SMSAlarm

ElseIf batt_volt<11.7 Then SMSSent=false



NextScan


EndProg


Grant Nov 26, 2012 09:27 PM

A few problems have popped up.

First, your SMS_Msg has to be declared as a string, the 132 is for how long your message is.
Public SMS_Msg as string *132

Second, you have to remove the excess "" around the phone number.
'Numero de telephone auquel on enverrra le SMS
Const SMSPhone="+33676723537"

There is also nothing in your code to return your boolean value of SMSSent back to true if the battery voltage is good. What will happen with your code is that once the battery voltage gets below 11.7 it will keep sending messages for ever. I always have a bit of space between the low value to trigger and the high value to switch off to stop problems when the voltage is fluctuating around that point. Try this code below

SlowSequence
'Scan effectue toutes les dix secondes
Scan(1,Min,0,0)

If batt_volt<11.7 AND SMSSent=true Then
Call SMSAlarm
SMSSent=false
ElseIf batt_volt>11.9 Then SMSSent=true

NextScan


fdec Nov 27, 2012 11:01 AM

dear Grant, this night we have receive an sms of this station. whith the information
but we were not connected with the station. do you try the program and call my number?
the income phone number begin by +614078*****?

i try in my side and be back if thats work or not!

while waiting to read you
regards


Grant Nov 27, 2012 08:37 PM

Fdec

Yes, that was me. +61 = Australia

Hope it works for you.

Cheers

Grant


fdec Nov 28, 2012 10:21 AM

dear grant i'm happy that the try are convert

but in my side, i haven't convert, i haven't receive an sms.
it's a mistery.

do you think it's possible for you to send me the program that you used for your try.

i think i not understand something.

on this forum if you wan or my mail address are : fdeclercq@gensun.fr

thank you very much


aps Nov 28, 2012 10:39 AM

What interface are you using between the logger and modem?


Grant Nov 28, 2012 10:46 PM

Public PTemp, TC_temp,batt_volt,SMSResult
Public SMSSent As Boolean
Public SMS_Msg as string *132
Public Send_Now As Boolean

'Variable de travail
Dim I, temparray(10)
Dim datastring As String *160

'Declaration de constantes

'Numero de telephone auquel on enverrra le SMS
Const SMSPhone="+33676723537"

'Port de connection GSM: Port CS I/O
Const SMSPORT=2

'Declaration Caractere ASCII
Const CR=CHR(13) 'CR (retour la ligne)
Const LF=CHR(10) 'LF (Saut de ligne)
Const CRLF=CR+LF

'Define Data Tables
DataTable (Testtab,true,-1)
DataInterval (0,10,Min,10)
Minimum (1,batt_volt,FP2,0,False)
Average (1,TC_temp,FP2,False)
Average (1,PTemp,FP2,False)
EndTable

'Define Subroutines

Sub SMSAlarm
SMS_Msg="Alerte SMS. La centrale d'acquisition Campbell Scientific CR3000 Vous informe que la batterie est de: "+FormatFloat(batt_volt,"%3.2f")+"C"
SerialOpen (SMSPORT,115200,3,100,10000)
SerialOut (SMSPORT,"AT+CMGS=" + CHR(34) + SMSPhone + CHR(34) + CHR(13),">",0,100)
SerialOut (SMSPORT,SMS_Msg,"",0,100)
SerialOut (SMSPORT,CHR(26),"+CMGS:",1,100)
SerialFlush (SMSPORT)
SerialClose (SMSPORT)
EndSub

'Main Program
BeginProg

SMSSent=True

Scan (1,Sec,0,0)
Battery (batt_volt)
PanelTemp (PTemp,250)
TCDiff (TC_temp, 1,mv5000,1,TypeT,PTemp,True,0,250,1.0,0)

'on appelle la table de donne
CallTable Testtab


NextScan

'Lamessagerie de SMS est appele dans une squence lente donc elle aura une priorite 'faible pour ne pas interfrer avec le scan principal qui s occupe des mesure de batterie.
SlowSequence
'Scan effectue toutes les dix secondes
Scan(1,Min,0,0)

If (SMSSent=False) AND (batt_volt > 11) Then
Call SMSAlarm
ElseIf batt_volt<11.7 Then SMSSent=false

If (SMSSent=False) AND Send_Now=true Then
Call SMSAlarm
ElseIf batt_volt<11.7 Then SMSSent=false

NextScan

EndProg

As Andrew asks, if you are using the CSIO port, you need to use a peripheral between it and the modem to ensure correct connection.

It is easier to use a null modem lead between the RS232 port and modem (change the SMSPort in your program) to test


aps Nov 29, 2012 04:49 AM

My question re the interface was because I saw that COMMe was specified as the com port running at 115kbaud. There are some ComME devices that do not work reliably at that speed, including the CS-WMI interface that is sold in Europe for GSM communications.

It is a transparent interface but timing limitations and filters limit the upper speed. You can push the baud rate up from the default of 9600 baud but 38400 is the max for reliable data transfer.

Some older devices such as the SC32B have similar limits.


Grant Nov 29, 2012 04:59 AM

Andrew

I noticed he was using ComME also, but assumed that as he can connect to the station at 115200, correct datalogger to modem connections are in place.

Quote
.............but i can connect at my station by gprs.

can you help me for find the problem.?

please note i communicate by gprs in 115200baud.

Cheers

Grant


aps Nov 29, 2012 09:20 AM

Yes that is true, but the baud rate is normally set in the modem. If he bought the package from CS in Europe with a ComME interface, the baud rate of the modem would have been set to 9600 baud, as the package is normally shipped for GSM use (where the over-air speed is 9600 baud).

GPRS would work as that is set in another setting in the logger, but forcing a connection at 115200 using SerialOpen would not work as the modem won't respond.


fdec Nov 30, 2012 07:30 AM

Dear all

thank you for all your answer

first, we have bought the package in europe, this modem are the new gsm and gprs modem campbell scientific COM110

second, i can connect my station by this modem in gprs at 115200 baud and that work very well. for this i use the csio interface like it's explain in the cs manual.

between the cr3000 and the COM110 modem, a SC105 are already used. there are also in 115200.

when i program the cr3000 with device utility, i have noticed in the part PPP, that the connection is in the sdc7

do you think it's a difference?

I can connect my station in 9600 baud. it's not a problem.

so if i have understand, i must be put the CR3000, SC105 and modem in 9600 baud?

it's correct?

while waiting to read you

sincerly


aps Nov 30, 2012 07:46 AM

Ahh, if you are using an SC105 set in SDC7 mode, you need to use the ComSDC7 com port in the serial open instruction. You can leave the baud rate at 115200. (The actual baud rate between the SC105 and the modem is set in the SC105 and would have been preconfigured at 115200 baud.)


fdec Dec 10, 2012 02:47 PM

dear all
that's work very well
thank you
have a nice day


Otemohu Jan 4, 2013 02:50 PM

Dear François,

I checked your program. We use exactly the same command lines with a CR1000 that checks DC current on our remote site. The only difference is on the baud rate: I putted 9600 bauds on my program (as aps said just above).

Cheers,
Daniel


fdec Jan 8, 2013 01:37 PM

dear all,
with my cr3000, that's work perfectly
do you find a solution ?
as otemohu said for a cr1000, put a 9600 baud rate that will be work
while waiting to read you

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