Campbell Scientific
This guide walks through connecting Campbell Scientific dataloggers to the platform using FTP file uploads. The logger writes data files and periodically pushes them to an FTP server, which the platform then reads automatically.
Note: We recommend creating a Blueprint and your Sensors first, so that when you map the data source labels at the end of this guide, you have sensors to connect to.
1. Configure the datalogger program
The Campbell logger should be configured to write measurements to a data file and periodically send that file to an FTP server using the FTPClient() function.
Example CRBasic snippet:
Public Result As Long
BeginProg
Scan(1,Min,0,0)
FTPClient(
Result,
"ftp.example.com",
"username",
"password",
"TOA5_Data.dat",
"/incoming/Data.dat",
0
)
NextScan
EndProg
This pushes the data file to the FTP server at the defined interval.
2. Add a data connection
In the Sensly portal, add a data connection and choose FTP. Enter the FTP server credentials for the server where the logger uploads its files.
3. Add a data source
Under Data sources, create a new data source using the FTP connection you created.
Specify the file path where the logger uploads the data file.
Set the schedule for when to check the FTP server for updated files.
4. Map the file
Configure the file by selecting the File to map from the directory. If only one file is found, it will be auto-selected.
Note: If additional files appear in the File to map dropdown that you do not want processed, update the File match string on the data source details page to filter them out.
Select the Labels row (the row that identifies each column for matching to sensor inputs) and the Data row (where the data starts, so the header is not processed). For Campbell Scientific files, the Labels row is usually 2 and the Data row is usually 5.
Select the Datetime column; the Datetime format will be auto-populated but can be edited if needed. The notation for datetime formats is described in 5. Datetime format in Data sources.
5. Map the sensor inputs
Map the platform sensor inputs to the corresponding columns in the Campbell data file (for example displacement, tilt, temperature, or water level).
Once configured, the platform will automatically import new records from the uploaded files and update the sensor data.
Note: If additional sensors are mapped after a file has been processed, the data source will need to be re-run by reprocessing the data.