Our full technical support staff does not monitor this forum.
Please submit your question from our support page if you don't find an answer here.
Next Page

1 2

Previous Page

Created on: 01/19/11 03:29 AM

CR1000 data sending over GPRS

Replies: 15

macarli


Posts: 6
Joined: 01/19/11

CR1000 data sending over GPRS
01/19/11 3:29 AM

Hi all,

We have CR1000 base remote station(with telit EZ-10 GPRS Modem) which communicates to central PC over GPRS Modem. We want this station to send necessary data every hour to the central PC, whose IP and port numbers are known, over GPRS. We do not want Loggernet to take these data. Our own software/FTP server will listen this port and when data come, it will write these data to the database. Moreover we want time synchronization from the NTP server over this central PC.
How can we do these? what procedure do we have to follow?

Thanks for your help

Macar

[Report Inappropriate or Erroneous Content]

Sam

United States


Campbell Scientific Inc. Employee Campbell Scientific Inc.

Solution: Flood Warning (ALERT)

Posts: 366
Joined: 04/02/09

RE: CR1000 data sending over GPRS
01/19/11 11:45 AM

Macar,

We have customers do this regularly. They generally take one of the following approaches. Any particular reason you're deciding not use LoggerNet? LoggerNet does support "callback" from loggers and would be very easy to implement in the logger coding wise.

1) Write data using TableFile instruction, then FTP the file to their server

3) Write data using TableFile instruction, then Email the file to their server. Very similar process as (1)

5) Use GetRecord, TCPOpen, and SerialOut to extract data table records and push them out an IP socket.

-----------------------------------------------------
An example of (1) can be found in this thread

http://www.campbellsci.com/forum/messages.cfm?threadid=5FF6008B-013F-673B-CF27BDC1BBC4FFB0

-----------------------------------------------------
Following is an example of (3)

' Operational Notes:
' * Record sending is based on record number and not timestamps
PreserveVariables
Public PTemp, batt_volt
'Network Settings and Variables
Public DataServ As String * 15 = "192.168.13.10" 'address of server listening for data
Public DataServPort As Long = 6000 'port on server listening for data
Public DataServSock 'will hold socket assignment on logger
Public DataHold As Boolean = FALSE 'flag for pausing data sending
Dim DataRecover As Boolean 'flag for data recovery mode
Public Rec As Long 'last record number in data table
Public LRecSent As Long = -1 'last record we tried to send
Public RecBack As Long 'number of records still need to send
Const GRDataMaxLen = 127 'max length of GRData string
Public GRData As String * GRDataMaxLen 'string for holding record data

Public NTPServ As String * 31 = "192.168.13.10" 'address of NTP server
Public GMTOffset = -6 'hours
Public NTPErr 'milliseconds
Public SyncTime As Boolean = FALSE 'flag for forcing network time syncing

DataTable (Min15,1,-1)
DataInterval (0,15,Min,10)
Sample (1,batt_volt,FP2)
Sample (1,PTemp,FP2)
EndTable

DataTable (ComsLog,1,100)
Sample (1,DataServSock,FP2)
Sample (1,Rec,FP2)
Sample (1,LRecSent,FP2)
Sample (1,RecBack,FP2)
Sample (1,GRData,String)
EndTable

BeginProg
Scan (15,Min,0,0)
PanelTemp (PTemp,250)
Battery (batt_volt)
CallTable Min15
NextScan

SlowSequence
Do While TRUE 'inifinite loop
'Get number of last record in table
'Determine how far back need to go to catch up
'Rec = Min15.Record 'get number of last record in table
If Rec < LRecSent Then LRecSent = -1 'What if LRecSent is preserved but datatable has been reset? Reset LRecSent.
RecBack = Rec - LRecSent 'determine how much need to catch up
If NOT DataHold Then 'not holding sending of data
If RecBack > 0 Then 'If recback is greater than zero then we have records to send
If DataServSock >= 100 Then 'successfully opened socket to server
LRecSent = Rec - RecBack + 1 'calc new last record number sent
GetRecord (GRData,Min15,RecBack) 'extract data from data table
'Form string for sending: "YYYY-MM-DD HH:MM:SS", RECNUM, DATA, DATA, DATA
' "2010-05-24 17:09:30",70,13.33,23.64
GRData = Left (GRData,InStr (2,GRData,"""",2)) & "," & LRecSent & Mid (GRData,InStr (2,GRData,"""",2) + 1,1000) & CHR(13)
SerialOut (DataServSock,GRData,"",0,0) 'send data out over socket
CallTable (ComsLog)
EndIf 'socket
EndIf 'recback
DataServSock = TCPOpen (DataServ,DataServPort, GRDataMaxLen * 100) 'attempt to create link with data server
EndIf 'datahold
Loop
EndSequence

SlowSequence
Scan (5,Sec,3,0)
If TimeIntoInterval (0,24,Hr) OR SyncTime Then
SyncTime = FALSE
'Network Time Sync'ing
NTPErr = NetworkTimeProtocol (NTPServ,GMTOffset * 3600,1000)
EndIf
NextScan
EndSequence
EndProg

Sam Utley
Communication Products Manager

[Report Inappropriate or Erroneous Content]

macarli


Posts: 6
Joined: 01/19/11

RE: CR1000 data sending over GPRS
01/20/11 6:08 AM

Hi Sami


Thanks for your detailed answer.

The reason why we do not use loggernet is; in the second part of our project we want to monitor wind speed and direction data of the remote stations(approximately 10 station) almost online(1 data from all stations for every 15 seconds). By using loggernet for one station, this can be done for 1 data in 1 minute. Moreover when the remote station numbers increase this time will increase.

So we planned to use IP socket and every remote station will connect to the same computer with different port numbers and send its data every 15 seconds. And our software will listen these ports and get the data and write to the database.
Can this be possible?

Thanks
Macar

[Report Inappropriate or Erroneous Content]

Sam

United States


Campbell Scientific Inc. Employee Campbell Scientific Inc.

Solution: Flood Warning (ALERT)

Posts: 366
Joined: 04/02/09

RE: CR1000 data sending over GPRS
01/20/11 8:07 AM

Macar,

I do not know why it is taking 1 minute to collect one data record from your stations. That is way too long. However, we have already developed a variety of solutions for applications just like yours. The bonus is that you don't have to re-invent the wheel and we have already done the testing!

-------------------------------------
LoggerNet Initiating Communication and Data Collection:
1) Assign "IPPort" root for every remote.
2) Place "PakBusPort" under the "IPPort" - Check "PakBus Port Always Open" - LoggerNet will keep communications open with the remote so that communications do not have to be established every 15 seconds for data transfer.
3) Add you logger under the PakBusPort and set scheduled collection interval to 15 seconds.

-------------------------------------
Logger Initiating Communication, LoggerNet Initiating Data Collection:
(This can also be done using IPPort and unique ports for callback)
1) Assign "IPPort" root for every remote
2) Give each IPPort root
2) Place "PakBusPort" under the "IPPort" - Check "PakBus Port Always Open" - LoggerNet will keep communications open with the remote so that communications do not have to be established every 15 seconds for data transfer.
3) Add you logger under the PakBusPort and set scheduled collection interval to 15 seconds.

1) Add a "PakBusTcpServer" Root to Setup
2) Add your Loggers under the PakBusTcpServer
3) Check PakBus Port Always Open
4) Add the PakBus address ranges that should be maintained
5) Set scheduled collection interval to 15 seconds.
6) Using Device Configuration Utility -> Net Services -> PakBus/TCP Client Connections, enter the address and port number of the LoggerNet server

-------------------------------------
Logger Initiating Communication, Logger Initiating Data Collection
1) Use IPPort (with callback enabled) or PakBusTcpServer root - which one to used depends on if all stations need to share a single IP port for callback.
2)

