6 Software development
The SQM-LU-DL uses the FTDI FT232R chip to communicate as a standard serial port device at 115200 baud using
the FTDI software drivers which are available for all major operating system platforms. Drivers are available from
www.ftdichip.com .
Once the driver is installed, commands can be sent to the SQM-LU-DL using a serial terminal emulator to the serial
communications port that the device routes to.
When connecting the SQM-LU-DL to a PC where the FTDI device driver is loaded, the serial port label will be
determined at connection time.
Each SQM-LU-DL has a unique serial number usually with a prefix of “FT........”. This serial number can be used to
identify the exact SQM-LU-DL device from other USB devices.
6.1 Writing your own software interface
All of the commands and responses of the SQM-LU-DL are documented in Section 8.
To communicate with the SQM-LU-DL, the following general steps are required:
1. A serial 115200 baud connection must be made to the serial port assigned to the SQM-LU-DL.
2. Data commands are sent to the SQM-LU-DL, and it responds with a string of characters.
3. Close the serial port so that other programs can access the SQM-LU-DL. Note: Only one connection can be made to
the SQM-LU-DL at a time. Therefore leaving a connection open constantly prevents other connections from being
made.
Various examples of reading from the SQM devices are supplied on the CD and available at the Unihedron website.
Below is an example using Perl to read the SQM USB device:
Listing 6.1: Read SQM-LU using Perl
#!/usr/bin/perl
#Filename: read-sqmlu.pl
#Description: Utility to read Unihedron Sky Quality Meter-LU (USB model)
# Define the required module
use Device::SerialPort;
# Open and configure serial port
$
port= Device::SerialPort->new("/dev/ttyUSB2");
$
port->user_msg(ON);
$
port->baudrate(115200);
$
port->parity("none");
$
port->stopbits(1);
$
port->databits(8);
$
port->handshake("none");
$
port->write_settings || undef
$
port;
$
port->read_char_time(1);
# Wait for each character
# Send request to SQM
$
port->write("rx\r");
# Get response from SQM
(
$
count,
$
saw)=
$
port->read(255);
23
Summary of Contents for SQM-LU-DL
Page 2: ......
Page 17: ...17...
Page 19: ...Figure 4 1 Front and back of of unit Unihedron SQM LU DL Operator s Manual 20220119 19...