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

por Jacob Davis | Actualizado: 02/22/2017 | Comentarios: 2

Temas Blog

Buscar en el Blog

Suscribirse al Blog

Configure sus preferencias para la recepción de notificaciones por email cuando se publiquen nuevos artículos en el blog que coincidan con sus áreas de interés.

Entre su dirección email:

Sugerir un Artículo

¿Hay algún tema sobre el cual desea saber más? Háganoslo saber. Por favor sea lo más específico que pueda.

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 datalogger 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 datalogger-initiated communication because of firewalls or issues with private versus public IP addresses. IP-capable Campbell Scientific dataloggers have the ability to initiate IP connections. (In fact, our dataloggers 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 datalogger 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 datalogger 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 datalogger, it is enabled by default. The communications link is ready. You just need something to happen to tell LoggerNet that the datalogger wants to talk. To initiate communication, add a statement such as this to your datalogger program:

If TimeIntoInterval (0,1,HR) Then
	SendVariables (SendResult,COMRS232,0,4094,0000,0,"Public","Callback",PTemp,1)
  • 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 datalogger, data collection will happen in the background. To verify that data collection is happening according to the interval in your datalogger 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 dataloggers. 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 datalogger, 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 datalogger. You can find this setting on the Network Services tab when your computer is connected to the datalogger 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 datalogger 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 datalogger.

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 datalogger to ignore the ComPort parameter and use the connection in the datalogger 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 datalogger itself controlling when LoggerNet collects the data. For example, you could use a simple time-based trigger in the datalogger. 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)


If you have firewall or IP address issues, you may need to use datalogger-initiated communication—rather than PC-initiated data retrieval. You can use the call-back functionality in Campbell Scientific dataloggers for datalogger-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.

Compartir este artículo

Acerca del autor

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.

Ver todos los artículos de este autor.


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.