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.

Using FTPClient with Modem


SoilResearcher May 21, 2010 06:14 AM

We have a cr1000 data logger and a wavcom modem in the lab. We would like to transfer the data table within a slow sequence scan (e.g. every 4 hours) to a FTP server. I am strugling somehow to figure out how to dial the modem, send it with the FTP command and finally hang up the modem. I assume that I have to use the commans


DialSequence
...

FTPClient()

ModemHanup
....

Does anyone have an example from which I can dervie the solution I need (i.e. dial modem, ftp data, hang up modem)?

Many thanks in advance


aps May 21, 2010 09:33 PM

To send via ftp you need to establish a TCP/IP link to the server you want to ftp too.

On a GSM link this would normally be done by using a GPRS connection, not a dial-up connection.

Please refer to this manual, for details of using the Wavecom in GPRS mode:

ftp://ftp.campbellsci.com/pub/csl/outgoing/uk/manuals/cs_gprs.pdf

You can open the PPP/TCPIP link on a timed basis by using PPPOPen and PPPClose. See the CRBasic help for more info.


SoilResearcher May 25, 2010 01:37 PM

Thaks for your hint. There is still one thing which is not clear to me: Does PPPOpen also force that the modem is dialing? And how does PPPOpen know, on which port the mode is?

After studying the manuals i think i will proceed in the following way:

-----------------------------------------
Const Modemport=COMME
Const Modembaud = 9600 'Change to match modem baud rate
Public P3Open as String, P3Close
Public FTPSuccess as Boolean

BeginProg
SlowSequence
Scan (1,Min,3,0)
SerialOpen (Modemport,modembaud,0,0,100)
SerialOut (Modemport,"AT+CPIN=601141"+CHR(13),"0"+CHR(13),1,100)
' Sending further AT Commands for modem configuration
SerialClose(Modemport)

P3Open=PPPOpen
FTPSuccess = FTPClient(P3Open,....)
P3Close=PPPClose

NextScan;
EndProg
--------------------------

Is this about the correct way to communicate with the modem or does something miss?


aps May 25, 2010 03:05 PM

PPPOpen automatically issues the dialling command to make a GPRS connection. Please refer to the manual listed above. The dial command and port used are setup in the logger using the Device Configuration program.


SoilResearcher Jun 29, 2010 01:13 PM

Hmmm still struggling with Modem and CR Logger. This time, I use a CR1000 with a WaveCom Fastrackt, connectet by a SC-WMI and the SC12 cable to the CS I/0 Port of the CR1000 loggger. The power line is connected to the SW12V. The program i tried to send the data is:

'Declare Public Variables
'Example:
Public PTemp, batt_volt
Public FTPSuccess As Boolean
Public LastFname As String * 32
Public OutStat
Public fname As String * 64
Public rTime(9) 'declare as public and dimension rTime to 9


Dim i

Const Ort = "ZZZ"

'Define Data Tables
DataTable (Daten,1,-1)
DataInterval (0,0,Sec,10)
TableFile ("USR:Daten_",8,-1,0,2,Min,OutStat,LastFname)
Minimum (1,batt_volt,FP2,0,False)
Sample (1,PTemp,FP2)
EndTable

'Main Program
BeginProg

Scan (2,Min,0,0)
PanelTemp (PTemp,250)
Battery (Batt_volt)
CallTable Daten

'Turn on modem
SW12 (1 )
Delay (0,45,Sec)
PPPOpen

RealTime( rTime )
FTPSuccess=FTPClient("ftp.domain.ch","***","***",LastFname,"fname.txt",0)
If FTPSuccess Then
FileManage(LastFname,8) 'Delete this file
EndIf

PPPClose
SW12 (0)

NextScan
EndProg


The configuration of the logger is as following:

PakBus Address 1
Security Level 1 0
Security Level 2 0
Security Level 3 0
Is Router 0
PakBus Nodes Allocation 50
Baud Rate RS232 115200 Auto
Baud Rate ME 9600 Fixed
Baud Rate COMSDC 9600 Fixed
Baud Rate COM1 0 (Not used for PakBus)
Baud Rate COM2 0 (Not used for PakBus)
Baud Rate COM3 0 (Not used for PakBus)
Baud Rate COM4 0 (Not used for PakBus)
Beacon Interval RS232 0
Beacon Interval ME 0
Beacon Interval SDC7 0
Beacon Interval SDC8 0
Beacon Interval SDC10 0
Beacon Interval SDC11 0
Beacon Interval COM1 0
Beacon Interval COM2 0
Beacon Interval COM3 0
Beacon Interval COM4 0
Verify Interval RS232 0
Verify Interval ME 0
Verify Interval SDC7 0
Verify Interval SDC8 0
Verify Interval SDC10 0
Verify Interval SDC11 0
Verify Interval COM1 0
Verify Interval COM2 0
Verify Interval COM3 0
Verify Interval COM4 0
Neighbors Allowed RS232 Begin Range End Range
Neighbors Allowed ME Begin Range End Range
Neighbors Allowed SDC7 Begin Range End Range
Neighbors Allowed SDC8 Begin Range End Range
Neighbors Allowed SDC10 Begin Range End Range
Neighbors Allowed SDC11 Begin Range End Range
Neighbors Allowed COM1 Begin Range End Range
Neighbors Allowed COM2 Begin Range End Range
Neighbors Allowed COM3 Begin Range End Rang
Neighbors Allowed COM4 Begin Range End Range
Central Routers Central Router
Routes
Port Number 1
PakBus Address 4'094
Via Neighbor Address 4'094
Response Time 1'000
USR: Drive Size 1'003'520
Files Manager Files Manager Name Prefix Number of Files
Max Packet Size 1'000
RS232 Always On Yes
RS232 Hardware
Handshaking Buffer Size
0
RS232 Hardware
Handshaking Timeout
0
Default Gateway 0.0.0.0
Name Servers 0.0.0.0
Name Servers 0.0.0.0
PPP Interface CS I/O ME
PPP IP Address 0.0.0.0
Reserved 255.255.255.255
PPP User Name gprs
PPP Password gprs
PPP Dial AT+CFUN=1;;;;;;AT+CGDCONT=1,"IP","gprs.swisscom.ch";ATD*99***1#
PPP Dial Response CONNECT
PakBus/TCP Server Port 6'785
PakBus/TCP Client
Connections
PakBus/TCP Client Connections Port Number
HTTP Server Port 80
FTP Server Port 21
FTP User Name anonymous
FTP Password *
Ping Enabled 1
FTP Enabled 1
Telnet Enabled 1
HTTP Enabled 1
IP Trace COM Port Inactive
IP Trace Code 0
TCP/IP Info ppp ip: 0.0.0.0 ppp mask: 255.0.0.0 ppp gw: 0.0.0.0


Does anyone can give me a hint why the connection of the modem with the ftp server fails?

Kind regards


aps Jun 30, 2010 03:37 PM

If the Wavecom was sourced from Campbell Scientific Ltd, it would have been set to respond with numeric result codes so it will respond with 21 for the connect message not CONNECT.

If the wrong connect message is entered the logger will think the connection has failed and never establish the full PPP connection.


SoilResearcher Jul 1, 2010 07:48 PM

Thx for your reply, however it does not solve the problem (i.e. connection did not established).

I bought the modem from Campbell Scientific Ltd and I did not made any changes in the configuration, so it should behave as you said ...

To test the respond of the modem, I connected the wavecome modem directly with a 15-to-9 pin cable (which I have from a CS-GPRS) to a labtop to send the dial string with hyperterminal. In this case, the modem answered with CONNECT. Thus, if the SC-WMI (i did not use in the hyperterminal-connection-setup) does not have an influence on the answer of the modem, then why does the modem give the "wrong" answer?

Is their any other possibilty to debug the dial-procedure of the modem (and thus finding out where the problem might be)?


aps Jul 1, 2010 09:36 PM

Please send me your email address and I will give a more detailed procedure. It sounds like the modem has been reset to factory defaults if it is responding CONNECT. Did it still work at 9600 baud in hyperterminal? If so your original settings should work.

If not you will need to lock the baud rate back to 9600 baud. Otherwise I can send a more advanced debug procedure.

Email me at:

andrew dot sandford at campbellsci.co.uk

* Last updated by: aps on 7/1/2010 @ 3:37 PM *


francisco.menegotto Jul 11, 2023 06:39 PM

Hi everyone. How can I get access to FTPClient to configure my CR1000 to upload data to FTP server?


JDavis Jul 12, 2023 04:48 PM

Francisco,

Follow this guide found in help resources:

https://s.campbellsci.com/documents/us/technical-papers/ftp-streaming.pdf

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