How to Use Call-back Capability so Your Data Logger Initiates Data Retrieval

by Jacob Davis | Updated: 02/22/2017 | Comments: 2

Search the Blog


Subscribe to the Blog

Set up your preferences for receiving email notifications when new blog articles are posted that match your areas of interest.


Area / Application

Product Category

Activity

Corporate / News

Enter your email address:



Suggest an Article

Is there a topic you would like to learn more about? Let us know. Please be as specific as possible.

Leave this field empty

Communication initiated by a datalogger with data being sent to a PC via PakBus protocol

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.

Getting Started

Two things must happen for call-back to work:

  1. The communications link must be established.
  2. The data logger must tell LoggerNet to start data collection.

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.

Direct Serial Connection

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.

Setup Screen with ComPort selected

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
  • The If block controls how often call-back happens.
  • The SendVariables() instruction is what triggers the data collection.

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.



IP Connection

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.

PakBusTcpServer selected

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.

IP address entered

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

Conclusion

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.


Share This Article



About the Author

jacob davis Jacob Davis is the Technical Support Manager at Campbell Scientific, Inc. He directs a group of talented, experienced technical support engineers. His specialties include serial communications and advanced data logger programming. Jacob has a master’s degree in Hydrology and worked with large irrigation projects before coming to Campbell Scientific, Inc.

View all articles by this author.


Comments

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.

Please log in or register to comment.

We're active on Social Media!
Stay informed with our latest updates by following us on these platforms: