INTRODUCTION

Perl script to record serial data from a Dynon D-10A EFIS. High resolution computer time is appended to each data record to facilitate time sync with other data.

This script works with Dynon software version 2.11 on the D-10A. Earlier software versions had a shorter data stream that is not compatible with this version of the script.

Three Perl modules are required:

  1. Time::HiRes (may be part of the standard perl distribution)
  2. Cwd (may be part of the standard perl distribution). If the Cwd module is not available, the script location can be manually specified in the code. See the comments in the code for more info.
  3. Device::SerialPort (OS X or Unix/Linux) or Win32::SerialPort (Windows). Win32::SerialPort is not part of the standard Activestate distribution of perl for Win32.

An OS X packaage for Device::SerialPort is available via the Fink package distribution system (http://fink.sourceforge.net/).

This script was tested on Apple OS X 10.4.2 with perl 5.8.6, but it should work on any Unix type OS. An early version was tested with Active State Perl on Windows 98, but it is not known if this version will work. A config file for Win32::SerialPort is included inside the "win" directory.

The data parametres to be recorded, their labels and scaling, are specified in the EFIS_data.config file. The default location of this file is the same directory as this script. This can be changed by specifying a new location with the variable "$EFIS_data.config".


WIRING

The EFIS must be connected to the computer serial port as follows:

     EFIS               Computer
   Connector           Serial Port 
  DB-25 Female         DB-9 Female
    Pin 9  Pin 5
    Pin 10  Pin 2
    Pin 22  Pin 3

MUST DO

The following items must be completed by the user, or the script will not function.

  1. The serial port must be specified on lines 2 and 22 of the "EFIS.config" file. The rest of this file should be left as-is.
  2. The EFIS.config file must be located in the same location as the script, or the variable "$config_file" must be set to the config file location.
  3. Ensure the script permissions are set to be exectuable. In the terminal, run the following command "chmod a+x EFIS_data_capture.pl".
  4. Ensure both data files can be read. In the terminal, run the following command "chmod a+r EFIS_data.config EFIS.config".

SHOULD DO

The following items should be completed, but the script will use default values if they are not completed.

  1. Copy the "EFIS_data.config" file to the same location as the script, or set the variable "$EFIS_data_config" to the location of the file.
  2. Edit the "EFIS_data.config" file to set the desired default data rate, the list of variables to record, the order to record them, the labels and units to put in the file header, and the scaling factors to use. The default recording duration can also be specified.

    If the "EFIS_data.config" file is not found, the script will use a default data rate of one record per second, record every variable, in a default order, with headers the same name as the variables, and no scaling. The data units will be as described in the EFIS User's Guide.
  3. Change the default Data Element Separator and Record End Separator, if necessary to match what your spreadsheet or graphing program expects. The default is to use a Tab to separate data fields, and a line Feed between records.
  4. Specify an alternate data file location, if desired. The default data file location is the same location as the script.

HOW TO RUN THE SCRIPT

  1. Connect the EFIS to the computer, using a USB to Serial adapter if required.
  2. Turn on the EFIS.
  3. In the terminal, run "EFIS_data_capture.pl" to record at the default data rate. If something other than the default data rate is desired, run "EFIS_data_capture.pl n" where "n" is the desired data rate in records per second. E.g., for 2 records per second, run "EFIS_data_capture.pl 2". For one record every 5 seconds (i.e. 0.2 records per second), run "EFIS_data_capture.pl 0.2".
  4. To stop data capture, type "Ctrl-C". The data is only flushed to disk periodically - if you hit "Ctrl-C" before any data has been written, no data will be written at all.
  5. The data file will be saved in the same location as the script, unless the $DATA_FILE_LOCATION variable in the script is editted to specify a different location.

TO DO

The following changes may someday be added to the script.

  1. Add a loop to monitor the keyboard, and quit when ESC is pressed.
  2. Check code for detection of Windows, and add this functionality for config and data file locations.
  3. Add selectable record separator to data config file.
  4. Ensure $data_from_file is set to 0 prior to release.
  5. Rework command line switch to be -r X -d Y, where X is the data rate and Y is the duration in minutes.
  6. Done.
  7. Consider moving serial port parametres into the main script, and dropping the EFIS.config file. This may make the script more portable with Windows.
  8. Add code to specify the interval at which the data file should be written to disk.

DONE

The following TO DO items have been completed.

  1. Test what happens if the EFIS is turned OFF then ON during a data capture. OK. Tested on 9 Oct. Get an error on the Terminal screen, but the script keeps running, and it recovers OK once the EFIS is back ON. The script records garbage data while the EFIS is OFF, but it is quite obvious that the data is no good.

Author - Kevin Horton - This email address is being protected from spambots. You need JavaScript enabled to view it.

The author is not an experienced perl programmer. Experienced perl programmers would have written a much more efficient script. But the script works. Please send any suggested improvements to the author.

This script is free software. You can redistribute it and/or modify it under the same terms as Perl itself.

Rev 1 10 Oct 2005