Sam Utley
Communication Products Manager

[Report Inappropriate or Erroneous Content]

Sam

United States


Campbell Scientific Inc. Employee Campbell Scientific Inc.

Solution: Flood Warning (ALERT)

Posts: 366
Joined: 04/02/09

RE: CR1000 data sending over GPRS
01/20/11 8:15 AM

Macar,

I do not know why it is taking 1 minute to collect one data record from your stations. That is way too long. However, we have already developed a variety of solutions for applications just like yours. The bonus is that you don't have to re-invent the wheel and we have already done the testing!

-------------------------------------
LoggerNet Initiating Communication and Data Collection:
1) Assign "IPPort" root for every remote.
2) Place "PakBusPort" under the "IPPort" - Check "PakBus Port Always Open" - LoggerNet will keep communications open with the remote so that communications do not have to be established every 15 seconds for data transfer.
3) Add you logger under the PakBusPort and set scheduled collection interval to 15 seconds.

-------------------------------------
Logger Initiating Communication, LoggerNet Initiating Data Collection:

(This can also be done using IPPort and unique ports for callback)
1) Assign "IPPort" root for every remote
2) Set Callback enabled for each IPPort
3) Assign a unique IP Port used for call back for each IPPort root (if you need a shared port, see PakBusTcpServer")
4) Place "PakBusPort" under the "IPPort" - Check "PakBus Port Always Open" - LoggerNet will keep communications open with the remote so that communications do not have to be established every 15 seconds for data transfer.
5) Add you logger under the PakBusPort and set scheduled collection interval to 15 seconds.
6) Using Device Configuration Utility -> Net Services -> PakBus/TCP Client Connections, enter the address and port number of the LoggerNet server

-------------------------------------
Logger Initiating Communication, Logger Pushing Data or Initiating Data Collection

1) See steps 1 - 4 above
2) Use CRBasic to program the logger to open a connection with the LoggerNet server - See the "TCPOpen" instruction

3a) Use the socket result from "TCPOpen" as the ComPort for the "SendData" instruction. This will push data to the server.

3b)Use the socket result from "TCPOpen" as the ComPort for the "SendVariables" instruction. Set "TableName" = "Public", "FieldName" = "callback", "Variable" = 1, and "Swath" = 1. The logger will is basically saying, "Hey I'm calling back, collect my data now".

To discuss this further, definitely call in to our support line and ask for Sam or Software Support.

Sam Utley
Communication Products Manager

[Report Inappropriate or Erroneous Content]

macarli


Posts: 6
Joined: 01/19/11

RE: CR1000 data sending over GPRS
01/21/11 7:45 AM

Hi Sam,
Thanks for your answer again. These approaches are reasonable for us. However i cant make the link (i am new in CRBasic:( ).
I have some questions;

1. In the first approach, do i have to use dynamic IP?
2. I think second approach is most suitable for us. I tried this but i cant make the link. In fact I do not understand what must i do in logger side. Moreover what should i write to the "internet IP address" in the loggernet IPport. Can you please tell these detailed and any example?

thanks
Macar

[Report Inappropriate or Erroneous Content]

Sam

United States


Campbell Scientific Inc. Employee Campbell Scientific Inc.

Solution: Flood Warning (ALERT)

Posts: 366
Joined: 04/02/09

RE: CR1000 data sending over GPRS
01/21/11 8:26 AM

Macar,
First I will say that I know little about GPRS modems and the examples given are generalized for a logger with an IP connection, however that be made (e.g. NL120, Cellular modem).

Regarding (1), the remote logger must accessible via a known IP address or hostname. Additionally, the port used for PakBus communications must be known. That information will be used to populate the "Internet IP Address" field of the "IPPort" root in LoggerNet's Setup. Here ares some examples: 555.555.555.555:6785 or my.logger.com:6785.


Regarding (2), the "Internet IP Address" field of the "IPPort" root in LoggerNet's Setup will be left blank. That's right, blank. One of the advantages of (2) is that the IP address of the remote does not need to be known because the logger is calling home. The logger knows where the LoggerNet server is located (static IP) and initiates communications. However, it is very important that you populate the "IP Port Used for Call-Back" field and check the "Call-Back Enabled" box. Subsequently, you need to make your LoggerNet Server and that call-back port accessible to the outside world so your remote logger can successfully connect. Then using Device Configuration Utility -> Net Services -> PakBus/TCP Client Connections, enter the address and port number of the LoggerNet server.

On my desk, I did the following:

1) Add IPPort Root
Internet IP Address = (cleared) ":6785"
Call-Back Enabled = CHECKED
Cache IP Address = CHECKED
IP Port Used For Call-Back = "6785"

