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

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

Mensajes del blog relacionados


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)
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 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)
EndIf

Conclusion

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 is a Customer Support/Implementation Engineer at Campbell Scientific, Inc. He provides technical support to customers and assists with system integration. His specialties include serial communications and advanced datalogger 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.


Comentarios

Please log in or register to comment.