Met Instruments Project

Configuring Serial Sensors with Retired Campbell Scientific Data Loggers: A Guide

For this demonstration we will be using a Campbell Scientific CR23X Micrologger and R. M. Young 61302L barometric pressure sensor.

Ensure the sensor you are employing is configured correctly. This may include changing relevant settings through software like baud rate, output format, etc. Or perhaps changing physical jumper settings within the sensor itself. Using a terminal emulator with a null modem cable configuration will allow one to perform software changes. I personally use HyperTerminal but there are a multitude of other options out there that achieve the same thing. It truly comes down to preference.

Unlike modern CSI data loggers, older devices have baud rate limitations that need to be taken into consideration when connecting serial devices.

The CR23X RS-232 port baud rate can be set to a maximum of 76800, while the control ports (C5, C6, C7, C8) can only be configured for a maximum rate of 4800. The only caveat to using the RS-232 port is that you cannot use both that and CS I/O port simultaneously. With this in mind, ensuring the sensor is capable of the maximum baud rate of the control ports is imperative.

For this demonstration, the data logger will be recording data at one second intervals at a baud rate of 4800.

Edit: I’ve found the control port baud rate for the data logger will function correctly up to 9600 despite what the manual states.

R. M. Young 61302L

Out of the box the 61302L by default will have P1 jumped for 9600 baud continuous ASCII output and P3 jumped for RS-232 output. Removing all jumpers from P1 will set the sensor to accept software commands.

With the sensor hooked up through HyperTerminal, pressing ESC (ASCII 27) three times puts the sensor into COMMAND mode, pausing data output. From here we can set the output interval and baud rate.

CMD100 n changes the output interval. Sending command “CMD100 1” will set this interval to 1 Hz.

CMD160 n changes the baud rate. Sending command “CMD160 4800” will set the baud rate of the sensor to 4800. Be aware that changing the baud rate of the sensor will be enacted immediately. The terminal emulator baud will need to be changed to regain communication with said sensor.

CMD300 n sets the sensor to pause or run. Sending command “CMD300 2” will set the sensor to resume measurement.

Since we’ve set the 61302L to once again output data, sending commands directly through the terminal command line is next to impossible. To get around this issue, creating a .txt document with the command “CMD420” saved within it can be directly sent to the sensor to burn the parameter settings to memory while it is outputting data. Doing so will keep the configuration even after power has been disconnected.

Now with the 61302L configured, we can move onto the data logger.

Campbell Scientific CR23X

For the CR23X, programming it to read serial strings is pretty straight forward. To do this, all we need is Edlog. This logger programming software can be found within either LoggerNet or PC400.

Instruction 15 is the code block required to send and receiver serial data to and from the data logger. With P15 now within your program, we can configure each parameter to read incoming serial data from the 61302L.

Quoted text denotes excerpts from the CR23X manual.

Parameter 1 – Repetitions

“Parameter 1 specifies the number of sensors that can be read using the same Instruction 15 parameter configuration.” We only have one sensor read by the data logger, so this will be set to 1.

Parameter 2 – Configuration Code

“The configuration code is a two-digit number specifying the input format, logic level, baud rate, buffering option, and optional decimal delimiter. Index (- -) this parameter to indicate that you do not want to buffer received data.”

Since the 61302L outputs via RS-232 at a baud rate of 4800, we can deduce the XY code. RS-232 ASCII is assigned to 0, and 4800 baud is assigned to 3. Therefore we put 03 in parameter 2. We also want to index this parameter as we do not want to buffer data.

Parameter 3 – CTS / Delay Before Send

This parameter configures the CTS. Because the CR23X and 61302L are communicating asynchronously, we can set this parameter to 1.

Parameter 4 – Control Port Configuration

“A two-digit parameter (AB) indicates the control port(s) that will be used by the first repetition (A+1 and/or B+1 may also be used depending on the P15 CONFIGURATION selected). Control Ports 1, 2, 3, and 4 support hardware flow control (DTR/RTS and CTS lines). Control Ports 5, 6, 7, and 8 support transmit and receive (TXD and RXD) data lines.”

The 61302L uses only the TX and RX lines to communicate. Because of this, we will be using 2 control ports. Control Port 8 will be the RX for the data logger, receiving serial strings the sensor sends. Control Port 4 will be the DTR for the 61302L from the data logger. Now configuring the parameter, Control Port 4 is 4, and Control Port 8 is 8, that gets us 48. While these are the ports I have chosen, you can configure them to your liking.

Parameter 5 – Output Start Location

This parameter denotes the starting location of a stored value the data logger will send to a sensor. Since we are not sending anything to the 61302L, this will be set to 0.

Parameter 6 – Number of Locations to Send; Preamble or Data

As with parameter 5, we have nothing to send, so the number of locations with data to send is also 0.

Parameter 7 – Input Termination Character

“The termination character is used to mark the end of the ASCII string received by the CR23X.” This number is the ASCII decimal equivalent of the termination character. The termination character in our string is CR (Carriage Return). The ASCII equivalent of Carriage Return is 13.

Parameter 8 – Maximum Number of Characters to Receive

“Parameter 8 defines the total number of characters to expect per input, including numeric, non-numeric, polarity, decimal, space, and carriage return characters.” Our input string from the 61302L is “1000.00CRLF” which in total give us 11 characters. There is sometimes a garbage character that accompanies data strings, adding another character anticipates this occurring. After adding a miscellaneous character, set this value to 12.

Parameter 9 – Delay for Clear-To-Send or Serial Input

“Parameter 9 is a 4 digit number that specifies a time-out delay in units of 0.01 seconds. The CTS time-out only applies to control port option 7.” Since both devices are communicating asynchronously without CTS, this parameter will be set to -1 to denote the instruction moves on once it reaches the termination character.

Parameter 10 – Input Location

“This parameter defines the location in the CR23X’s Input Storage where the first received data value is stored. Multiple data values are stored in sequential input locations starting with the location specified by Parameter 10.” The input location set here is where the data received by the 61302L is saved to intermediate storage. You can name this at your discretion.

Parameters 11 and 12 – Multiplier and Offset

The Multiplier and Offset can be used to scale and offset input data. Multiplier of 1 and Offset of 0 preserve the original data value. Since we aren’t modifying the data any further, we can leave these values as they are.

Now with Instruction 15 correctly integrated within the data logger program, it can now read serial strings sent by the sensor. The strings are saved to a selected input location and can be treated as regular numeric values.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: