by Jacob Davis | Updated: 02/22/2017 | Comments: 6
Have you come across situations where you want your data logger to initiate data retrieval, rather than your PC? For example, do you have an environmental condition that you want to transmit alarm data for?
Although IP-based communication is prevalent, sometimes you may need data-logger-initiated communication because of firewalls or issues with private versus public IP addresses. IP-capable Campbell Scientific data loggers have the ability to initiate IP connections. (In fact, our data loggers have had the ability to do call-back on a landline since the release of the CR7 and 21X back in the early 1980s.) While you may need this call-back capability, perhaps you don’t know how to implement it. I hope this article will quickly get you up and going so your data logger is initiating call-back to LoggerNet.
Two things must happen for call-back to work:
Establishing the link is a different process depending on the type of telecommunications you are using. Initiating data collection, however, is the same—regardless of the type of communications link you use.
The most basic telemetry link is a direct serial connection. On a direct connection, the only change to make in LoggerNet is to select the Call-Back Enabled checkbox for the communications port in the Setup screen. That will make LoggerNet open the serial port and listen for incoming data collection requests.
If you are using the RS-232 port on a data logger, it is enabled by default. The communications link is ready. You just need something to happen to tell LoggerNet that the data logger wants to talk. To initiate communication, add a statement such as this to your data logger program:
If TimeIntoInterval (0,1,HR) Then SendVariables (SendResult,COMRS232,0,4094,0000,0,"Public","Callback",PTemp,1) EndIf
LoggerNet will recognize an attempt to set the Public variable named Callback as a request for data collection. Be sure to change the PakBus address in the SendVariables() instruction if LoggerNet is not set to the default of 4094.
After you have made the change in LoggerNet’s Setup screen and loaded the program onto the data logger, data collection will happen in the background. To verify that data collection is happening according to the interval in your data logger program, watch the Status Monitor.
Recommended for You: For more information about the Status Monitor, watch the Status Monitor video.
The configuration for call-back is a little bit different for an IP connection. A PakBusTcpServer is recommended as the root device in the Setup screen. The TCP server has call-back always enabled. It will open an IP port and listen for incoming connections from the attached data loggers. It is a good idea to have the PakBus Port Always Open checkbox selected. The default IP port number used is 6785.
On the data logger, you must instruct it to open an IP socket to LoggerNet. The easy way to do this is with the PakBus/TCP Clients setting on the data logger. You can find this setting on the Network Services tab when your computer is connected to the data logger using DevConfig. You will need to enter the routable IP address and port number of the computer running the LoggerNet server. In this example, the data logger and computer were both within the same Ethernet network. I verified the IP address on the computer, then entered it into the setting on the data logger.
When you use an IP connection, you won’t have a fixed communications port to refer the SendVariables() instruction to. One way to avoid the issue is to use the auto discovery feature of PakBus. A value of -1 as the neighbor address will tell the data logger to ignore the ComPort parameter and use the connection in the data logger routing table. In fact, you can use 0 as the ComPort. The IP connection created by PakBus/TCP Client will be in the routing table and can be used.
SendVariables (SendResult,0, -1,4094,0000,0,"Public","Callback",PTemp,1)
After you make the configuration, call-back over the IP connection will function very much like it does over the serial connection. You now have the data logger itself controlling when LoggerNet collects the data. For example, you could use a simple time-based trigger in the data logger. You could also trigger data collection based on comparing variables to thresholds, as in this example:
If WaterLevel > 10.5 Then SendVariables (SendResult,0,-1,4094,0000,0,"Public","Callback",PTemp,1) EndIf
If you have firewall or IP address issues, you may need to use data-logger-initiated communication—rather than PC-initiated data retrieval. You can use the call-back functionality in Campbell Scientific data loggers for data-logger-initiated communication using either a direct serial connection or an IP connection. Whichever connection type you use, I hope you will find the call-back functionality very useful and easy to configure. If you have any follow-up questions about call-back, feel free to post them below.
jhurmence | 05/18/2018 at 08:58 AM
Will the IP connection solution work with the CR800? We have RV50 modem connected through serial port. We want call-back to an IP address. What would the SendVariables command look like in that case?
JDavis | 05/18/2018 at 11:08 AM
The CR800 is able to make IP connections, if you configure it for PPP mode. There are instructions in the RV50 documentation on how to get that working.
Snohomish County SWM | 01/25/2023 at 10:37 PM
Within the SendVariables command in the example, does the Variable value of "PTemp" and Swath value of "1" have any impact on the results or is only important that a value is getting pushed back to LoggerNet to initiate the call-back?
JDavis | 01/25/2023 at 10:40 PM
Which variable you send does not matter. Swath of 1 is recommended.
Snohomish County SWM | 03/06/2023 at 06:29 PM
Which is more appropriate to use when performing Call-backs over KonectGDS: IPPort or PakBusTCPServer? If the latter, what are the configuration steps in LoggerNet? Thanks.
JDavis | 03/06/2023 at 06:37 PM
If you are using the Konect Pakbus router, there is only one setting you would change in your Loggernet setup versus what is shown in quick start guides. You would need to enable Pakbus Port Always Open on the IP Port in Loggernet.
When going through a Pakbus router, the SendVariables() instruction in the logger should include the Pakbus address of the Pakbus router in the neighbor address parameter.
Please log in or register to comment.