2) PakBusPort (under IPPort)
Communication Enabled = CHECKED
PakBus Port Always Open = CHECKED

3) CR1000 (under PakBusPort)
Communications Enabled = CHECKED
Call-Back Enabled = CHECKED
PakBus Address = (*UNIQUE* PakBus address of the Remote) 10
Scheduled Collection Enabled = CHECKED
Collection Interval = 15s
Data Tables of Interest Included For Scheduled Collection

4) Opened my firewall to forward inbound traffic on port 6785 to port 6785 of my LoggerNet server computer

5) On remote CR1000 logger,
Device Configuration Utility -> Net Services -> PakBus/TCP Client Connections
Entered the address and port number of my LoggerNet server

6) Waited until logger established communications with LoggerNet server. This can take several minutes after a power cycle, but all the data will be collected when coms are established. I know it has called back by watching the Log Tool output and also by seeing that "Internet IP Address" was automatically populated for me when the logger connected in.

7) When I added additional loggers, I repeated steps 1-6, but I used a unique PakBus address for the new remotes and a unique Port for call back.

* Last updated by: Sam on 1/21/2011 @ 8:28 AM *

Sam Utley
Communication Products Manager

[Report Inappropriate or Erroneous Content]

macarli


Posts: 6
Joined: 01/19/11

RE: CR1000 data sending over GPRS
01/25/11 9:38 AM

Sam,

Do i have to use Raven Modems for IPport communication? Because i cant connect the CR1000 to IPport by using EZ-10 GPRS modem. I think AT commands and PPP settings are diffrent.
Any idea?

[Report Inappropriate or Erroneous Content]

Sam

United States


Campbell Scientific Inc. Employee Campbell Scientific Inc.

Solution: Flood Warning (ALERT)

Posts: 366
Joined: 04/02/09

RE: CR1000 data sending over GPRS
01/26/11 8:43 AM

No. You do not have to use the Raven. However, you will want to configure the EZ-10 to support PPP communications with the logger. That will require understanding the sequence of AT+ commands required to configure the modem.

Sam Utley
Communication Products Manager

[Report Inappropriate or Erroneous Content]

macarli


Posts: 6
Joined: 01/19/11

RE: CR1000 data sending over GPRS
01/27/11 3:11 AM

When i tried by connecting the CR1000 to the hyperterminal, i see my problem is similar to the thread "http://www.campbellsci.com/forum/messages.cfm?threadid=0EEE806B-07C3-0D3D-B1FC4391399F8B45".

As like there, I always see "AAAAAAA+++AAAAAAA" string. CR1000 waits an echo from the terminal, so when i press "A" then it goes on process as in my modem dial string. However for my modem(supports Hayes Modem Protocol), it echo back when "AT" comes. So modem never echo to the CR1000 since "A" and "T" donot come together. So, CR1000 goes on sending "AAAAA"s and modem always wait.

Do i made something wrong or how can i overcome this problem?

[Report Inappropriate or Erroneous Content]

Next Page

1 2

Previous Page

Reply

Please login to post a response.