Linux Setup Notes

name and address
created jun 10, 2009; updated jul 18, 2009

Wireless Data Link From Beckman LS-6500 Scintillation Counter


This document describes how to set up a wireless data transfer link between a Beckman LS 6500 scintillation counter and a PC. The data from the scintillation counter are parsed into an HTML file and posted on the web page of an Apache web server running Linux. It assumes you already have a functioning wireless network configured in infrastructure mode.

Configure Serial Port and Wireless Converter

Moxa Nport W2150 Moxa Nport W2150 (photo from manufacturer's website)

A wireless serial port device is a small box that receives data from an RS-232 port, in this case from a scintillation counter, and transmits it wirelessly to your network. When it gets to your network, the data are just ordinary IP packets. The easiest way to capture the data is to have the device send it by UDP. This allows any computer to listen on the appropriate port and collect data passively. Alternatively, sending it by TCP provides better security and data integrity. If you're using Linux, there is no need to write a network program to handle this--just use netcat.

  1. Connect a wireless serial device server such as a Moxa NPort W2150 to a PC using an RJ45 patch cable. Do not power up the NPort until the patch cable is connected.
  2. Change the IP address of your PC to /
  3. Use a browser to connect to the NPort at There is no default password.
  4. Set the NPort to a static IP on your network. Note that it needs two IPs: one for the wireless link, and one for the RJ45 port that you use for the initial configuration.
  5. Configure the NPort serial port to 9600 8N1, no handshaking. Set the Operation Mode to Socket | UDP. In socket mode, the data are sent over the network to your server as UDP network packets. It is much easier to recover the data from these packets using netcat than to install a driver to convert the data back to RS232 format, and then trying to read the data back using a virtual serial port.
  6. Set the Packet length to 0.
  7. Enable Delimiter 1 and set it to 0D. Leave Delimiter 2 disabled. Set Delimiter process to "Do nothing". Set Force transmit to 0.
  8. Configure the NPort wireless settings to match your network and set it to infrastructure mode.
  9. Configure other settings as needed as described in the NPort manual on the CD.

Configure the Scintillation Counter

The scintillation counter does not send data out the RS232 port unless the user program specifically requests it.

  1. Connect the NPort to the serial port on the scintillation counter using a M-DB25---F-DE9 serial cable. Note: do not connect the NPort to the serial port of the Wyse terminal on the LS6500 by mistake. The green WLAN LED should be illuminated on the NPort.
  2. Use the scintillation counter menus to set the global serial port parameters to 9600 8N1, no handshaking.
  3. Edit your user program to activate RS232 output. This needs to be done for each user who needs remote access to their data.

Acquiring data

Netcat copies everything that shows up on port 4001 into a file. These data are formatted in a special code devised by Beckman. The code is documented in the scintillation counter manual. We use Apache and a CGI program to parse the file and convert it into a simple HTML file.

  1. Install netcat (nc6), gcc, and Apache on the Linux server and configure Apache for CGI as described in linuxsetup44.html.
  2. Add a link on your homepage to scintillation.html and copy the scintillation.html file (see below) to your htdocs directory.
  3. Compile and install the scin program (see below) in your cgi-bin directory.
  4. Su to the username that is running httpd, cd to your htdocs directory, and start netcat with the following command:
    nc6 -u -l -p 4001 >> stuff
    Since netcat doesn't have a daemon mode, you should 'nohup' it if you plan on running it continuously.
    nohup `nc6 -u -l -p 4001 >> stuff` &
  5. Start some samples in the scintillation counter. The yellow serial LED should blink on the NPort. Raw data should begin to appear in the file named stuff . If not, check the write permissions, file ownerships, and the system logs (usually /var/log/messages). The data should look something like this:
    e5D#(T   3;#*T 23-3 ;#+R 0.20;#-R -1.7;$]R 25.00;$LR 25.00;#0R 89.44VH
    56D#>R 3.16;#,R 2.3700
    $ S"7
  6. Since netcat often stops running for no apparent reason, it's recommended to write a script using pidof or a similar utility, and set up a cron job to check every five minutes and re-start nc6 whenever it stops running.

Viewing data

In order to read the data, we will use a CGI program to convert it to an HTML file. The data format from the LS6500 is different from that used in the LS3801. The biggest inconvenience in parsing the data is the fact that multiple data items can appear on a single line. Thus, data items can be separated by semicolons or by newlines.

The file scintillation.html should look something like this:

<h4> Scintillation counter logs  </h4> 
<img src="ls6500.jpg" alt="ls6500" title="ls6500" /><br />
This page displays raw output from our
Beckman LS 6500 scintillation counter
in room 146. 
<br />
The data are transmitted wirelessly to our local network using UDP.
The raw data is available to anyone on port 4001.
<br />

Click below to refresh the printout.

<form method="post" action="/cgi-bin/scin">
<input type="submit" value="Refresh full version">


The screen will look like this:

Scintillation counter screen

We shortened the output to display only the basic information. The screen looks like this:

Scintillation counter output

The files and scin.h read and parse the raw data and print the formatted HTML results to stdout. When the user clicks the "Refresh" button, the data are re-analyzed and displayed on the user's browser. Now, your users no longer have to put down their bags of cheesy poofs, get up out of their chair and walk all the way over to the scintillation counter to get their data!

At least, until IT finds out that you're doing something useful with their network and blocks the port.


There are always problems. Oh, yes.

Wired Data Link

An alternative is to connect a computer directly to the scintillation counter and read the data from the serial port. You need a program that monitors the serial port and translates the scintillation counter output into a table. Below is a link to a program that does this for a Beckman LS 3801. Converting the parsing routine to handle the LS 6500 is left as an exercise for the reader. If your serial cable is more than a few feet long, use a diode-based surge protector such as a Tripp-Lite DRS232 to protect the scintillation counter from spikes that can fry the electronics.

This program requires libserial.