Data Loggers - FLARE-forecast/flare-forecast.github.io GitHub Wiki

Description

The data loggers are responsible for reading and buffering data from sensors, and then transmitting them to fitlet edge gateways. Different models of Campbell Scientific dataloggers are used in several lakes and reservoirs to gather observational data from sensors in the environment. A CRBasic code on the datalogger is responsible to transfer the data from the datalogger to the corresponding fitlet edge gateway connected to the data logger via the FTP protocol through a local Ethernet link between the two devices; the data logger acts as the FTP client, and the gateway acts as the FTP server.

Setup and Configuration

Note: The following documentation is based on Campbell Scientific CR300 datalogger. The approach should work the same on other similar models such as CR310 and CR6.

Overview of functionality

  • Programming of Campbell CR300 Series Dataloggers via RS-232 or wired ethernet connection.
  • Communication with Fitlet3 via FTP over wired ethernet connection.
  • All of this allows a user to download a program onto the datalogger and test if it will put data to the correct directory on the Fitlet3.
  • NOTE: use either the ethernet connection OR the RS-232 connection after the IP address of the datalogger has been set up.
  • Tested using Fitlet3 and Windows 10 Home.

Software Setup (Windows Machines Only)

Downloading PC400 Datalogger Support Software

  1. Create account/sign in with Campbell Scientific
  2. Download PC400 software
  3. Must get a CD key from an email from Campbell Scientific before the next step.
  4. Run the PC400_4.8.exe file.
  5. Agree to terms and conditions, input key and company name, click next and finish for rest of options.
  6. Open the PC400 application.

Setting up the IP address of the datalogger, via RS-232

  1. Connect the datalogger to the computer with an RS-232 cable.
  2. In the top toolbar, select Tools -> Device Configuration Utility.
  3. In the pop-up window, in the Device Type scrolling menu, select Datalogger -> CR300 Series
  4. Under Connection Type, select Direct
  5. Under Communication Port, select the COM port that the datalogger is connected to.
  6. Click Connect, then Ok.
  7. Navigate to Deployment -> Ethernet, then input the following settings:
  • IP Address: 10.10.1.1
  • Subnet Mask: 255.255.255.0
  • IP Gateway: 10.10.1.2
  1. Click Apply, then Yes.

Connecting to the datalogger via ethernet

  1. Open the Settings application on your windows machine.
  2. Navigate to Network & Internet -> Ethernet -> click the Identifying... option with No Internet.
  3. Under IP settings/IP assignment, click Edit.
  4. Select Manual, toggle IPv4 to On, and input the following settings:
  • IP address: 10.10.1.3
  • Subnet prefix length: 24
  • Gateway: 10.10.1.1
  1. Click Save.
  2. In the PC400 application:
  3. In the top toolbar, select Network -> Add Datalogger, which brings up the EZSetup Wizard.
  4. Introduction:
  • Next
  1. Communication Setup:
  • Select the CR300Series Option from the scrolling menu, Next
  • IP Port, Next
  • Click the magnifying glass icon next to the search bar -> in the pop-up window, click Add Selected, Next
  1. Datalogger Settings and Setup Summary:
  • Next (keep defaults)
  1. Communication Test
  • Select Yes
  • Next
  • Make sure connection has been established
  • Finish (keep connection open)

Connecting to the datalogger via RS-232:

  1. In the PC400 application:
  2. In the top toolbar, select Network -> Add Datalogger, which brings up the EZSetup Wizard.
  3. Introduction:
  • Next
  1. Communication Setup:
  • Select the CR300Series Option from the scrolling menu, Next
  • Select Direct Connect, Next
  • Under COM Port, select the COM Port that the datalogger is connected to, and install USB driver (if necessary)
  • Under COM Port Communication Delay, select 3 seconds, then click Next
  1. Datalogger Settings and Setup Summary:
  • Next (keep defaults)
  1. Communication Test
  • Select Yes
  • Next
  • Make sure connection has been established
  • Finish (keep connection open)

Downloading the test program to the datalogger

  1. In the PC400 application (make sure you are connected to the datalogger at this point):
  2. Click the Blue Pencil in the top tool bar, then select CR300/CR310 Series Program from the All menu.
  3. Delete all text in the text editor, then copy and paste the following into the editor:
'Declare Private Variables
Public LoggerTemp, BattV
Public FTPResult

'Define Data Tables.
DataTable (FTPTest,1,-1) 'Set table size to -1 to autoallocate.
  DataInterval (0,15,Sec,10)
  Minimum (1,BattV,FP2,False,False)
  Sample (1,LoggerTemp,FP2)
EndTable

'Main Program
BeginProg
  Scan (1,Sec,0,0)
    PanelTemp (LoggerTemp,400)'used to be 250
    Battery (BattV)
    CallTable FTPTest
NextScan
    
SlowSequence
Do
  Delay(1,10,Sec)
  'Create file named FTP_Tutorial_1.csv and append data to the file every
  '5 minutes; for 1 minute intervals change from 9, 0, 5 to 9, 0, 1
  FTPResult=FTPClient ("10.10.1.2", "ftpuser", "[password]", "FTPTest", "/data/datalogger-data/FTP_Tutorial_1.csv", 9, 0, 5, Min, -1008)
  Loop
EndProg
  1. Under the top tool bar, select the 4th icon (save icon with green arrow), which is the Compile, Save, and Send icon. Click Send in the pop-up window.
  2. After compilation and transmission is complete, disconnect the datalogger from the computer, and connect it to the Fitlet using an ethernet cable.
  3. ssh into the Fitlet, and run the command
sudo tail -n 50 /var/log/vsftpd.log

-> Should see FTP logs stating that ftpuser logged into the FTP server and uploaded a file.
7. Check the uploaded file by running the command

sudo cat /data/datalogger-data/FTP_Tutorial_1.csv

-> Should see a bunch of data entries with dates, times, etc.

Other Resources

Information on FTP streaming